Clean up Sonar results 3
[aaf/authz.git] / auth / auth-deforg / src / main / java / org / onap / aaf / org / DefaultOrg.java
index 63e8390..9fc983e 100644 (file)
@@ -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 {
@@ -602,7 +608,7 @@ public class DefaultOrg implements Organization {
                                                        Identity mechid = getIdentity(trans, vars[0]);
                                                        if(mechid!=null) {
                                                                Identity sponsor = mechid.responsibleTo();
-                                                               if(sponsor!=null && requestor.equals(sponsor.fullID())) {
+                                                               if(sponsor!=null && requestor.fullID().equals(sponsor.fullID())) {
                                                                        return null;
                                                                } else {
                                                                        return trans.user() + " is not the Sponsor of MechID " + vars[0];