mirror of https://github.com/apache/nifi.git
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
This commit is contained in:
parent
c2ae7a6d7c
commit
6475924f53
|
@ -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) {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue