Merge "Fixed deref of null object at error message"
authorJonathan Gathman <jonathan.gathman@att.com>
Wed, 3 Jul 2019 14:08:19 +0000 (14:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 3 Jul 2019 14:08:19 +0000 (14:08 +0000)
1  2 
auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java

@@@ -628,7 -628,12 +628,12 @@@ public class Function 
                  return Result.err(Status.ERR_DependencyExists, sb.toString());
              }
  
-             if (move && (parent == null || parent.type == NsType.COMPANY.type)) {
+             if (move && parent == null) {
+                 return Result
+                         .err(Status.ERR_DependencyExists,
+                                 "Cannot move users, roles or permissions - parent is missing.\nDelete dependencies and try again");
+             }
+             else if (move && parent.type == NsType.COMPANY.type) {
                  return Result
                          .err(Status.ERR_DependencyExists,
                                  "Cannot move users, roles or permissions to [%s].\nDelete dependencies and try again",
              } else if (!fullperm.roles.isEmpty()) {
                  return Result
                          .err(Status.ERR_DependencyExists,
 -                                "Permission [%s.%s|%s|%s] cannot be deleted as it is attached to 1 or more roles.",
 -                                fullperm.ns, fullperm.type, fullperm.instance, fullperm.action);
 +                                "Permission [%s] cannot be deleted as it is attached to 1 or more roles.",
 +                                fullperm.fullPerm());
              }
          }