cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r691722 - in /cxf/branches/2.0.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Date Wed, 03 Sep 2008 18:42:59 GMT
Author: dkulp
Date: Wed Sep  3 11:42:58 2008
New Revision: 691722

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

................
  r691491 | dkulp | 2008-09-02 23:23:08 -0400 (Tue, 02 Sep 2008) | 9 lines
  
  Merged revisions 691488 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r691488 | dkulp | 2008-09-02 23:20:37 -0400 (Tue, 02 Sep 2008) | 2 lines
    
    [CXF-1624] Check the ObjectFactory to see if the defaultNs can be set or not.
  ........
................

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

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep  3 11:42:58 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488
 /incubator/cxf/trunk:434594-651668

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Sep  3 11:42:58 2008
@@ -1 +1 @@
-/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828,687097,687464-687465,689109,689112,689122,691316,691357
+/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828,687097,687464-687465,689109,689112,689122,691316,691357,691491

Modified: cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=691722&r1=691721&r2=691722&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Wed Sep  3 11:42:58 2008
@@ -25,6 +25,7 @@
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -42,6 +43,7 @@
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.bind.annotation.XmlElementDecl;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLStreamReader;
@@ -491,7 +493,8 @@
         addWsAddressingTypes(classes);
 
         for (Class<?> clz : classes) {
-            if (clz.getName().endsWith("ObjectFactory")) {
+            if (clz.getName().endsWith("ObjectFactory")
+                && checkObjectFactoryNamespaces(clz)) {
                 // kind of a hack, but ObjectFactories may be created with empty
                 // namespaces
                 defaultNs = null;
@@ -523,6 +526,19 @@
         return cachedContextAndSchemas;
     }
 
+    private boolean checkObjectFactoryNamespaces(Class<?> clz) {
+        for (Method meth : clz.getMethods()) {
+            XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
+            if (decl != null 
+                && XmlElementDecl.GLOBAL.class.equals(decl.scope())
+                && StringUtils.isEmpty(decl.namespace())) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     private void addToObjectFactoryCache(Package objectFactoryPkg, Class<?> ofactory)
{
         if (objectFactoryPkg == null) {
             return;



Mime
View raw message