Author: doogie
Date: Mon May 13 22:31:12 2013
New Revision: 1482131

URL: http://svn.apache.org/r1482131
Log:
FIX: in urlEncodeArgs, don't call obj.toString if the obj is an Array or
a Collection; instead, iterate over each memeber and encode that.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=1482131&r1=1482130&r2=1482131&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java Mon May 13 
22:31:12 2013
@@ -759,11 +759,29 @@ public class UtilHttp {
                 String name = entry.getKey();
                 Object value = entry.getValue();
                 String valueStr = null;
-                if (name != null && value != null) {
-                    if (value instanceof String) {
-                        valueStr = (String) value;
+                if (name == null || value == null) {
+                    continue;
+                }
+
+                Collection<?> col;
+                if (value instanceof String) {
+                    col = Arrays.asList(value);
+                } else if (value instanceof Collection) {
+                    col = UtilGenerics.cast(value);
+                } else if (value == null) {
+                    continue;
+                } else if (value.getClass().isArray()) {
+                    col = Arrays.asList((Object[]) value);
+                } else {
+                    col = Arrays.asList(value);
+                }
+                for (Object colValue: col) {
+                    if (colValue instanceof String) {
+                        valueStr = (String) colValue;
+                    } else if (colValue == null) {
+                        continue;
                     } else {
-                        valueStr = value.toString();
+                        valueStr = colValue.toString();
                     }
 
                     if (UtilValidate.isNotEmpty(valueStr)) {


Reply via email to