summaryrefslogtreecommitdiffstats
path: root/auth
diff options
context:
space:
mode:
authorInstrumental <jcgmisc@stl.gathman.org>2018-03-29 20:26:02 -0500
committerInstrumental <jcgmisc@stl.gathman.org>2018-03-29 20:26:11 -0500
commit36b62be84b398044e1feae657c662dba6247782f (patch)
treed537940a473259de2f2d97579607d7cbfa9906d1 /auth
parentd86dd644e1543743cfcbc83b230bd4f2cb2e5d4e (diff)
Clean up Sonar results 2
Issue-ID: AAF-206 Change-Id: Ia000b144be58af970f4a5264ca5a9718fdbf9f5d Signed-off-by: Instrumental <jcgmisc@stl.gathman.org>
Diffstat (limited to 'auth')
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java5
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java3
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java32
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java6
5 files changed, 36 insertions, 16 deletions
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
index 7a85ae1a..76e3b424 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
@@ -185,8 +185,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
data.cred=null;
if(i>=0) {
byte[] bytes = new byte[i]; // a bit dangerous, but lessened because of all the previous sized data reads
- is.read(bytes);
- data.cred = ByteBuffer.wrap(bytes);
+ int read = is.read(bytes);
+ if(read>0) {
+ data.cred = ByteBuffer.wrap(bytes);
+ }
}
}
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
index 1961b1f5..72aa0ccd 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
@@ -247,7 +247,10 @@ public class AAFcli {
} else if ("pause".equalsIgnoreCase(largs[idx])) {
pw.println("Press <Return> to continue...");
++idx;
- new BufferedReader(new InputStreamReader(System.in)).readLine();
+ // Sonar insists we do something with the string, though it's only a pause. Not very helpful...
+ String sonar = new BufferedReader(new InputStreamReader(System.in)).readLine();
+ sonar=""; // this useless code brought to you by Sonar.
+ pw.print(sonar);
continue;
} else if ("exit".equalsIgnoreCase(largs[idx])) {
pw.println("Exiting...");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
index 99d55839..3234fe9c 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
@@ -90,6 +90,9 @@ public class CreateDelete extends Cmd {
}
boolean rolesSupplied = (args.length>idx);
+ if(fp == null) {// This useless code brought to you by Sonar.
+ throw new CadiException("No call made.");
+ }
if(fp.get(AAFcli.timeout())) {
rv=fp.code();
pw().print(verb);
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
index 63e83901..e0848926 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
@@ -108,7 +108,11 @@ public class DefaultOrg implements Organization {
if(fIdentities!=null && fIdentities.exists()) {
identities = new Identities(fIdentities);
} else {
- throw new OrganizationException(fIdentities.getCanonicalPath() + " does not exist.");
+ if(fIdentities==null) {
+ throw new OrganizationException("No Identities");
+ } else {
+ throw new OrganizationException(fIdentities.getCanonicalPath() + " does not exist.");
+ }
}
} catch (IOException e) {
throw new OrganizationException(e);
@@ -391,20 +395,22 @@ public class DefaultOrg implements Organization {
}
List<String> cc = new ArrayList<String>();
- if(ccList!=null && !ccList.isEmpty()) {
- for(String em : ccList) {
- if(em.indexOf('@')<0) {
- cc.add(new DefaultOrgIdentity(trans, em, this).email());
- } else {
- cc.add(em);
+ if(ccList!=null) {
+ if(!ccList.isEmpty()) {
+
+ for(String em : ccList) {
+ if(em.indexOf('@')<0) {
+ cc.add(new DefaultOrgIdentity(trans, em, this).email());
+ } else {
+ cc.add(em);
+ }
}
}
- }
-
-
- // for now, I want all emails so we can see what goes out. Remove later
- if (!ccList.contains(mailFrom)) {
- ccList.add(mailFrom);
+
+ // for now, I want all emails so we can see what goes out. Remove later
+ if (!ccList.contains(mailFrom)) {
+ ccList.add(mailFrom);
+ }
}
try {
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
index 6d9003fd..f2fe686f 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
@@ -87,6 +87,12 @@ public class DefaultOrgIdentity implements Identity {
return false;
}
+
+ @Override
+ public int hashCode() {
+ return identity.hashCode();
+ }
+
@Override
public String id() {
return identity.id;