From d86dd644e1543743cfcbc83b230bd4f2cb2e5d4e Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 29 Mar 2018 19:02:24 -0500 Subject: Clean up Sonar results 1 Issue-ID: AAF-206 Change-Id: If1fced5b528490a52691508fb1e30962dbe28856 Signed-off-by: Instrumental --- .../src/main/java/org/onap/aaf/auth/cmd/AAFcli.java | 2 +- .../src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java | 16 +++++++++------- .../src/main/java/org/onap/aaf/auth/cmd/user/Cred.java | 3 +++ .../src/main/java/org/onap/aaf/auth/cmd/user/List.java | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) (limited to 'auth/auth-cmd/src/main') 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 e8069b8e..1961b1f5 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 @@ -324,7 +324,7 @@ public class AAFcli { try { ret = c.exec(++idx, largs); if (delay+globalDelay > 0) { - Thread.sleep(delay+globalDelay); + Thread.sleep((long)(delay+globalDelay)); } } catch (Exception e) { if (expect.contains(-1)) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java index cc0d2586..19caa4f4 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java @@ -83,15 +83,17 @@ public class Attrib extends BaseCmd { default: throw new CadiException("Bad Argument"); }; - - if(fp.get(AAFcli.timeout())) { - pw().println(message); + if(fp==null) { + return 500; } else { - error(fp); - return fp.code(); + if(fp.get(AAFcli.timeout())) { + pw().println(message); + } else { + error(fp); + } + + return fp.code(); } - - return fp==null?500:fp.code(); } }); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java index 4bb2ae30..10333091 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java @@ -109,6 +109,9 @@ public class Cred extends Cmd { // case 4: // return clean.exec(cleanIDX, args); } + if(fp==null) { + return null; // get by Sonar check. + } if(fp.get(AAFcli.timeout())) { pw().print(verb); pw().print(cr.getId()); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java index 5c87f906..a977431c 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java @@ -53,7 +53,7 @@ public class List extends BaseCmd { Collections.sort(sorted, new Comparator() { @Override public int compare(aaf.v2_0.Users.User u1, aaf.v2_0.Users.User u2) { - if(u2==null || u2 == null) { + if(u1==null || u2 == null) { return -1; } return u1.getId().compareTo(u2.getId()); -- cgit 1.2.3-korg