mirror of https://github.com/apache/nifi.git
NIFI-4348 handled NPE in isExpressionLanguagePresent.
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #3857.
This commit is contained in:
parent
ce5eae5b2c
commit
3d56e2f26d
|
@ -207,6 +207,9 @@ public class StandardPropertyValue implements PropertyValue {
|
|||
|
||||
@Override
|
||||
public boolean isExpressionLanguagePresent() {
|
||||
if (preparedQuery == null) {
|
||||
return false;
|
||||
}
|
||||
return preparedQuery.isExpressionLanguagePresent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue