cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1232521 - in /cxf/branches/2.4.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Date Tue, 17 Jan 2012 18:18:16 GMT
Author: dkulp
Date: Tue Jan 17 18:18:15 2012
New Revision: 1232521

URL: http://svn.apache.org/viewvc?rev=1232521&view=rev
Log:
Merged revisions 1232516 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

................
  r1232516 | dkulp | 2012-01-17 13:11:57 -0500 (Tue, 17 Jan 2012) | 11 lines
  
  Merged revisions 1232498 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1232498 | dkulp | 2012-01-17 12:25:32 -0500 (Tue, 17 Jan 2012) | 3 lines
    
    [CXF-4036] Update JAXBContextInitializer to look for XmlSeeAlso and
    TypeAdapters on classes as well.
    Patch from david ferbas applied
  ........
................

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

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

Modified: cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=1232521&r1=1232520&r2=1232521&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Tue Jan 17 18:18:15 2012
@@ -269,30 +269,38 @@ class JAXBContextInitializer extends Ser
         } else {
             cls = JAXBUtils.getValidClass(cls);
             if (null != cls) {
+                if (classes.contains(cls)) {
+                    return;
+                }
+
+                if (!cls.isInterface()) {
+                    classes.add(cls);
+                }
+
+                XmlSeeAlso xsa = cls.getAnnotation(XmlSeeAlso.class);
+                if (xsa != null) {
+                    for (Class<?> c : xsa.value()) {
+                        addClass(c);
+                    }
+                }
+                XmlJavaTypeAdapter xjta = cls.getAnnotation(XmlJavaTypeAdapter.class);
+                if (xjta != null) {
+                    //has an adapter.   We need to inspect the adapter and then
+                    //return as the adapter will handle the superclass
+                    //and interfaces and such
+                    @SuppressWarnings("rawtypes")
+                    Class<? extends XmlAdapter> c2 = xjta.value();
+                    inspectTypeAdapter(c2);
+                    return;
+                }
+                
                 if (cls.getSuperclass() != null) {
                     //JAXB should do this, but it doesn't always.
                     //in particular, older versions of jaxb don't
                     addClass(cls.getSuperclass());
                 }
-                
-                if (cls.isInterface()) {
-                    //interfaces cannot be added directly, however, they
-                    //may have some interesting annoations we should consider
-                    XmlSeeAlso xsa = cls.getAnnotation(XmlSeeAlso.class);
-                    if (xsa != null) {
-                        for (Class c : xsa.value()) {
-                            addClass(c);
-                        }
-                    }
-                    XmlJavaTypeAdapter xjta = cls.getAnnotation(XmlJavaTypeAdapter.class);
-                    if (xjta != null) {
-                        Class<? extends XmlAdapter> c2 = xjta.value();
-                        inspectTypeAdapter(c2);
-                    }
-                } else if (classes.contains(cls)) {
-                    return;
-                } else {
-                    classes.add(cls);
+
+                if (!cls.isInterface()) {
                     walkReferences(cls);
                 }
             }
@@ -407,11 +415,17 @@ class JAXBContextInitializer extends Ser
         if (method.getName().startsWith("is")) {
             beginIndex = 2;
         }
+        Method setter = null;
         try {
-            method.getDeclaringClass().getMethod("set" + method.getName().substring(beginIndex),
-                                                 new Class[] {method.getReturnType()});
+            setter = method.getDeclaringClass()
+                .getMethod("set" + method.getName().substring(beginIndex),
+                           new Class[] {method.getReturnType()});
         } catch (Exception e) {
             //getter, but no setter
+        }
+        if (setter == null 
+            || setter.isAnnotationPresent(XmlTransient.class)
+            || !Modifier.isPublic(setter.getModifiers())) {
             return false;
         }
 



Mime
View raw message