diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterValueMapper.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterValueMapper.java index c47b699cfe..3b3fffdd88 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterValueMapper.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterValueMapper.java @@ -48,7 +48,9 @@ public class StandardParameterValueMapper implements ParameterValueMapper { final ParameterDescriptor descriptor = parameter.getDescriptor(); final String mapped; - if (parameter.isProvided()) { + if (value == null) { + mapped = null; + } else if (parameter.isProvided()) { mapped = PROVIDED_MAPPING; } else if (descriptor.isSensitive()) { if (sensitiveValueEncryptor == null) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterValueMapper.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterValueMapper.java index 5181e0a8bd..6667ced1c2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterValueMapper.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterValueMapper.java @@ -25,6 +25,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; @ExtendWith(MockitoExtension.class) class TestStandardParameterValueMapper { @@ -79,6 +80,15 @@ class TestStandardParameterValueMapper { assertNotEquals(StandardParameterValueMapper.PROVIDED_MAPPING, mapped); } + @Test + void testGetMappedSensitiveNotProvidedNullValue() { + final Parameter parameter = getParameter(true, false); + + final String mapped = mapper.getMapped(parameter, null); + + assertNull(mapped); + } + private Parameter getParameter(final boolean sensitive, final boolean provided) { final ParameterDescriptor descriptor = new ParameterDescriptor.Builder().name(NAME).sensitive(sensitive).build(); return new Parameter(descriptor, VALUE, null, provided);