Repository: struts Updated Branches: refs/heads/support-2-3 b448d7995 -> bd1a121b8
Ports blocking eval expressions from commit 61a7ee296161bbfa61e90871649598a2e4a680a2 Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/bd1a121b Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/bd1a121b Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/bd1a121b Branch: refs/heads/support-2-3 Commit: bd1a121b8286c412f5fc84c61599c293483fc11a Parents: 6177cf3 Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Sun Jan 10 12:17:02 2016 +0100 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Sun Jan 10 12:17:34 2016 +0100 ---------------------------------------------------------------------- .../java/com/opensymphony/xwork2/ognl/OgnlUtil.java | 8 ++------ .../com/opensymphony/xwork2/ognl/OgnlValueStack.java | 12 ++++-------- 2 files changed, 6 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/bd1a121b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java ---------------------------------------------------------------------- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java index 63c45fe..6736076 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java @@ -274,14 +274,10 @@ public class OgnlUtil { * Wrapper around Ognl.setValue() to handle type conversion for collection elements. * Ideally, this should be handled by OGNL directly. */ - public void setValue(String name, Map<String, Object> context, Object root, Object value) throws OgnlException { - setValue(name, context, root, value, true); - } - - protected void setValue(String name, final Map<String, Object> context, final Object root, final Object value, final boolean evalName) throws OgnlException { + public void setValue(final String name, final Map<String, Object> context, final Object root, final Object value) throws OgnlException { compileAndExecute(name, context, new OgnlTask<Void>() { public Void execute(Object tree) throws OgnlException { - if (!evalName && isEvalExpression(tree, context)) { + if (isEvalExpression(tree, context)) { throw new OgnlException("Eval expression cannot be used as parameter name"); } Ognl.setValue(tree, context, root, value); http://git-wip-us.apache.org/repos/asf/struts/blob/bd1a121b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java ---------------------------------------------------------------------- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java index 1b09ef6..f221e67 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java @@ -148,7 +148,7 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS * @see com.opensymphony.xwork2.util.ValueStack#setParameter(String, Object) */ public void setParameter(String expr, Object value) { - setValue(expr, value, devMode, false); + setValue(expr, value, devMode); } /** @@ -164,13 +164,9 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS * @see com.opensymphony.xwork2.util.ValueStack#setValue(java.lang.String, java.lang.Object, boolean) */ public void setValue(String expr, Object value, boolean throwExceptionOnFailure) { - setValue(expr, value, throwExceptionOnFailure, true); - } - - private void setValue(String expr, Object value, boolean throwExceptionOnFailure, boolean evalExpression) { Map<String, Object> context = getContext(); try { - trySetValue(expr, value, throwExceptionOnFailure, context, evalExpression); + trySetValue(expr, value, throwExceptionOnFailure, context); } catch (OgnlException e) { handleOgnlException(expr, value, throwExceptionOnFailure, e); } catch (RuntimeException re) { //XW-281 @@ -180,10 +176,10 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS } } - private void trySetValue(String expr, Object value, boolean throwExceptionOnFailure, Map<String, Object> context, boolean evalExpression) throws OgnlException { + private void trySetValue(String expr, Object value, boolean throwExceptionOnFailure, Map<String, Object> context) throws OgnlException { context.put(XWorkConverter.CONVERSION_PROPERTY_FULLNAME, expr); context.put(REPORT_ERRORS_ON_NO_PROP, (throwExceptionOnFailure) ? Boolean.TRUE : Boolean.FALSE); - ognlUtil.setValue(expr, context, root, value, evalExpression); + ognlUtil.setValue(expr, context, root, value); } private void cleanUpContext(Map<String, Object> context) {