axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r358968 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
Date Sun, 25 Dec 2005 06:07:09 GMT
Author: dims
Date: Sat Dec 24 22:07:05 2005
New Revision: 358968

URL: http://svn.apache.org/viewcvs?rev=358968&view=rev
Log:
Don't check equals for *EVERY* array element.


Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java?rev=358968&r1=358967&r2=358968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
Sat Dec 24 22:07:05 2005
@@ -42,6 +42,7 @@
 import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.TimeZone;
+import java.util.Arrays;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -601,24 +602,36 @@
     public static Object convertToArray(Class baseArrayClass, List objectList) {
         int listSize = objectList.size();
         Object returnArray = Array.newInstance(baseArrayClass, listSize);
-        for (int i = 0; i < listSize; i++) {
-            if (int.class.equals(baseArrayClass)) {
+        if (int.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setInt(returnArray, i, Integer.parseInt(objectList.get(i).toString()));
-            } else if (float.class.equals(baseArrayClass)) {
+            }
+        } else if (float.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setFloat(returnArray, i, Float.parseFloat(objectList.get(i).toString()));
-            } else if (short.class.equals(baseArrayClass)) {
+            }
+        } else if (short.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setShort(returnArray, i, Short.parseShort(objectList.get(i).toString()));
-            } else if (long.class.equals(baseArrayClass)) {
+            }
+        } else if (long.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setLong(returnArray, i, Long.parseLong(objectList.get(i).toString()));
-            } else if (boolean.class.equals(baseArrayClass)) {
+            }
+        } else if (boolean.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setBoolean(returnArray, i, Boolean.getBoolean(objectList.get(i).toString()));
-            } else if (char.class.equals(baseArrayClass)) {
+            }
+        } else if (char.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setChar(returnArray, i, objectList.get(i).toString().toCharArray()[0]);
-            } else if (double.class.equals(baseArrayClass)) {
+            }
+        } else if (double.class.equals(baseArrayClass)) {
+            for (int i = 0; i < listSize; i++) {
                 Array.setDouble(returnArray, i, Double.parseDouble(objectList.get(i).toString()));
-            } else {
-                Array.set(returnArray, i, objectList.get(i));
             }
+        } else {
+            objectList.toArray((Object[])returnArray);
         }
         return returnArray;
     }



Mime
View raw message