cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/3] cxf git commit: Don't create the special factory for abstract classes. Also, log that it's doing that as the user could avoid it via a default constructor.
Date Mon, 12 Oct 2015 19:35:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes d4f745333 -> 54f638684


Don't create the special factory for abstract classes.  Also, log that it's doing that as
the user could avoid it via a default constructor.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/381a24e2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/381a24e2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/381a24e2

Branch: refs/heads/2.7.x-fixes
Commit: 381a24e243dd903ea7d4ae25419d52464cea1112
Parents: d4f7453
Author: Daniel Kulp <dkulp@apache.org>
Authored: Tue Jun 2 15:33:26 2015 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Oct 12 15:30:25 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxb/JAXBContextInitializer.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/381a24e2/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
index fd9173a..17d6763 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
@@ -34,6 +34,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.logging.Logger;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -47,6 +48,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
 
 import org.apache.cxf.common.classloader.JAXBClassLoaderUtils;
 import org.apache.cxf.common.jaxb.JAXBUtils;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ASMHelper;
 import org.apache.cxf.common.util.ASMHelper.ClassWriter;
 import org.apache.cxf.common.util.ASMHelper.MethodVisitor;
@@ -64,7 +66,7 @@ import org.apache.cxf.service.model.UnwrappedOperationInfo;
  * Walks the service model and sets up the classes for the context.
  */
 class JAXBContextInitializer extends ServiceModelVisitor {
-
+    private static final Logger LOG = LogUtils.getL7dLogger(JAXBContextInitializer.class);
     private Set<Class<?>> classes;
     private Collection<Object> typeReferences;
     private Set<Class<?>> globalAdapters = new HashSet<Class<?>>();
@@ -303,7 +305,10 @@ class JAXBContextInitializer extends ServiceModelVisitor {
             return;
         } else {
             Class<?> cls = JAXBUtils.getValidClass(claz);
-            if (cls == null && ReflectionUtil.getDeclaredConstructors(claz).length
> 0) {
+            if (cls == null 
+                && ReflectionUtil.getDeclaredConstructors(claz).length > 0 
+                && !Modifier.isAbstract(claz.getModifiers())) {
+                LOG.info("Class " + claz.getName() + " does not have a default constructor
which JAXB requires.");
                 //there is no init(), but other constructors
                 Object factory = createFactory(claz, ReflectionUtil.getDeclaredConstructors(claz)[0]);
                 unmarshallerProperties.put("com.sun.xml.bind.ObjectFactory", factory);


Mime
View raw message