NIFI-2388 This closes #728. Use null for group id if no group specified instead of throwing NPE

This commit is contained in:
Mark Payne 2016-07-26 11:37:31 -04:00 committed by joewitt
parent 3a153d3a48
commit cddbe7d41f
1 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import org.apache.nifi.controller.ControllerServiceLookup;
import org.apache.nifi.controller.service.ControllerServiceNode; import org.apache.nifi.controller.service.ControllerServiceNode;
import org.apache.nifi.controller.service.ControllerServiceProvider; import org.apache.nifi.controller.service.ControllerServiceProvider;
import org.apache.nifi.expression.ExpressionLanguageCompiler; import org.apache.nifi.expression.ExpressionLanguageCompiler;
import org.apache.nifi.groups.ProcessGroup;
public class StandardValidationContext implements ValidationContext { public class StandardValidationContext implements ValidationContext {
@ -97,8 +98,9 @@ public class StandardValidationContext implements ValidationContext {
@Override @Override
public ValidationContext getControllerServiceValidationContext(final ControllerService controllerService) { public ValidationContext getControllerServiceValidationContext(final ControllerService controllerService) {
final ControllerServiceNode serviceNode = controllerServiceProvider.getControllerServiceNode(controllerService.getIdentifier()); final ControllerServiceNode serviceNode = controllerServiceProvider.getControllerServiceNode(controllerService.getIdentifier());
return new StandardValidationContext(controllerServiceProvider, serviceNode.getProperties(), serviceNode.getAnnotationData(), final ProcessGroup serviceGroup = serviceNode.getProcessGroup();
serviceNode.getProcessGroup().getIdentifier(), serviceNode.getIdentifier()); final String serviceGroupId = serviceGroup == null ? null : serviceGroup.getIdentifier();
return new StandardValidationContext(controllerServiceProvider, serviceNode.getProperties(), serviceNode.getAnnotationData(), serviceGroupId, serviceNode.getIdentifier());
} }
@Override @Override