You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by nt...@apache.org on 2009/03/31 21:50:15 UTC

svn commit: r760576 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java

Author: nthaker
Date: Tue Mar 31 19:50:15 2009
New Revision: 760576

URL: http://svn.apache.org/viewvc?rev=760576&view=rev
Log:
AXIS2-4296

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java?rev=760576&r1=760575&r2=760576&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java Tue Mar 31 19:50:15 2009
@@ -477,11 +477,25 @@
                             else if ((ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY)) {
 
                                 // The type could be any Object or primitive
+                            	
+                            	//process primitives first
+                            	//first verify if we have a primitive type associated in the array.
+                            	//array could be single dimension or multi dimension.
+                            	Class cType = type.getComponentType();
+                            	while(cType.isArray()){
+                            		cType = cType.getComponentType();
+                            	}
+                            	if(cType.isPrimitive()){
+                            		jaxb = u.unmarshal(reader, type);
+                            	}
+                            	// process non primitive                       	
                                 // I will first unmarshall the xmldata to a String[]
                                 // Then use the unmarshalled jaxbElement to create
                                 // proper type Object Array.
-                                
-                                jaxb = unmarshalArray(reader, u, type);
+                            	
+                            	else{
+                            		jaxb = unmarshalArray(reader, u, type);
+                            	}
                                 
                             } else {
                                 
@@ -702,9 +716,12 @@
                     // String instead. Then we get the correct wire format:
                     // <foo>1 2 3</foo>
                     Object jbo = b;
-                    if (isList) {
+                    if(DEBUG_ENABLED){
+                    	log.debug("check if marshalling type list or array object type = "+ (( b!=null )? b.getClass().getName():"null"));
+                    }
+                    if (isList) {                   	
                         if (DEBUG_ENABLED) {
-                            log.debug("marshalling type which is a List or Array");
+                            log.debug("marshalling type which is a List");
                         }
                         
                         // This code assumes that the JAXBContext does not understand
@@ -732,7 +749,6 @@
                             jbo = new JAXBElement(qName, String.class, text); 
                         }
                     }
-
                     // When JAXBContext is created using a context path, it will not include Enum
                     // classes.
                     // These classes have @XmlEnum annotation but not @XmlType/@XmlElement, so the
@@ -814,5 +830,4 @@
             throw new OMException(t);
         }
     }
-
 }