fixed security hotspots & code smells

This commit is contained in:
Marcel 2021-10-17 10:44:47 +02:00
parent 46969deb0f
commit 39191afc2c

View File

@ -5,6 +5,8 @@ import java.net.URI;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.net.http.HttpRequest; import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
@ -19,6 +21,8 @@ public class PublishTaskAssignedEventAdapter implements TaskAssignedEventPort {
String server = "http://127.0.0.1:8085"; String server = "http://127.0.0.1:8085";
Logger logger = Logger.getLogger(PublishTaskAssignedEventAdapter.class.getName());
@Override @Override
public void publishTaskAssignedEvent(TaskAssignedEvent event) { public void publishTaskAssignedEvent(TaskAssignedEvent event) {
@ -37,7 +41,7 @@ public class PublishTaskAssignedEventAdapter implements TaskAssignedEventPort {
try { try {
client.send(request, HttpResponse.BodyHandlers.ofString()); client.send(request, HttpResponse.BodyHandlers.ofString());
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Restore interrupted state... // Restore interrupted state...
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }