AMBARI-20258. [INTERMITTENT] Null pointer Exception when modifying configs of 
services. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/340d3670
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/340d3670
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/340d3670

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 340d36706f76fe73d02f1cd984a46b8cc955c2be
Parents: 09b97ae
Author: Myroslav Papirkovskyi <mpapyrkovs...@hortonworks.com>
Authored: Wed Mar 1 18:34:33 2017 +0200
Committer: Myroslav Papirkovskyi <mpapyrkovs...@hortonworks.com>
Committed: Wed Mar 1 18:34:33 2017 +0200

----------------------------------------------------------------------
 .../controller/AmbariManagementControllerImpl.java       | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/340d3670/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index f921fc4..751ce08 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -5369,7 +5369,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
           ? AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, 
cluster.getResourceId(), RoleAuthorization.SERVICE_MODIFY_CONFIGS)
           : AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, 
cluster.getResourceId(), RoleAuthorization.CLUSTER_MODIFY_CONFIGS);
 
-      if (!isAuthorized) {
+      if (!isAuthorized && changesToIgnore != null) {
         Set<String> relevantChangesToIgnore = changesToIgnore.get(configType);
         Map<String, String[]> relevantPropertyChanges;
 
@@ -5386,11 +5386,14 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 
         // If relevant configuration changes have been made, then the user is 
not authorized to
         // perform the requested operation and an AuthorizationException must 
be thrown
-        if (relevantPropertyChanges.size() > 0) {
-          throw new AuthorizationException(String.format("The authenticated 
user does not have authorization to modify %s configurations",
-              (isServiceConfiguration) ? "service" : "cluster"));
+        if (relevantPropertyChanges.size() == 0) {
+          return;
         }
       }
+      if (!isAuthorized) {
+        throw new AuthorizationException(String.format("The authenticated user 
does not have authorization to modify %s configurations",
+          (isServiceConfiguration) ? "service" : "cluster"));
+      }
     }
   }
 

Reply via email to