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/02/22 17:12:08 UTC
svn commit: r1292368 - in /cxf/trunk: parent/pom.xml
rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Author: dkulp
Date: Wed Feb 22 16:12:08 2012
New Revision: 1292368
URL: http://svn.apache.org/viewvc?rev=1292368&view=rev
Log:
[CXF-4129] Restore compatibility with in-jdk jaxb
Modified:
cxf/trunk/parent/pom.xml
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1292368&r1=1292367&r2=1292368&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Wed Feb 22 16:12:08 2012
@@ -282,7 +282,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.8</version>
+ <version>2.9</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf.build-utils</groupId>
Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1292368&r1=1292367&r2=1292368&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java (original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Wed Feb 22 16:12:08 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;
@@ -87,6 +87,7 @@ import org.apache.cxf.common.jaxb.JAXBUt
import org.apache.cxf.common.jaxb.JAXBUtils.SchemaCompiler;
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.util.SystemPropertyAction;
import org.apache.cxf.common.xmlschema.SchemaCollection;
@@ -793,20 +794,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;