Sonar fixes related to exceptions 51/59651/1
authorMaciej Wejs <maciej.wejs@nokia.com>
Mon, 16 Jul 2018 14:42:23 +0000 (16:42 +0200)
committerMaciej Wejs <maciej.wejs@nokia.com>
Wed, 8 Aug 2018 11:08:45 +0000 (13:08 +0200)
Fixes in aaf-cadi-aaf module
This one is related to ticket in main repo

Change-Id: I1eeaba545d9cc3b3c07ba53ec12500cdb5567742
Issue-ID: AAF-396
Signed-off-by: Maciej Wejs <maciej.wejs@nokia.com>
.gitignore [new file with mode: 0644]
shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFRealm.java
shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..29b636a
--- /dev/null
@@ -0,0 +1,2 @@
+.idea
+*.iml
\ No newline at end of file
index 006547a..ccdaf73 100644 (file)
@@ -89,7 +89,7 @@ public class AAFRealm extends AuthorizingRealm {
                String err;
                try {
                        err = authn.validate(upt.getUsername(),password);
-               } catch (IOException|CadiException e) {
+               } catch (IOException e) {
                        err = "Credential cannot be validated";
                        access.log(e, err);
                }
@@ -122,7 +122,7 @@ public class AAFRealm extends AuthorizingRealm {
        protected AAFAuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
                access.log(Level.DEBUG, "AAFRealm.doGetAuthenthorizationInfo");
                Principal bait = (Principal)principals.getPrimaryPrincipal();
-               List<Permission> pond = new ArrayList<Permission>();
+               List<Permission> pond = new ArrayList<>();
                authz.fishAll(bait,pond);
                
                return new AAFAuthorizationInfo(access,bait,pond);
index add449c..591a56c 100644 (file)
@@ -59,9 +59,9 @@ public class JU_AAFRealm {
        //      }
        // }
 
-       private void testAPerm(boolean expect,AuthorizationInfo azi, String type, String instance, String action) {
+       private void testAPerm(boolean expect, AuthorizationInfo azi, String name, String type, String instance, String action) {
                
-               AAFShiroPermission testPerm = new AAFShiroPermission(new AAFPermission(type,instance,action,new ArrayList<String>()));
+               AAFShiroPermission testPerm = new AAFShiroPermission(new AAFPermission(type,name,instance,action,new ArrayList<String>()));
 
                boolean any = false;
                for(Permission p : azi.getObjectPermissions()) {