mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-5379 Fix not looking in chained contexts' chained contexts
This commit is contained in:
+3
-3
@@ -77,10 +77,10 @@ public class StrutsVelocityContext extends VelocityContext {
|
||||
}
|
||||
|
||||
protected List<Function<String, Object>> contextGetterList() {
|
||||
return Arrays.asList(this::superGet, this::chainedContextGet, this::stackGet);
|
||||
return Arrays.asList(this::superInternalGet, this::chainedContextGet, this::stackGet);
|
||||
}
|
||||
|
||||
protected Object superGet(String key) {
|
||||
protected Object superInternalGet(String key) {
|
||||
return super.internalGet(key);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class StrutsVelocityContext extends VelocityContext {
|
||||
return null;
|
||||
}
|
||||
for (VelocityContext chainedContext : chainedContexts) {
|
||||
Object val = chainedContext.internalGet(key);
|
||||
Object val = chainedContext.get(key);
|
||||
if (val != null) {
|
||||
return val;
|
||||
}
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ public class StrutsVelocityContextTest {
|
||||
|
||||
@Test
|
||||
public void getChainedValue() {
|
||||
when(chainedContext.internalGet("foo")).thenReturn("bar");
|
||||
when(chainedContext.get("foo")).thenReturn("bar");
|
||||
assertEquals("bar", strutsVelocityContext.internalGet("foo"));
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class StrutsVelocityContextTest {
|
||||
when(stack.findValue("foo")).thenReturn("qux");
|
||||
assertEquals("qux", strutsVelocityContext.internalGet("foo"));
|
||||
|
||||
when(chainedContext.internalGet("foo")).thenReturn("baz");
|
||||
when(chainedContext.get("foo")).thenReturn("baz");
|
||||
assertEquals("baz", strutsVelocityContext.internalGet("foo"));
|
||||
|
||||
strutsVelocityContext.put("foo", "bar");
|
||||
|
||||
Reference in New Issue
Block a user