From b126c6c5f625432722405538692184f5c74edaad Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 29 Mar 2018 21:40:16 -0500 Subject: Clean up Sonar results 3 Issue-ID: AAF-206 Change-Id: I4494990e8e0bd702b475bbbfb140eaadd566d2a0 Signed-off-by: Instrumental --- .../src/main/java/org/onap/aaf/auth/local/AbsData.java | 6 +++++- .../main/java/org/onap/aaf/auth/org/OrganizationFactory.java | 12 +++++++++--- .../main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'auth/auth-core') 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 { try { Thread.sleep(200); } catch (InterruptedException e) { - break; + Thread.currentThread().interrupt(); } begin = System.currentTimeMillis(); } @@ -188,6 +189,9 @@ public abstract class AbsData implements Iterable { @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 extends HttpCode