cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1292377 - in /cxf/branches/2.4.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Date Wed, 22 Feb 2012 16:18:06 GMT
Author: dkulp
Date: Wed Feb 22 16:18:06 2012
New Revision: 1292377

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

................
  r1292373 | dkulp | 2012-02-22 11:14:52 -0500 (Wed, 22 Feb 2012) | 9 lines
  
  Merged revisions 1292368 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1292368 | dkulp | 2012-02-22 11:12:08 -0500 (Wed, 22 Feb 2012) | 2 lines
  
    [CXF-4129] Restore compatibility with in-jdk jaxb
  
  ........
................

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 22 16:18:06 2012
@@ -1 +1,2 @@
+/cxf/branches/2.5.x-fixes:1292373
 /cxf/trunk:1221366

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1292377&r1=1292376&r2=1292377&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Wed Feb 22 16:18:06 2012
@@ -66,10 +66,10 @@ import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.XMLFilterImpl;
 
-import com.sun.tools.xjc.ErrorReceiver;
 import com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl;
 import com.sun.tools.xjc.reader.internalizer.DOMForest;
-import com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic;
+import com.sun.tools.xjc.reader.internalizer.InternalizationLogic;
+//import com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.CXFBusFactory;
@@ -79,6 +79,7 @@ import org.apache.cxf.common.WSDLConstan
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ReflectionInvokationHandler;
+import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.endpoint.Client;
@@ -791,20 +792,44 @@ public class DynamicClientFactory {
         try {
             Object o = ((ReflectionInvokationHandler)Proxy.getInvocationHandler(schemaCompiler)).getTarget();
             Field f = o.getClass().getDeclaredField("forest");
-            f.setAccessible(true);
-            DOMForest forest = new DOMForest(new XMLSchemaInternalizationLogic() {
+            Object forest = ReflectionUtil.setAccessible(f).get(o);
+            // Set the error handler
+            for (Method m : forest.getClass().getMethods()) {
+                if ("setErrorHandler".equals(m.getName())) {
+                    m.invoke(forest, o);
+                }
+            }
+            
+            f = forest.getClass().getDeclaredField("logic");
+            Object xil = ReflectionUtil.setAccessible(f).get(forest);
+            if (xil.getClass().getName().contains(".internal.")) {
+                xil = createWrapperLogic(xil, catalog);
+                ReflectionUtil.setAccessible(f).set(forest, xil);
+            }
+        } catch (Throwable ex)  {
+            //ignore
+            ex.printStackTrace();
+        }
+    }
+    private Object createWrapperLogic(final Object xil, final OASISCatalogManager catalog)
{
+        try {
+            return new InternalizationLogic() {
                 public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) {
                     return new ReferenceFinder(parent, catalog);
                 }
-
-            });
-            forest.setErrorHandler((ErrorReceiver)o);
-            f.set(o, forest);
-        } catch (Throwable ex)  {
+                public boolean checkIfValidTargetNode(DOMForest parent, Element bindings,
Element target) {
+                    return ((InternalizationLogic)xil).checkIfValidTargetNode(parent, bindings,
target);
+                }
+                public Element refineTarget(Element target) {
+                    return ((InternalizationLogic)xil).refineTarget(target);
+                }
+            };
+        } catch (Throwable ex) {
             //ignore
+            return xil;
         }
     }
-    
+
     private static final class ReferenceFinder extends AbstractReferenceFinderImpl {
         private Locator locator;
         private OASISCatalogManager catalog;



Mime
View raw message