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/master
Commit: 4a08f070f101dbe8a74b7ed53794d645274ee9da
Parents: 6021995
Author: Lukasz Lenart <lukaszlen...@apache.org>
Authored: Thu Apr 2 10:17:23 2015 +0200
Committer: Lukasz Lenart <lukaszlen...@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);
             }
         }
 

Reply via email to