Repository: nifi
Updated Branches:
  refs/heads/master c2ae7a6d7 -> 6475924f5


NIFI-2642 Catches (and ignores) ResourceNotFoundException during the updating 
of a property value for a controller service when the current value points to a 
controller service that has been deleted, allowing the assigning of a new 
controller service to continue.

This closes #931


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/6475924f
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/6475924f
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/6475924f

Branch: refs/heads/master
Commit: 6475924f53404939214c7519f5e411ffa1ed27c0
Parents: c2ae7a6
Author: Jeff Storck <jtsw...@gmail.com>
Authored: Wed Aug 24 15:06:01 2016 -0400
Committer: Oleg Zhurakousky <o...@suitcase.io>
Committed: Wed Aug 24 15:55:04 2016 -0400

----------------------------------------------------------------------
 .../authorization/AuthorizeControllerServiceReference.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/6475924f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/AuthorizeControllerServiceReference.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/AuthorizeControllerServiceReference.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/AuthorizeControllerServiceReference.java
index 8617135..48c782f 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/AuthorizeControllerServiceReference.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/AuthorizeControllerServiceReference.java
@@ -20,6 +20,7 @@ import org.apache.nifi.authorization.resource.Authorizable;
 import org.apache.nifi.authorization.user.NiFiUser;
 import org.apache.nifi.authorization.user.NiFiUserUtils;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.web.ResourceNotFoundException;
 
 import java.util.Map;
 import java.util.Objects;
@@ -57,8 +58,12 @@ public final class AuthorizeControllerServiceReference {
                     if (!Objects.equals(currentValue, proposedValue)) {
                         // ensure access to the old service
                         if (currentValue != null) {
-                            final Authorizable currentServiceAuthorizable = 
lookup.getControllerService(currentValue).getAuthorizable();
-                            currentServiceAuthorizable.authorize(authorizer, 
RequestAction.READ, user);
+                            try {
+                                final Authorizable currentServiceAuthorizable 
= lookup.getControllerService(currentValue).getAuthorizable();
+                                
currentServiceAuthorizable.authorize(authorizer, RequestAction.READ, user);
+                            } catch (ResourceNotFoundException e) {
+                                // ignore if the resource is not found, if 
currentValue was previously deleted, it should not stop assignment of 
proposedValue
+                            }
                         }
 
                         // ensure access to the new service

Reply via email to