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/10/25 16:55:21 UTC

svn commit: r1402175 - in /cxf/branches/2.5.x-fixes: parent/pom.xml tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java

Author: dkulp
Date: Thu Oct 25 14:55:21 2012
New Revision: 1402175

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

........
  r1401437 | dkulp | 2012-10-23 16:19:17 -0400 (Tue, 23 Oct 2012) | 10 lines

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

  ........
    r1400213 | dkulp | 2012-10-19 14:37:10 -0400 (Fri, 19 Oct 2012) | 2 lines

    Updates to support the latest JAXB impl

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/parent/pom.xml
    cxf/branches/2.5.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java

Modified: cxf/branches/2.5.x-fixes/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/parent/pom.xml?rev=1402175&r1=1402174&r2=1402175&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/parent/pom.xml (original)
+++ cxf/branches/2.5.x-fixes/parent/pom.xml Thu Oct 25 14:55:21 2012
@@ -64,9 +64,9 @@
         <cxf.jaxb21.version>2.1</cxf.jaxb21.version>
         <cxf.jaxb21.impl.version>2.1.13</cxf.jaxb21.impl.version>
         <cxf.jaxb21.xjc.version>2.1.13</cxf.jaxb21.xjc.version>
-        <cxf.jaxb22.version>2.2.3</cxf.jaxb22.version>
-        <cxf.jaxb22.impl.version>2.2.4-1</cxf.jaxb22.impl.version>
-        <cxf.jaxb22.xjc.version>2.2.4-1</cxf.jaxb22.xjc.version>
+        <cxf.jaxb22.version>2.2.6</cxf.jaxb22.version>
+        <cxf.jaxb22.impl.version>2.2.6</cxf.jaxb22.impl.version>
+        <cxf.jaxb22.xjc.version>2.2.6</cxf.jaxb22.xjc.version>
 
         <!-- by default, we use jaxb 2.1, but java5 profile will override to 2.2 -->
         <cxf.jaxb.version>${cxf.jaxb21.version}</cxf.jaxb.version>

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=1402175&r1=1402174&r2=1402175&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Thu Oct 25 14:55:21 2012
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Writer;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.net.URI;
 import java.net.URL;
@@ -86,6 +87,7 @@ import com.sun.tools.xjc.api.TypeAndAnno
 import com.sun.tools.xjc.api.XJC;
 import com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl;
 import com.sun.tools.xjc.reader.internalizer.DOMForest;
+import com.sun.tools.xjc.reader.internalizer.InternalizationLogic;
 import com.sun.tools.xjc.reader.xmlschema.parser.LSInputSAXWrapper;
 import com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic;
 
@@ -302,7 +304,10 @@ public class JAXBDataBinding implements 
         SchemaCompiler schemaCompiler = XJC.createSchemaCompiler();
         Bus bus = context.get(Bus.class);
         OASISCatalogManager catalog = bus.getExtension(OASISCatalogManager.class);
-        hackInNewInternalizationLogic(schemaCompiler, catalog);
+
+        Options opts = null;
+        opts = getOptions(schemaCompiler);
+        hackInNewInternalizationLogic(schemaCompiler, catalog, opts);
 
         ClassCollector classCollector = context.get(ClassCollector.class);
 
@@ -318,8 +323,6 @@ public class JAXBDataBinding implements 
         List<InputSource> jaxbBindings = context.getJaxbBindingFile();
         SchemaCollection schemas = (SchemaCollection) context.get(ToolConstants.XML_SCHEMA_COLLECTION);
 
-        Options opts = null;
-        opts = getOptions(schemaCompiler);
 
         List<String> args = new ArrayList<String>();
 
@@ -465,16 +468,27 @@ public class JAXBDataBinding implements 
         }
     }
     private void hackInNewInternalizationLogic(SchemaCompiler schemaCompiler,
-                                               final OASISCatalogManager catalog) {
+                                               final OASISCatalogManager catalog,
+                                               Options opts) {
         try {
             Field f = schemaCompiler.getClass().getDeclaredField("forest");
             f.setAccessible(true);
-            DOMForest forest = new DOMForest(new XMLSchemaInternalizationLogic() {
+            XMLSchemaInternalizationLogic logic = new XMLSchemaInternalizationLogic() {
                 public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) {
                     return new ReferenceFinder(parent, catalog);
                 }
+            };
+            
+            Constructor<DOMForest> c = null;
+            DOMForest forest = null;
 
-            });
+            try {
+                c = DOMForest.class.getConstructor(InternalizationLogic.class, Options.class);
+                forest = c.newInstance(logic, opts);
+            } catch (Throwable t) {
+                c = DOMForest.class.getConstructor(InternalizationLogic.class);
+                forest = c.newInstance(logic);
+            }
             forest.setErrorHandler((ErrorReceiver)schemaCompiler);
             f.set(schemaCompiler, forest);
         } catch (Throwable ex)  {