Author: jaz
Date: Tue Apr 17 11:08:25 2007
New Revision: 529696
URL:
http://svn.apache.org/viewvc?view=rev&rev=529696Log:
added Array to List conversion
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java?view=diff&rev=529696&r1=529695&r2=529696==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java Tue Apr 17 11:08:25 2007
@@ -20,17 +20,13 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import javolution.util.FastList;
import javolution.util.FastMap;
@@ -445,6 +441,16 @@
public static Object simpleTypeConvert(Object obj, String type, String format, Locale locale, boolean noTypeFail) throws GeneralException {
if (obj == null) {
return null;
+ }
+
+ // do simple array to list conversion first (so that other checks can run against the updated object)
+ if (obj.getClass().isArray()) {
+ List newObj = FastList.newInstance();
+ int len = Array.getLength(obj);
+ for (int i = 0; i < len; i++) {
+ newObj.add(Array.get(obj, i));
+ }
+ obj = newObj;
}
if (obj.getClass().getName().equals(type)) {
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java?view=diff&rev=529696&r1=529695&r2=529696==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java Tue Apr 17 11:08:25 2007
@@ -266,6 +266,9 @@
}
}
}
+
+ // do map value conversions
+ context = model.makeValid(context, ModelService.IN_PARAM);
}
return context;