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/ba86d129 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba86d129 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba86d129 Branch: refs/heads/branch-2.5 Commit: ba86d129c431119579e173c3e235cb8061361131 Parents: 0ab368d Author: Myroslav Papirkovskyi <[email protected]> Authored: Wed Mar 1 18:34:33 2017 +0200 Committer: Myroslav Papirkovskyi <[email protected]> Committed: Wed Mar 1 18:44:13 2017 +0200 ---------------------------------------------------------------------- .../controller/AmbariManagementControllerImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ba86d129/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 129e669..1730995 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 @@ -5366,7 +5366,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; @@ -5383,11 +5383,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")); + } } }
