This is an automated email from the ASF dual-hosted git repository.
markap14 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new a1593cd2ab NIFI-14256 - Cannot update parameter that references no
longer existing controller service (#9711)
a1593cd2ab is described below
commit a1593cd2ab782ce03bd634e891f9cc71ca03ea26
Author: Pierre Villard <[email protected]>
AuthorDate: Tue Feb 11 21:43:12 2025 +0100
NIFI-14256 - Cannot update parameter that references no longer existing
controller service (#9711)
---
.../apache/nifi/web/api/ParameterContextResource.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java
index 606fa9109a..072c9949a1 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java
@@ -757,11 +757,17 @@ public class ParameterContextResource extends
AbstractParameterResource {
if (parameterOptional.isPresent()) {
final String currentParameterValue =
parameterOptional.get().getValue();
if (currentParameterValue != null) {
- final ComponentAuthorizable currentControllerService =
lookup.getControllerService(currentParameterValue);
- if (currentControllerService != null) {
- final Authorizable
currentControllerServiceAuthorizable =
currentControllerService.getAuthorizable();
-
currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.READ,
user);
-
currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.WRITE,
user);
+ try {
+ final ComponentAuthorizable
currentControllerService = lookup.getControllerService(currentParameterValue);
+ if (currentControllerService != null) {
+ final Authorizable
currentControllerServiceAuthorizable =
currentControllerService.getAuthorizable();
+
currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.READ,
user);
+
currentControllerServiceAuthorizable.authorize(authorizer, RequestAction.WRITE,
user);
+ }
+ } catch (ResourceNotFoundException e) {
+ // the currently referenced controller service no
longer exists, we can just
+ // skip the authorization check, and move on to
setting the new parameter value
+ logger.debug("Current Controller Service with ID
{} not found, skipping authorization check", currentParameterValue);
}
}
}