fixed security hotspots & code smells
This commit is contained in:
parent
39191afc2c
commit
b072cfc7ce
|
@ -5,6 +5,8 @@ import java.net.URI;
|
|||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -18,6 +20,8 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
|
|||
|
||||
String server = "http://127.0.0.1:8085";
|
||||
|
||||
Logger logger = Logger.getLogger(PublishNewTaskEventAdapter.class.getName());
|
||||
|
||||
@Override
|
||||
public void publishNewTaskEvent(NewTaskEvent event) {
|
||||
|
||||
|
@ -31,7 +35,7 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
|
|||
try {
|
||||
client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
// Restore interrupted state...
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.net.URI;
|
|||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
@ -19,6 +21,8 @@ public class PublishTaskCompletedEventAdapter implements TaskCompletedEventPort
|
|||
|
||||
String server = "http://127.0.0.1:8081";
|
||||
|
||||
Logger logger = Logger.getLogger(PublishTaskCompletedEventAdapter.class.getName());
|
||||
|
||||
@Override
|
||||
public void publishTaskCompleted(TaskCompletedEvent event) {
|
||||
|
||||
|
@ -39,7 +43,7 @@ public class PublishTaskCompletedEventAdapter implements TaskCompletedEventPort
|
|||
try {
|
||||
client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
// Restore interrupted state...
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@ public class Task {
|
|||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public Task() {};
|
||||
public Task() {}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ch.unisg.assignment.assignment.domain.event;
|
||||
|
||||
public class TaskAssignedEvent {
|
||||
public String taskID;
|
||||
public final String taskID;
|
||||
|
||||
public TaskAssignedEvent(String taskID) {
|
||||
this.taskID = taskID;
|
||||
|
|
Loading…
Reference in New Issue
Block a user