summaryrefslogtreecommitdiffstats
path: root/auth/auth-core
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-core')
-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) {