cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r965482 - in /cxf/branches/2.2.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
Date Mon, 19 Jul 2010 13:50:53 GMT
Author: dkulp
Date: Mon Jul 19 13:50:53 2010
New Revision: 965482

URL: http://svn.apache.org/viewvc?rev=965482&view=rev
Log:
Merged revisions 959990 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r959990 | ema | 2010-07-02 10:05:39 -0400 (Fri, 02 Jul 2010) | 1 line
  
  [CXF-2868]:Use JAXB Bridge to unmarshallwhen the field of partTypeClass is javax.xml.datatype.XMLGregorianCalendar
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=965482&r1=965481&r2=965482&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
Mon Jul 19 13:50:53 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.jaxb.io;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -28,6 +29,7 @@ import javax.xml.bind.JAXBException;
 import javax.xml.bind.PropertyException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.ValidationEventHandler;
+import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.Message;
@@ -108,23 +110,43 @@ public class DataReaderImpl<T> extends J
             honorJaxbAnnotation = (Boolean)part.getProperty("honor.jaxb.annotations");
         }
         Annotation[] anns = null;
+       
         if (honorJaxbAnnotation) {
             anns = getJAXBAnnotation(part);
             if (anns.length > 0) {
-                //RpcLit will use the JAXB Bridge to unmarshall part message when it is 
-                //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
-                //TODO:Cache the JAXBRIContext
+                // RpcLit will use the JAXB Bridge to unmarshall part message when it is
+                // annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
+                // TODO:Cache the JAXBRIContext
                 QName qname = new QName(null, part.getConcreteName().getLocalPart());
-    
-                return JAXBEncoderDecoder.unmarshalWithBridge(qname,
-                                                              part.getTypeClass(),
+
+                return JAXBEncoderDecoder.unmarshalWithBridge(qname, 
+                                                              part.getTypeClass(), 
                                                               anns, 
-                                                              databinding.getContextClasses(),
+                                                              databinding.getContextClasses(),

+                                                              reader, 
+                                                              getAttachmentUnmarshaller());
+            }
+        }
+        //The jaxb class contains XMLGregorianCalendar field also needs JAXB Bridge
+        if (part != null && part.getTypeClass() != null) {
+            boolean useJAXBBridge = false;
+            for (Field field : part.getTypeClass().getDeclaredFields()) {
+                if (field.getType().equals(XMLGregorianCalendar.class)) {
+                    useJAXBBridge = true;
+                    break;
+                }
+            }
+            if (useJAXBBridge) {
+                return JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(), 
+                                                              part.getTypeClass(),
+                                                              part.getTypeClass().getAnnotations(),
+                                                              databinding.getContextClasses(),

                                                               reader,
                                                               getAttachmentUnmarshaller());
             }
         }
         
+        
         return JAXBEncoderDecoder.unmarshall(createUnmarshaller(), reader, part, 
                                              unwrapJAXBElement);
     }



Mime
View raw message