[
https://issues.jboss.org/browse/WFCORE-1399?page=com.atlassian.jira.plugi...
]
Valentin Maechler edited comment on WFCORE-1399 at 2/22/16 2:57 AM:
--------------------------------------------------------------------
Good day!
I've tried to escape the {{'$'}} with a leading {{'$'}} ==> test
cases do not work as expected.
Let's say we have a default value {{'a$'}}.
And the system property is called {{'z'}}.
The expression is then {{'${z:a$$}'}} including the escaping {{'$'}}.
Expectation:
# if the system property {{'z'}} is set to {{'system-prop-value'}} the
resulting value shall be {{'system-prop-value'}} (/)
# if the system property {{'z'}} is *NOT* set the resulting value shall be
{{'a$'}} (x)
The 1st case works fine but the result of the 2nd case is {{'a$$'}}.
test cases added to ExpressionResolverUnitTestCase.java
{code}
@Test
public void testSpecialDefaultValueWithSystemPropertySet() throws OperationFailedException
{
System.setProperty("z", "system-prop-value");
try {
ModelNode node = new ModelNode();
node.get("expr").set(new ValueExpression("${z:a$$}"));
node = ExpressionResolver.TEST_RESOLVER.resolveExpressions(node);
assertEquals(1, node.keys().size());
assertEquals("system-prop-value",
node.get("expr").asString());
} finally {
System.clearProperty("z");
}
}
@Test
public void testSpecialDefaultValueWithoutSystemPropertySet() throws
OperationFailedException {
ModelNode node = new ModelNode();
node.get("expr").set(new ValueExpression("${z:a$$}"));
node = ExpressionResolver.TEST_RESOLVER.resolveExpressions(node);
assertEquals(1, node.keys().size());
System.out.println("testSpecialDefaultValueWithoutSystemPropertySet: " +
node.get("expr").asString());
assertEquals("a$", node.get("expr").asString());
}
{code}
was (Author: vmae):
Good day!
I've tried to escape the '$' with a leading '$' ==> test cases do
not work as expected.
Let's say we have a default value 'a$'.
And the system property is called 'z'.
The expression is then '${z:a$$}' including the escaping '$'.
Expectation:
# if the system property 'z' is set to 'system-prop-value' the resulting
value shall be 'system-prop-value' (/)
# if the system property 'z' is *NOT* set the resulting value shall be
'a$' (x)
The 1st case works fine but the result of the 2nd case is 'a$$'.
test cases added to ExpressionResolverUnitTestCase.java
{code}
@Test
public void testSpecialDefaultValueWithSystemPropertySet() throws OperationFailedException
{
System.setProperty("z", "system-prop-value");
try {
ModelNode node = new ModelNode();
node.get("expr").set(new ValueExpression("${z:a$$}"));
node = ExpressionResolver.TEST_RESOLVER.resolveExpressions(node);
assertEquals(1, node.keys().size());
assertEquals("system-prop-value",
node.get("expr").asString());
} finally {
System.clearProperty("z");
}
}
@Test
public void testSpecialDefaultValueWithoutSystemPropertySet() throws
OperationFailedException {
ModelNode node = new ModelNode();
node.get("expr").set(new ValueExpression("${z:a$$}"));
node = ExpressionResolver.TEST_RESOLVER.resolveExpressions(node);
assertEquals(1, node.keys().size());
System.out.println("testSpecialDefaultValueWithoutSystemPropertySet: " +
node.get("expr").asString());
assertEquals("a$", node.get("expr").asString());
}
{code}
Failure when resolving an expression with the default value
containing a '$' at the end
---------------------------------------------------------------------------------------
Key: WFCORE-1399
URL:
https://issues.jboss.org/browse/WFCORE-1399
Project: WildFly Core
Issue Type: Bug
Components: Domain Management
Affects Versions: 2.1.0.CR1
Reporter: Valentin Maechler
Assignee: ehsavoie Hugonnet
Attachments: ExpressionResolver.java, ExpressionResolverUnitTestCase.java
Can not add a JNDI / naming entry which contains a "$" sign at the end of its
default value.
e.g. {code}
value="${my.sample.property1:entry5-default-value-with-special-char-at-the-end-$}"
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)