cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1081664 - in /cxf/branches/2.3.x-fixes: ./ api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Date Tue, 15 Mar 2011 04:09:19 GMT
Author: dkulp
Date: Tue Mar 15 04:09:18 2011
New Revision: 1081664

URL: http://svn.apache.org/viewvc?rev=1081664&view=rev
Log:
Merged revisions 1081662 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1081662 | dkulp | 2011-03-15 00:06:54 -0400 (Tue, 15 Mar 2011) | 2 lines
  
  [CXF-3331] Hack around a bug in the xerces schema parser built into the
  JDK
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java

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

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=1081664&r1=1081663&r2=1081664&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
(original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Tue Mar 15 04:09:18 2011
@@ -631,7 +631,7 @@ public final class EndpointReferenceUtil
     }
     
     
-    private static Schema createSchema(ServiceInfo serviceInfo, Bus b) {
+    private static synchronized Schema createSchema(ServiceInfo serviceInfo, Bus b) {
         if (b == null) {
             b = BusFactory.getThreadDefaultBus(false);
         }
@@ -644,6 +644,7 @@ public final class EndpointReferenceUtil
             try {
                 for (SchemaInfo si : serviceInfo.getSchemas()) {
                     Element el = si.getElement();
+                    unsetReadonly(el);
                     String baseURI = null;
                     try {
                         baseURI = el.getBaseURI();
@@ -706,12 +707,29 @@ public final class EndpointReferenceUtil
                     String s = XMLUtils.toString(schemaInfo.getElement(), 4);
                     LOG.log(Level.INFO, "Schema for: " + schemaInfo.getNamespaceURI() + "\n"
+ s);
                 }
+            } finally { 
+                for (Source src : schemaSourcesMap2.values()) {
+                    if (src instanceof DOMSource) {
+                        Node nd = ((DOMSource)src).getNode();
+                        unsetReadonly(nd);
+                    }
+                }
             }
             serviceInfo.setProperty(Schema.class.getName(), schema);
         }
         return schema;
     }
     
+    private static void unsetReadonly(Node nd) {
+        try {
+            //work around a bug in the version of Xerces that is in the JDK
+            //that only allows the Element to be used to create a schema once.
+            nd.getClass().getMethod("setReadOnly", Boolean.TYPE, Boolean.TYPE).invoke(nd,
false, true);
+        } catch (Throwable ex) {
+            //ignore
+        }
+    }
+
     public static Schema getSchema(ServiceInfo serviceInfo) {
         return getSchema(serviceInfo, null);
     }



Mime
View raw message