diff options
author | Jim Hahn <jrh3@att.com> | 2020-04-07 13:58:09 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-04-07 17:15:07 -0400 |
commit | 9b3ff5f270572a6760ff07dda9577cdadb53b088 (patch) | |
tree | eacd325199fbb72fddaba94a057178a19e9c3360 /models-interactions/model-impl/rest | |
parent | 3000fdca611c32b7001c553621660b8ea0d2eb49 (diff) |
Address sonar issues in models
Addressed the following sonar issues:
- use RE2 instead of java.util Pattern for "+" and "*"
- don't use deprecated methods
- for Date(long), sonar appeared not to parse the argument's
type correctly. Modified the code slightly to make sonar happy
- duplicate blocks of code
- either log or throw
- missing assert in junit
- for SDNR & VFC, eliminated threads, as they are unnecessary
- duplicate code block in different branches
- useless assignments
- redeclaring abstract methods
- cyclomatic complexity
- used lombok in some cases (e.g., EqualsAndHashCode)
- assert argument order
- actually deleted ControlLoopTargetType, because it is not needed
and sonar complains regardless of which order is used
- add private constructor to utility classes
- use StandardCharsets instead of literals
Also:
- added logback-test.xml to SO to eliminate the voluminous output
from the junit test
Issue-ID: POLICY-2305
Change-Id: I586c331781bedbd54a115a71847d04d293689445
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl/rest')
-rw-r--r-- | models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java index dde3aa2e2..a452c142f 100644 --- a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java +++ b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * rest * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ package org.onap.policy.rest; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Map.Entry; import javax.xml.bind.DatatypeConverter; @@ -262,6 +262,6 @@ public class RestManager { } String auth = username + ":" + (password == null ? "" : password); - return "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes(Charset.forName("ISO-8859-1"))); + return "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes(StandardCharsets.ISO_8859_1)); } } |