struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: WW-4482 Fallbacks to non-collection evaluation for non-collection param
Date Thu, 02 Apr 2015 08:17:40 GMT
Repository: struts
Updated Branches:
  refs/heads/develop 6021995bf -> 4a08f070f


WW-4482 Fallbacks to non-collection evaluation for non-collection param


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/4a08f070
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/4a08f070
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/4a08f070

Branch: refs/heads/develop
Commit: 4a08f070f101dbe8a74b7ed53794d645274ee9da
Parents: 6021995
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Thu Apr 2 10:17:23 2015 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Thu Apr 2 10:17:23 2015 +0200

----------------------------------------------------------------------
 .../opensymphony/xwork2/util/TextParseUtil.java   | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/4a08f070/xwork-core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java b/xwork-core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
index a3938ef..211d08c 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
@@ -212,13 +212,14 @@ public class TextParseUtil {
 
         Object result = parser.evaluate(openChars, expression, ognlEval, maxLoopCount);
 
-        XWorkConverter conv = ((Container)context.get(ActionContext.CONTAINER)).getInstance(XWorkConverter.class);
-
         Collection<String> resultCol;
         if (result instanceof Collection) {
             @SuppressWarnings("unchecked")
             Collection<Object> casted = (Collection<Object>)result;
-            resultCol = new ArrayList<String>(casted.size());
+            resultCol = new ArrayList<String>();
+
+            XWorkConverter conv = ((Container)context.get(ActionContext.CONTAINER)).getInstance(XWorkConverter.class);
+
             for (Object element : casted) {
                 String stringElement = (String)conv.convertValue(context, element, String.class);
                 if (shallBeIncluded(stringElement, excludeEmptyElements)) {
@@ -229,13 +230,10 @@ public class TextParseUtil {
                 }
             }
         } else {
-            resultCol = new ArrayList<String>(1);
-            String stringResult = (String)conv.convertValue(context, result, String.class);
-            if (shallBeIncluded(stringResult, excludeEmptyElements)) {
-                if (evaluator != null) {
-                    stringResult = evaluator.evaluate(stringResult).toString();
-                }
-                resultCol.add(stringResult);
+            resultCol = new ArrayList<String>();
+            String resultStr = translateVariables(expression, stack, evaluator);
+            if (shallBeIncluded(resultStr, excludeEmptyElements)) {
+                resultCol.add(resultStr);
             }
         }
 


Mime
View raw message