Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE24517ED5 for ; Wed, 3 Jun 2015 00:55:18 +0000 (UTC) Received: (qmail 85484 invoked by uid 500); 2 Jun 2015 20:55:18 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 85289 invoked by uid 500); 2 Jun 2015 20:55:18 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 85156 invoked by uid 99); 2 Jun 2015 20:55:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2015 20:55:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 067A3DFFD5; Tue, 2 Jun 2015 20:55:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkulp@apache.org To: commits@cxf.apache.org Date: Tue, 02 Jun 2015 20:55:18 -0000 Message-Id: In-Reply-To: <58f010cd8f754b938e8741ea12932c45@git.apache.org> References: <58f010cd8f754b938e8741ea12932c45@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/4] 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. 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/103c145d Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/103c145d Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/103c145d Branch: refs/heads/3.0.x-fixes Commit: 103c145d248c1eddcd57a0f3e3459ae3c743f72f Parents: f49b6ef Author: Daniel Kulp Authored: Tue Jun 2 15:33:26 2015 -0400 Committer: Daniel Kulp Committed: Tue Jun 2 16:55:08 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/103c145d/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 27f7a74..afde3f4 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; @@ -48,6 +49,7 @@ import javax.xml.namespace.QName; import org.apache.cxf.common.classloader.ClassLoaderUtils; 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; @@ -65,7 +67,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> classes; private Collection typeReferences; private Set> globalAdapters = new HashSet>(); @@ -304,7 +306,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);