You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/12/19 20:04:06 UTC

svn commit: r1424032 - /cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java

Author: dkulp
Date: Wed Dec 19 19:04:06 2012
New Revision: 1424032

URL: http://svn.apache.org/viewvc?rev=1424032&view=rev
Log:
Merged revisions 1424011 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1424011 | dkulp | 2012-12-19 13:30:52 -0500 (Wed, 19 Dec 2012) | 10 lines

  Merged revisions 1424005 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1424005 | dkulp | 2012-12-19 13:28:05 -0500 (Wed, 19 Dec 2012) | 2 lines

    Fix some issues introduced in 2.7.1 that caused extra classes to be added to the JAXBContext that shouldn't be.

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java

Modified: cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=1424032&r1=1424031&r2=1424032&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java (original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java Wed Dec 19 19:04:06 2012
@@ -407,13 +407,9 @@ class JAXBContextInitializer extends Ser
         // must not have parameters and return type must not be void
         if (method.getReturnType() == Void.class 
             || method.getParameterTypes().length != 0
-            || method.getDeclaringClass().equals(Throwable.class)) {
-            return false;
-        }
-        if (method.getName().startsWith("get")
-                || method.getName().startsWith("is")) { 
-                //continue with below check.
-        } else {
+            || method.getDeclaringClass().equals(Throwable.class)
+            || !(method.getName().startsWith("get")
+                    || method.getName().startsWith("is"))) {
             return false;
         }
         int beginIndex = 3;
@@ -429,19 +425,23 @@ class JAXBContextInitializer extends Ser
         } catch (Exception e) {
             //getter, but no setter
         }
-        if ((setter != null) 
-                && ((setter.isAnnotationPresent(XmlTransient.class)
-                 || !Modifier.isPublic(setter.getModifiers())))) {
+        if (setter != null) {
+            if (setter.isAnnotationPresent(XmlTransient.class)
+                || !Modifier.isPublic(setter.getModifiers())) {
+                return false;
+            }
+        } else if (!Collection.class.isAssignableFrom(method.getReturnType())
+            && !Throwable.class.isAssignableFrom(method.getDeclaringClass())) {
+            //no setter, it's not a collection (thus getter().add(...)), and
+            //not an Exception, 
             return false;
-             
         }
 
         if (accessType == XmlAccessType.NONE
             || accessType == XmlAccessType.FIELD) {
             return checkJaxbAnnotation(method.getAnnotations());
-        } else {
-            return true;
         }
+        return true;
     }
 
     /**