diff options
author | Instrumental <jcgmisc@stl.gathman.org> | 2018-03-29 21:40:16 -0500 |
---|---|---|
committer | Instrumental <jcgmisc@stl.gathman.org> | 2018-03-29 21:40:24 -0500 |
commit | b126c6c5f625432722405538692184f5c74edaad (patch) | |
tree | dcbc3a52cb13064356fa650c56fe9c90c475f6ff /auth/auth-core | |
parent | 36b62be84b398044e1feae657c662dba6247782f (diff) |
Clean up Sonar results 3
Issue-ID: AAF-206
Change-Id: I4494990e8e0bd702b475bbbfb140eaadd566d2a0
Signed-off-by: Instrumental <jcgmisc@stl.gathman.org>
Diffstat (limited to 'auth/auth-core')
3 files changed, 15 insertions, 5 deletions
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java index d9f7ac96..17edae42 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java @@ -26,6 +26,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Iterator; +import java.util.NoSuchElementException; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.local.DataFile.Token; @@ -87,7 +88,7 @@ public abstract class AbsData implements Iterable<String> { try { Thread.sleep(200); } catch (InterruptedException e) { - break; + Thread.currentThread().interrupt(); } begin = System.currentTimeMillis(); } @@ -188,6 +189,9 @@ public abstract class AbsData implements Iterable<String> { @Override public String next() { + if(!hasNext()) { + throw new NoSuchElementException(); + } reuse.reset(); int rec = tii.next(); reuse.pos(rec); diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java index 36efb5dc..d12345a9 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java @@ -79,10 +79,16 @@ public class OrganizationFactory { if(orgClass == null) { env.warn().log("There is no Organization." + orgNS + " property"); } else { - for(Organization o : orgs.values()) { - if(orgClass.equals(o.getClass().getName())) { - org = o; + try { + Class<?> orgCls = Class.forName(orgClass); + for(Organization o : orgs.values()) { + if(o.getClass().isAssignableFrom(orgCls)) { + org = o; + } } + } catch (ClassNotFoundException e1) { + env.error().log(e1, orgClass + " is not on the Classpath."); + throw new OrganizationException(e1); } if(org==null) { try { diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java index 7bb276a2..07b67bb0 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java @@ -486,7 +486,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void } public String toString() { - return data.toString(); + return Arrays.toString(data); } public void write(Writer writer) throws IOException { |