NIFI-4348 handled NPE in isExpressionLanguagePresent.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #3857.
This commit is contained in:
mtien 2019-10-29 15:29:13 -07:00 committed by Pierre Villard
parent ce5eae5b2c
commit 3d56e2f26d
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
2 changed files with 16 additions and 0 deletions

View File

@ -207,6 +207,9 @@ public class StandardPropertyValue implements PropertyValue {
@Override
public boolean isExpressionLanguagePresent() {
if (preparedQuery == null) {
return false;
}
return preparedQuery.isExpressionLanguagePresent();
}
}

View File

@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Set;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
public class TestStandardPropertyValue {
@ -123,6 +124,18 @@ public class TestStandardPropertyValue {
assertEquals(year, val);
}
@Test
public void testisExpressionLanguagePresentShouldHandleNPE() {
// Arrange
final PropertyValue value = new StandardPropertyValue(null, lookup, ParameterLookup.EMPTY, null, null);
// Act
boolean elPresent = value.isExpressionLanguagePresent();
// Assert
assertFalse(elPresent);
}
private FlowFile createFlowFile(final Map<String, String> attributes) {
return new StandardFlowFileRecord.Builder().addAttributes(attributes).build();
}