You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2008/08/11 11:04:43 UTC

svn commit: r684681 - in /webservices/axis2/trunk/java/modules/adb: src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java

Author: amilas
Date: Mon Aug 11 02:04:41 2008
New Revision: 684681

URL: http://svn.apache.org/viewvc?rev=684681&view=rev
Log:
fixed test cases and a but with the ADBxml stream reader

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java
    webservices/axis2/trunk/java/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java?rev=684681&r1=684680&r2=684681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java Mon Aug 11 02:04:41 2008
@@ -945,17 +945,23 @@
             childReader.init();
         } else if (propertyValue.getClass().isArray()) {
             // this is an arrary object and we need to get the pull parser for that
-            List objects = new ArrayList();
             Object[] objectArray = (Object[]) propertyValue;
-            for (int i = 0; i < objectArray.length; i++) {
-                objects.add(propertyQName);
-                objects.add(objectArray[i]);
-            }
-
-            ADBXMLStreamReader reader = new ADBXMLStreamReaderImpl(propertyQName,
-                    objects.toArray(), new ArrayList().toArray(), typeTable, qualified);
-            childReader = new WrappingXMLStreamReader(reader);
+            if (objectArray.length == 0) {
+                //advance the index
+                currentPropertyIndex = currentPropertyIndex + 2;
+                return processProperties();
+            } else {
+                List objects = new ArrayList();
 
+                for (int i = 0; i < objectArray.length; i++) {
+                    objects.add(propertyQName);
+                    objects.add(objectArray[i]);
+                }
+
+                ADBXMLStreamReader reader = new ADBXMLStreamReaderImpl(propertyQName,
+                        objects.toArray(), new ArrayList().toArray(), typeTable, qualified);
+                childReader = new WrappingXMLStreamReader(reader);
+            }
         } else if (propertyValue instanceof ADBBean) {
             //ADBbean has it's own method to get a reader
             XMLStreamReader reader = ((ADBBean)propertyValue).

Modified: webservices/axis2/trunk/java/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java?rev=684681&r1=684680&r2=684681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java Mon Aug 11 02:04:41 2008
@@ -214,7 +214,7 @@
             DummyADBBean dummyBean = new DummyADBBean();
             propertyList.add(dummyBean);
 
-            String[] array = new String[] { };
+            String[] array = new String[] {};
             propertyList.add(new QName("AdditionalDependent"));
             propertyList.add(array);
 
@@ -424,10 +424,10 @@
         try {
             String expectedXML =
                     "<ns1:TestComplexStringArrayScenario xmlns:ns1=\"http://testComplexStringArrayScenario.org\">" +
-                            "<StringInfo>Some Text 0</StringInfo>" +
+                            "<StringInfo><StringInfo>Some Text 0</StringInfo>" +
                             "<StringInfo>Some Text 1</StringInfo>" +
                             "<StringInfo>Some Text 2</StringInfo>" +
-                            "<StringInfo>Some Text 3</StringInfo>" +
+                            "<StringInfo>Some Text 3</StringInfo></StringInfo>" +
                             "</ns1:TestComplexStringArrayScenario>";
 
             ArrayList propertyList = new ArrayList();
@@ -465,10 +465,10 @@
         try {
             String expectedXML =
                     "<ns1:TestComplexStringArrayScenario xmlns:ns1=\"http://testComplexStringArrayScenario.org\">" +
-                            "<StringInfo>Some Text 0</StringInfo>" +
+                            "<StringInfo><StringInfo>Some Text 0</StringInfo>" +
                             "<StringInfo xsi:nil=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>" +
                             "<StringInfo>Some Text 2</StringInfo>" +
-                            "<StringInfo>Some Text 3</StringInfo>" +
+                            "<StringInfo>Some Text 3</StringInfo></StringInfo>" +
                             "</ns1:TestComplexStringArrayScenario>";
 
             ArrayList propertyList = new ArrayList();
@@ -515,10 +515,10 @@
                             "<Age>25</Age>" +
                             "<Sex>Male</Sex>" +
                             "</Dependent>" +
-                            "<StringInfo>Some Text 0</StringInfo>" +
+                            "<StringInfo><StringInfo>Some Text 0</StringInfo>" +
                             "<StringInfo>Some Text 1</StringInfo>" +
                             "<StringInfo>Some Text 2</StringInfo>" +
-                            "<StringInfo>Some Text 3</StringInfo>" +
+                            "<StringInfo>Some Text 3</StringInfo></StringInfo>" +
                             "<Bar>Some More Text</Bar>" +
                             "</ns1:TestComplexStringArrayScenario>";
 
@@ -567,11 +567,11 @@
             String expectedXML = "<ns1:TestComplexStringArrayScenario " +
                     "xmlns:ns1=\"http://testComplexStringArrayScenario.org\" " +
                     ">" +
-                    "<StringInfo>Some Text 0</StringInfo>" +
+                    "<StringInfo><StringInfo>Some Text 0</StringInfo>" +
                     "<StringInfo xsi:nil=\"true\" " +
                     "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"></StringInfo>" +
                     "<StringInfo>Some Text 2</StringInfo>" +
-                    "<StringInfo>Some Text 3</StringInfo>" +
+                    "<StringInfo>Some Text 3</StringInfo></StringInfo>" +
                     "</ns1:TestComplexStringArrayScenario>";
 
             ArrayList propertyList = new ArrayList();