aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-node/src/main
diff options
context:
space:
mode:
authorConor Ward <conor.ward@ericsson.com>2018-09-19 15:07:46 +0000
committerConor Ward <conor.ward@ericsson.com>2018-09-19 15:07:46 +0000
commit5ecbc83f99f72a197447857f8520449d4cba040e (patch)
treea4430e9ce3e69bb1af286852eee7d5feeec4253b /datarouter-node/src/main
parentc2c9a18dc3212fa69bcb173f5b0ed97c7996c044 (diff)
Fix Sonar bugs
Change-Id: I76b212bf18e2988cba90869fe078aa922c23b44b Signed-off-by: Conor Ward <conor.ward@ericsson.com> Issue-ID: DMAAP-638
Diffstat (limited to 'datarouter-node/src/main')
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java21
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java8
2 files changed, 11 insertions, 18 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java
index 9ddbc25a..5f851398 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java
@@ -69,18 +69,15 @@ public class NodeServlet extends HttpServlet {
.getLogger("org.onap.dmaap.datarouter.node.NodeServlet");
static {
- try {
- final String ws = "\\s*";
- // assume that \\ and \" have been replaced by X
- final String string = "\"[^\"]*\"";
- //String string = "\"(?:[^\"\\\\]|\\\\.)*\"";
- final String number = "[+-]?(?:\\.\\d+|(?:0|[1-9]\\d*)(?:\\.\\d*)?)(?:[eE][+-]?\\d+)?";
- final String value = "(?:" + string + "|" + number + "|null|true|false)";
- final String item = string + ws + ":" + ws + value + ws;
- final String object = ws + "\\{" + ws + "(?:" + item + "(?:" + "," + ws + item + ")*)?\\}" + ws;
- MetaDataPattern = Pattern.compile(object, Pattern.DOTALL);
- } catch (Exception e) {
- }
+ final String ws = "\\s*";
+ // assume that \\ and \" have been replaced by X
+ final String string = "\"[^\"]*\"";
+ //String string = "\"(?:[^\"\\\\]|\\\\.)*\"";
+ final String number = "[+-]?(?:\\.\\d+|(?:0|[1-9]\\d*)(?:\\.\\d*)?)(?:[eE][+-]?\\d+)?";
+ final String value = "(?:" + string + "|" + number + "|null|true|false)";
+ final String item = string + ws + ":" + ws + value + ws;
+ final String object = ws + "\\{" + ws + "(?:" + item + "(?:" + "," + ws + item + ")*)?\\}" + ws;
+ MetaDataPattern = Pattern.compile(object, Pattern.DOTALL);
}
/**
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java
index 2c013ca5..d5b15bca 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java
@@ -53,12 +53,6 @@ public class NodeUtils {
private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger("org.onap.dmaap.datarouter.node.NodeUtils");
private static Logger nodeUtilsLogger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeUtils");
- private static SimpleDateFormat logDate;
-
- static {
- logDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- logDate.setTimeZone(TimeZone.getTimeZone("GMT"));
- }
private NodeUtils() {
}
@@ -241,6 +235,8 @@ public class NodeUtils {
* Format a logging timestamp as yyyy-mm-ddThh:mm:ss.mmmZ
*/
public static synchronized String logts(Date when) {
+ SimpleDateFormat logDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ logDate.setTimeZone(TimeZone.getTimeZone("GMT"));
return (logDate.format(when));
}