You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/11/18 16:59:19 UTC

[GitHub] [nifi] Chaffelson commented on a change in pull request #4656: NIFI-7995 add null check before validating ParameterContexts

Chaffelson commented on a change in pull request #4656:
URL: https://github.com/apache/nifi/pull/4656#discussion_r526250463



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java
##########
@@ -400,11 +400,14 @@ public Response submitParameterContextUpdate(
     }
 
     private void validateParameterNames(final ParameterContextDTO parameterContextDto) {
-        for (final ParameterEntity entity : parameterContextDto.getParameters()) {
-            final String parameterName = entity.getParameter().getName();
-            if (!isLegalParameterName(parameterName)) {
-                throw new IllegalArgumentException("Request contains an illegal Parameter Name (" + parameterName + "). Parameter names may only include letters, numbers, spaces, and the special " +
-                    "characters .-_");
+        if (parameterContextDto.getParameters() != null) {

Review comment:
       Parameters should not be required when creating a Parameter context. Currently you are expected to provide an empty list object, but it throws an NPE if parameters = null.
   Either we should throw a reasonable error if the Parameters field is anything other than expected (rather than an NPE), or accept a null as if it was the empty list.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org