From 15014b8ca386a8bfd5c26435f45de94ca06e95e8 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 6 Apr 2020 15:33:23 -0400 Subject: Address sonar issues in drools-pdp Addressed the following sonar issues: - add "final" to public static fields - commented code; some were bogus - just updated the comments so sonar is happy - use "{}" instead of string concatenation - junit should assert something - when using logger, invoke compute-intensive tasks conditionally - use superclass name instead of subclass name to access static fields - don't always return the same value - remove "transient" from fields of classes that aren't Serializable - don't nest try/catch blocks - use appropriate class name in Logger.getLogger() - use Predicate instead of Function - remove unused parameters from private methods - either log or throw - remove duplicate methods - use remove() TLS instead of set(null) - null check is implicit in instanceof check - do something with return value - don't use volatile - don't return "null" list; used Optional instead - add no-arg constructor to non-Serializable superclass - add callSuper=true for EqualsAndHashCode - don't declare "throws XXX" where XXX is a subclass of RuntimeException - remove serialVersionUID field if the class isn't Serializable Also addressed some eclipse warnings: - unused fields - suppress generic typic cast warnings Issue-ID: POLICY-2305 Change-Id: I906d5bf71c1f86531423e23b3667a585cdba45e1 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/drools/models/domains/a/DomainAPolicy.java | 2 -- .../src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java | 2 -- 2 files changed, 4 deletions(-) (limited to 'policy-utils/src/test/java') diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/DomainAPolicy.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/DomainAPolicy.java index 04f20b2a..47972397 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/DomainAPolicy.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/DomainAPolicy.java @@ -27,8 +27,6 @@ import lombok.Data; @Data @Builder public class DomainAPolicy { - private static final long serialVersionUID = -8942432000554391455L; - @SerializedName("type") public String type; diff --git a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java index cfacc7ab..47d6c2d8 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java @@ -45,12 +45,10 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi public class DomainMakerTest { private DomainMaker domainMaker; - private StandardCoder nonValCoder; @Before public void setUp() throws Exception { domainMaker = new DomainMaker(); - nonValCoder = new StandardCoder(); } @Test -- cgit 1.2.3-korg