diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-31 08:22:13 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-08-31 10:15:07 -0400 |
commit | d5c365f60e492e37a361654974eba1719146bdc2 (patch) | |
tree | f717c2198c1aebe0cc03a5d3e9aec653d0d73807 /feature-server-pool/src/test | |
parent | 7dc71c3d0aedb322aff0cdaaa84340354c41b089 (diff) |
Fix more sonars in drools-pdp
Fixed more sonars in drools-pdp:
- remove commented code
- don't throw generic Exception
- unused field (made it protected instead of private)
- log conditionally
- cognitive complexity
- too many break/continue
- return empty list instead of null
- Random() is not secure
Fixed more eclipse warnings:
- parameterize generic types
Issue-ID: POLICY-2616-sonars3
Change-Id: Ia5ad769b2ea763568cfae3d81807926d89153b09
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-server-pool/src/test')
-rw-r--r-- | feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java index 044067a3..865f4e90 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java @@ -55,8 +55,12 @@ public class AdapterImpl extends Adapter { * Each 'AdapterImpl' instance has it's own class object, making it a * singleton. There is only a single 'Adapter' class object, and all * 'AdapterImpl' classes are derived from it. + * + * Sonar thinks this field isn't used. However, it's value is actually + * retrieved via Whitebox, below. Thus it is marked "protected" instead + * of "private" to avoid the sonar complaint. */ - private static AdapterImpl adapter = null; + protected static AdapterImpl adapter = null; // this is the adapter index private int index; @@ -347,7 +351,7 @@ public class AdapterImpl extends Adapter { boolean rval = false; ClassLoader myClassLoader = AdapterImpl.class.getClassLoader(); for (Object o : objects) { - Class clazz = o.getClass(); + Class<?> clazz = o.getClass(); ClassLoader objClassLoader = clazz.getClassLoader(); try { |