aboutsummaryrefslogtreecommitdiffstats
path: root/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-06 12:17:11 -0400
committerJim Hahn <jrh3@att.com>2020-04-06 13:00:04 -0400
commit9f9131575d2e2b1002a3e108f7793a97fa7652ab (patch)
tree68400e6ac1fb32f01f8338803a7d72bdb41215b1 /common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
parenta56d3929f2387252525577fb36f9e03933064b8f (diff)
Address sonar issues in ONAP-logging
Addressed the following sonar issues in ONAP-logging: - use Map instead of ConcurrentHashMap - remove unusued fields - use Map.computeIfAbsent() instead of get()/put() pair - readObject is unsafe - use try-with-resources - junit should assert something Also removed some unused imports. Issue-ID: POLICY-2305 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I3480a55da4d0e771f8083c97770a6c9707d871f7 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java')
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
index 8802d17e..fc0995ba 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
@@ -496,17 +496,17 @@ public class Logger4J implements org.onap.policy.common.logging.flexlogger.Logge
private void writeObject(ObjectOutputStream out) throws IOException {
// write out 'methodName', 'className', 'transId' strings
- out.writeObject(methodName);
- out.writeObject(className);
- out.writeObject(transId);
+ out.writeUTF(methodName);
+ out.writeUTF(className);
+ out.writeUTF(transId);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
// read in 'methodName', 'className', 'transId' strings
- methodName = (String) (in.readObject());
- className = (String) (in.readObject());
- transId = (String) (in.readObject());
+ methodName = in.readUTF();
+ className = in.readUTF();
+ transId = in.readUTF();
// look up associated logger
log = Logger.getLogger(className);