summaryrefslogtreecommitdiffstats
path: root/auth/auth-core/src/main
diff options
context:
space:
mode:
authorInstrumental <jcgmisc@stl.gathman.org>2018-03-29 19:02:24 -0500
committerInstrumental <jcgmisc@stl.gathman.org>2018-03-29 19:02:44 -0500
commitd86dd644e1543743cfcbc83b230bd4f2cb2e5d4e (patch)
tree698e12f7c0142441cd494cd68da03437e510d0b0 /auth/auth-core/src/main
parent17ca744723bd652f15d59d6c8555824f6e49018d (diff)
Clean up Sonar results 1
Issue-ID: AAF-206 Change-Id: If1fced5b528490a52691508fb1e30962dbe28856 Signed-off-by: Instrumental <jcgmisc@stl.gathman.org>
Diffstat (limited to 'auth/auth-core/src/main')
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java13
3 files changed, 17 insertions, 10 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 40e0b22c..d9f7ac96 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
@@ -71,7 +71,7 @@ public abstract class AbsData implements Iterable<String> {
public void open(AuthzTrans trans, long timeout) throws IOException {
TimeTaken tt = trans.start("Open Data File", Env.SUB);
- boolean opened = false, first = true;
+ boolean first = true;
try {
if(!dataf.exists()) {
throw new FileNotFoundException("Data File Missing:" + dataf.getCanonicalPath());
@@ -102,14 +102,10 @@ public abstract class AbsData implements Iterable<String> {
throw e;
}
ti.open();
- opened = true;
} finally {
tt.done();
}
- if(!opened) {
- throw new IOException("DataFile pair for " + name + " was not able to be opened in " + timeout + "ms");
- }
}
private synchronized void ensureIdxGood(AuthzTrans trans) throws IOException {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
index 5169cf88..cbb3603e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
@@ -132,8 +132,12 @@ public class TextIndex {
TimeTaken tt2 = trans.start("Open Files", Env.SUB);
try {
raf = new RandomAccessFile(file,"rw");
- raf.setLength(0L);
- fos = raf.getChannel();
+ try {
+ raf.setLength(0L);
+ fos = raf.getChannel();
+ } finally {
+ raf.close();
+ }
} finally {
tt2.done();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
index 16c0d3ba..7078cf0f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
@@ -146,8 +146,12 @@ public class Validator {
}
public final Validator permType(String type, String ns) {
- if(nob(type,NAME_CHARS)) {
- msg("Perm Type [" + (ns==null?"":ns+(type.length()==0?"":'.'))+type + "] is invalid.");
+ if(type==null) {
+ msg("Perm Type is null");
+ } else if(ns==null) {
+ msg("Perm NS is null");
+ } else if(nob(type,NAME_CHARS)) {
+ msg("Perm Type [" + (ns+(type.length()==0?"":'.'))+type + "] is invalid.");
}
return this;
}
@@ -175,7 +179,10 @@ public class Validator {
}
public final Validator ns(String ns) {
- if(nob(ns,NAME_CHARS)){
+ if(ns==null) {
+ msg("NS is null");
+ return this;
+ } else if(nob(ns,NAME_CHARS)) {
msg("NS [" + ns + "] is invalid.");
}
for(String s : nsKeywords) {