Sonar Fix: List.java 67/74267/1
authorArundathi Patil <arundpil@in.ibm.com>
Wed, 5 Dec 2018 14:00:02 +0000 (19:30 +0530)
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>
Wed, 5 Dec 2018 14:00:25 +0000 (19:30 +0530)
Fixed sonar issues/code-smells across this file.

Issue-ID: AAF-665
Change-Id: I9bdadaf370ad0890a1617603e5eecaa507e72984
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java

index 5df2afa..d0481bc 100644 (file)
@@ -34,8 +34,20 @@ import org.onap.aaf.misc.env.APIException;
 import aaf.v2_0.Perms;
 
 public class List extends BaseCmd<Perm> {
-//    private static final String LIST_PERM_DETAILS = "list permission details";
-    
+    private static final String permFormat = "%-30s %-30s %-10s\n";
+    private static final Comparator<aaf.v2_0.Perm> permCompare = new Comparator<aaf.v2_0.Perm>() {
+        @Override
+        public int compare(aaf.v2_0.Perm a, aaf.v2_0.Perm b) {
+            int rc;
+            if ((rc=a.getType().compareTo(b.getType()))!=0) {
+                return rc;
+            }
+            if ((rc=a.getInstance().compareTo(b.getInstance()))!=0) {
+                return rc;
+            }
+            return a.getAction().compareTo(b.getAction());
+        }
+    };
     public List(Perm parent) {
         super(parent,"list");
 
@@ -47,7 +59,7 @@ public class List extends BaseCmd<Perm> {
     }
     // Package Level on purpose
     abstract class ListPerms extends Retryable<Integer> {
-        protected int list(Future<Perms> fp,String header, String parentPerm) throws CadiException, APIException  {
+        protected int list(Future<Perms> fp,String header, String parentPerm) throws CadiException  {
             if (fp.get(AAFcli.timeout())) {    
                 report(fp,header, parentPerm);
             } else {
@@ -56,22 +68,6 @@ public class List extends BaseCmd<Perm> {
             return fp.code();
         }
     }
-
-    private static final Comparator<aaf.v2_0.Perm> permCompare = new Comparator<aaf.v2_0.Perm>() {
-        @Override
-        public int compare(aaf.v2_0.Perm a, aaf.v2_0.Perm b) {
-            int rc;
-            if ((rc=a.getType().compareTo(b.getType()))!=0) {
-                return rc;
-            }
-            if ((rc=a.getInstance().compareTo(b.getInstance()))!=0) {
-                return rc;
-            }
-            return a.getAction().compareTo(b.getAction());
-        }
-    };
-    
-    private static final String permFormat = "%-30s %-30s %-10s\n";
     
     void report(Future<Perms> fp, String ... str) {
         reportHead(str);