mirror of
https://github.com/apache/struts.git
synced 2026-08-31 19:35:40 +00:00
WW-4427 - Converters are no longer applied to values coming from the context - fix and UT
This commit is contained in:
@@ -351,6 +351,8 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS
|
||||
value = getValue(expr, asType);
|
||||
if (value == null) {
|
||||
value = findInContext(expr);
|
||||
final XWorkConverter conv = ((Container)getContext().get(ActionContext.CONTAINER)).getInstance(XWorkConverter.class);
|
||||
return conv.convertValue(getContext(), value, asType);
|
||||
}
|
||||
} finally {
|
||||
context.remove(THROW_EXCEPTION_ON_FAILURE);
|
||||
|
||||
@@ -93,6 +93,17 @@ public class OgnlValueStackTest extends XWorkTestCase {
|
||||
assertEquals("1, 2", vs.findValue("childAges", String.class));
|
||||
}
|
||||
|
||||
public void testValuesFromContextAreConverted() {
|
||||
final OgnlValueStack vs = createValueStack();
|
||||
vs.getContext().put(ActionContext.CONTAINER, container);
|
||||
|
||||
final String propertyName = "dogName";
|
||||
final String propertyValue = "Rover";
|
||||
vs.getContext().put(propertyName, new String[]{propertyValue});
|
||||
|
||||
assertEquals(propertyValue, vs.findValue(propertyName, String.class));
|
||||
}
|
||||
|
||||
public void testFailOnException() {
|
||||
OgnlValueStack vs = createValueStack();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user