From cddbe7d41f52c28606a0c125f6916b2e96d93232 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Tue, 26 Jul 2016 11:37:31 -0400 Subject: [PATCH] NIFI-2388 This closes #728. Use null for group id if no group specified instead of throwing NPE --- .../apache/nifi/processor/StandardValidationContext.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardValidationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardValidationContext.java index 3fb8a21f6d..7282ee926d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardValidationContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardValidationContext.java @@ -35,6 +35,7 @@ import org.apache.nifi.controller.ControllerServiceLookup; import org.apache.nifi.controller.service.ControllerServiceNode; import org.apache.nifi.controller.service.ControllerServiceProvider; import org.apache.nifi.expression.ExpressionLanguageCompiler; +import org.apache.nifi.groups.ProcessGroup; public class StandardValidationContext implements ValidationContext { @@ -97,8 +98,9 @@ public class StandardValidationContext implements ValidationContext { @Override public ValidationContext getControllerServiceValidationContext(final ControllerService controllerService) { final ControllerServiceNode serviceNode = controllerServiceProvider.getControllerServiceNode(controllerService.getIdentifier()); - return new StandardValidationContext(controllerServiceProvider, serviceNode.getProperties(), serviceNode.getAnnotationData(), - serviceNode.getProcessGroup().getIdentifier(), serviceNode.getIdentifier()); + final ProcessGroup serviceGroup = serviceNode.getProcessGroup(); + final String serviceGroupId = serviceGroup == null ? null : serviceGroup.getIdentifier(); + return new StandardValidationContext(controllerServiceProvider, serviceNode.getProperties(), serviceNode.getAnnotationData(), serviceGroupId, serviceNode.getIdentifier()); } @Override