mirror of https://github.com/apache/nifi.git
NIFI-7732: When encountering the end of an Expression Language Expression in the ELAwareParameterParser, ensure that we reset 'oddDollarCount' variable back to false
This commit is contained in:
parent
869c4236c4
commit
9e1e17d3f3
|
@ -69,7 +69,6 @@ public class ExpressionLanguageAwareParameterParser extends AbstractParameterPar
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (sequentialStartTags > 0) {
|
||||
final ParameterToken token = parseParameterToken(input, i, sequentialStartTags, tokens);
|
||||
|
||||
|
@ -87,6 +86,7 @@ public class ExpressionLanguageAwareParameterParser extends AbstractParameterPar
|
|||
|
||||
if (--embeddedElCount == 0) {
|
||||
expressionStart = -1;
|
||||
oddDollarCount = false;
|
||||
}
|
||||
break;
|
||||
case DOLLAR_SIGN:
|
||||
|
|
|
@ -187,4 +187,35 @@ public class TestExpressionLanguageAgnosticParameterParser {
|
|||
assertEquals("hello", ((ParameterReference) token).getParameterName());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleReferencesDifferentExpressions() {
|
||||
final ParameterParser parameterParser = new ExpressionLanguageAgnosticParameterParser();
|
||||
final List<ParameterToken> tokens = parameterParser.parseTokens("${#{hello}}${#{there}}").toList();
|
||||
assertEquals(2, tokens.size());
|
||||
|
||||
final ParameterToken firstToken = tokens.get(0);
|
||||
assertTrue(firstToken.isParameterReference());
|
||||
assertEquals("hello", ((ParameterReference) firstToken).getParameterName());
|
||||
|
||||
final ParameterToken secondToken = tokens.get(1);
|
||||
assertTrue(secondToken.isParameterReference());
|
||||
assertEquals("there", ((ParameterReference) secondToken).getParameterName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleReferencesSameExpression() {
|
||||
final ParameterParser parameterParser = new ExpressionLanguageAgnosticParameterParser();
|
||||
final List<ParameterToken> tokens = parameterParser.parseTokens("${#{hello}:append(#{there})}").toList();
|
||||
assertEquals(2, tokens.size());
|
||||
|
||||
final ParameterToken firstToken = tokens.get(0);
|
||||
assertTrue(firstToken.isParameterReference());
|
||||
assertEquals("hello", ((ParameterReference) firstToken).getParameterName());
|
||||
|
||||
final ParameterToken secondToken = tokens.get(1);
|
||||
assertTrue(secondToken.isParameterReference());
|
||||
assertEquals("there", ((ParameterReference) secondToken).getParameterName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -198,4 +198,19 @@ public class TestExpressionLanguageAwareParameterParser {
|
|||
assertEquals("hello", ((ParameterReference) token).getParameterName());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleReferencesDifferentExpressions() {
|
||||
final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
|
||||
final List<ParameterToken> tokens = parameterParser.parseTokens("${#{hello}}${#{there}}").toList();
|
||||
assertEquals(0, tokens.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleReferencesSameExpression() {
|
||||
final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
|
||||
final List<ParameterToken> tokens = parameterParser.parseTokens("${#{hello}:append(#{there})}").toList();
|
||||
assertEquals(0, tokens.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue