aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorZlatko Murgoski <zlatko.murgoski@nokia.com>2019-04-05 09:16:55 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-05 09:16:55 +0000
commit740ce4c075564a7005be5737adb9ff5b3f8120aa (patch)
treeebfc727c7caa5619223b3aac2a4c07abf7daf896 /src/main
parentc93c16a08ee818fbdc7899222320b900ef0c7b60 (diff)
parent85fa078bfabea17ffdafcdf2748d1a877f00a3b0 (diff)
Merge "Fix sonar violation"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dcae/common/EventSender.java7
-rw-r--r--src/main/java/org/onap/dcae/common/VESLogger.java6
-rw-r--r--src/main/java/org/onap/dcae/restapi/VesRestController.java7
3 files changed, 9 insertions, 11 deletions
diff --git a/src/main/java/org/onap/dcae/common/EventSender.java b/src/main/java/org/onap/dcae/common/EventSender.java
index 3c95315c..48268d6c 100644
--- a/src/main/java/org/onap/dcae/common/EventSender.java
+++ b/src/main/java/org/onap/dcae/common/EventSender.java
@@ -30,6 +30,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.json.JSONObject;
+import org.onap.dcae.ApplicationException;
import org.onap.dcae.ApplicationSettings;
import org.onap.dcae.common.publishing.EventPublisher;
import org.slf4j.Logger;
@@ -37,11 +38,12 @@ import org.slf4j.LoggerFactory;
public class EventSender {
+ private static final String COULD_NOT_FIND_FILE = "Couldn't find file ./etc/eventTransform.json";
private Map<String, String[]> streamidHash;
private ApplicationSettings properties;
private EventPublisher eventPublisher;
- static final Type EVENT_LIST_TYPE = new TypeToken<List<Event>>() {}.getType();
+ private static final Type EVENT_LIST_TYPE = new TypeToken<List<Event>>() {}.getType();
private static final Logger log = LoggerFactory.getLogger(EventSender.class);
private static final String EVENT_LITERAL = "event";
private static final String COMMON_EVENT_HEADER = "commonEventHeader";
@@ -79,7 +81,8 @@ public class EventSender {
List<Event> events = new Gson().fromJson(fr, EVENT_LIST_TYPE);
parseEventsJson(events, new ConfigProcessorAdapter(new ConfigProcessors(jsonObject)));
} catch (IOException e) {
- log.error("Couldn't find file ./etc/eventTransform.json" + e.toString());
+ log.error(COULD_NOT_FIND_FILE, e);
+ throw new ApplicationException(COULD_NOT_FIND_FILE, e);
}
}
if (jsonObject.has("VESversion"))
diff --git a/src/main/java/org/onap/dcae/common/VESLogger.java b/src/main/java/org/onap/dcae/common/VESLogger.java
index 79681484..1072fb54 100644
--- a/src/main/java/org/onap/dcae/common/VESLogger.java
+++ b/src/main/java/org/onap/dcae/common/VESLogger.java
@@ -25,12 +25,6 @@ import com.att.nsa.clock.SaClock;
import com.att.nsa.logging.LoggingContext;
import com.att.nsa.logging.LoggingContextFactory;
import com.att.nsa.logging.log4j.EcompFields;
-import jline.internal.Log;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.UUID;
public class VESLogger {
diff --git a/src/main/java/org/onap/dcae/restapi/VesRestController.java b/src/main/java/org/onap/dcae/restapi/VesRestController.java
index 510031df..3102c31c 100644
--- a/src/main/java/org/onap/dcae/restapi/VesRestController.java
+++ b/src/main/java/org/onap/dcae/restapi/VesRestController.java
@@ -53,11 +53,11 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class VesRestController {
- private static final Logger log = LoggerFactory.getLogger(VesRestController.class);
+ private static final Logger log = LoggerFactory.getLogger(VesRestController.class);
+ private static final String INVALID_JSON = ApiException.INVALID_JSON_INPUT.toJSON().toString();
private final ApplicationSettings applicationSettings;
private final LinkedBlockingQueue<JSONObject> inputQueue;
-
private final Logger metricsLog;
private final Logger errorLog;
private final Logger incomingRequestsLogger;
@@ -101,7 +101,8 @@ public class VesRestController {
try {
jsonObject = new JSONObject(jsonPayload);
} catch (Exception e) {
- return ResponseEntity.badRequest().body(ApiException.INVALID_JSON_INPUT.toJSON().toString());
+ log.error(INVALID_JSON);
+ return ResponseEntity.badRequest().body(INVALID_JSON);
}
String uuid = setUpECOMPLoggingForRequest();