cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r777200 - in /cxf/branches/2.1.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/ rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/cor...
Date Thu, 21 May 2009 17:40:23 GMT
Author: dkulp
Date: Thu May 21 17:40:19 2009
New Revision: 777200

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

........
  r777189 | dkulp | 2009-05-21 13:28:57 -0400 (Thu, 21 May 2009) | 2 lines
  
  Add sync blocks when using the XMLInput/OutputFactories since the Sun
  stax parsers aren't thread safe.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/generated/org/apache/cxf/aegis/util/jdom/StaxBuilder.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 21 17:40:19 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189

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

Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
(original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Thu May 21 17:40:19 2009
@@ -139,7 +139,10 @@
 
     public static XMLStreamWriter createXMLStreamWriter(Writer out) {
         try {
-            return getXMLOutputFactory().createXMLStreamWriter(out);
+            XMLOutputFactory factory = getXMLOutputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamWriter(out);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Cant' create XMLStreamWriter", e);
         }
@@ -155,7 +158,10 @@
         }
 
         try {
-            return getXMLOutputFactory().createXMLStreamWriter(out, encoding);
+            XMLOutputFactory factory = getXMLOutputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamWriter(out, encoding);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Cant' create XMLStreamWriter", e);
         }
@@ -163,7 +169,10 @@
     
     public static XMLStreamWriter createXMLStreamWriter(Result r) {
         try {
-            return getXMLOutputFactory().createXMLStreamWriter(r);
+            XMLOutputFactory factory = getXMLOutputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamWriter(r);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Cant' create XMLStreamWriter", e);
         }
@@ -171,7 +180,10 @@
 
     public static XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter
filter) {
         try {
-            return getXMLInputFactory().createFilteredReader(reader, filter);
+            XMLInputFactory factory = getXMLInputFactory();
+            synchronized (factory) {
+                return factory.createFilteredReader(reader, filter);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Cant' create XMLStreamReader", e);
         }
@@ -829,7 +841,10 @@
         }
 
         try {
-            return getXMLInputFactory().createXMLStreamReader(in, encoding);
+            XMLInputFactory factory = getXMLInputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamReader(in, encoding);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Couldn't parse stream.", e);
         }
@@ -841,11 +856,26 @@
      */
     public static XMLStreamReader createXMLStreamReader(InputStream in) {
         try {
-            return getXMLInputFactory().createXMLStreamReader(in);
+            XMLInputFactory factory = getXMLInputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamReader(in);
+            }
+        } catch (XMLStreamException e) {
+            throw new RuntimeException("Couldn't parse stream.", e);
+        }
+    }
+
+    public static XMLStreamReader createXMLStreamReader(String systemId, InputStream in)
{
+        try {
+            XMLInputFactory factory = getXMLInputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamReader(systemId, in);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Couldn't parse stream.", e);
         }
     }
+
     
     public static XMLStreamReader createXMLStreamReader(Element el) {
         return new W3CDOMStreamReader(el);
@@ -869,8 +899,10 @@
                     return new W3CDOMStreamReader(el);
                 }
             }
-            
-            return getXMLInputFactory().createXMLStreamReader(source);
+            XMLInputFactory factory = getXMLInputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamReader(source);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Couldn't parse stream.", e);
         }
@@ -883,7 +915,10 @@
     public static XMLStreamReader createXMLStreamReader(Reader reader) {
 
         try {
-            return getXMLInputFactory().createXMLStreamReader(reader);
+            XMLInputFactory factory = getXMLInputFactory();
+            synchronized (factory) {
+                return factory.createXMLStreamReader(reader);
+            }
         } catch (XMLStreamException e) {
             throw new RuntimeException("Couldn't parse stream.", e);
         }

Modified: cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
Thu May 21 17:40:19 2009
@@ -113,8 +113,10 @@
         if ("POST".equals(method) || "PUT".equals(method)) {
             XMLInputFactory inputFactory = StaxInInterceptor.getXMLInputFactory(message);
             try {
-                XMLStreamReader reader = 
-                    inputFactory.createXMLStreamReader(message.getContent(InputStream.class));
+                XMLStreamReader reader;
+                synchronized (inputFactory) {
+                    reader = inputFactory.createXMLStreamReader(message.getContent(InputStream.class));
+                }
                 doc = StaxUtils.read(reader);
             } catch (XMLStreamException e) {
                 throw new Fault(e);

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
Thu May 21 17:40:19 2009
@@ -108,16 +108,17 @@
         } else {
             //as the SOAPMessage already has everything in place, we do not need XMLStreamWriter
to write
             //anything for us, so we just set XMLStreamWriter's output to a dummy output
stream.         
-            try {
-                XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
-                message.put(ORIGINAL_XML_WRITER, origWriter);
-                
-                XMLStreamWriter dummyWriter = StaxUtils.getXMLOutputFactory()
-                    .createXMLStreamWriter(new ByteArrayOutputStream());
-                message.setContent(XMLStreamWriter.class, dummyWriter);
-            } catch (XMLStreamException e) {
-                // do nothing
-            }
+
+            XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
+            message.put(ORIGINAL_XML_WRITER, origWriter);
+            
+            XMLStreamWriter dummyWriter = StaxUtils.createXMLStreamWriter(new OutputStream()
{
+                    public void write(int b) throws IOException {
+                    }
+                    public void write(byte b[], int off, int len) throws IOException {
+                    }                        
+                });
+            message.setContent(XMLStreamWriter.class, dummyWriter);
         }
         
         // Add a final interceptor to write the message

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
Thu May 21 17:40:19 2009
@@ -78,7 +78,10 @@
 
         XMLStreamReader reader;
         try {
-            reader = getXMLInputFactory(message).createXMLStreamReader(is, encoding);
+            XMLInputFactory factory = getXMLInputFactory(message);
+            synchronized (factory) {
+                reader = factory.createXMLStreamReader(is, encoding);
+            }
         } catch (XMLStreamException e) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("STREAM_CREATE_EXC",
                                                                    LOG,

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
Thu May 21 17:40:19 2009
@@ -64,7 +64,10 @@
         String encoding = getEncoding(message);
         
         try {
-            writer = getXMLOutputFactory(message).createXMLStreamWriter(os, encoding);
+            XMLOutputFactory factory = getXMLOutputFactory(message);
+            synchronized (factory) {
+                writer = factory.createXMLStreamWriter(os, encoding);
+            }
             if (Boolean.TRUE.equals(message.getContextualProperty(FORCE_START_DOCUMENT)))
{
                 writer.writeStartDocument(encoding, "1.0");
                 message.removeContent(OutputStream.class);

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/generated/org/apache/cxf/aegis/util/jdom/StaxBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/generated/org/apache/cxf/aegis/util/jdom/StaxBuilder.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/generated/org/apache/cxf/aegis/util/jdom/StaxBuilder.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/generated/org/apache/cxf/aegis/util/jdom/StaxBuilder.java
Thu May 21 17:40:19 2009
@@ -60,7 +60,6 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -124,7 +123,6 @@
     /** The factory for creating new JDOM objects */
     private JDOMFactory factory;
 
-    private XMLInputFactory xifactory;
 
     private Map additionalNamespaces;
     // This is set to 'true' when we are reading the middle of a stream,
@@ -135,17 +133,12 @@
      * Default constructor.
      */
     public StaxBuilder() {
-        xifactory = StaxUtils.getXMLInputFactory();
     }
 
     public StaxBuilder(Map namespaces) {
-        xifactory = StaxUtils.getXMLInputFactory();
         this.additionalNamespaces = namespaces;
     }
 
-    public StaxBuilder(XMLInputFactory xifactory) {
-        this.xifactory = xifactory;
-    }
 
     public Map getAdditionalNamespaces() {
         return additionalNamespaces;
@@ -193,12 +186,12 @@
 
     public Document build(InputStream is) throws XMLStreamException {
         isReadingMidStream = false;
-        return buildInternal(xifactory.createXMLStreamReader(is));
+        return buildInternal(StaxUtils.createXMLStreamReader(is));
     }
 
     public Document build(Reader reader) throws XMLStreamException {
         isReadingMidStream = false;
-        return buildInternal(xifactory.createXMLStreamReader(reader));
+        return buildInternal(StaxUtils.createXMLStreamReader(reader));
     }
     
     private Document buildInternal(XMLStreamReader r) throws XMLStreamException {

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java?rev=777200&r1=777199&r2=777200&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java
Thu May 21 17:40:19 2009
@@ -25,6 +25,7 @@
 
 
 
+import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.endpoint.Endpoint;
@@ -62,8 +63,10 @@
             String encoding = (String)message.get(Message.ENCODING);
 
             XMLStreamReader xsr;
-            xsr = StaxInInterceptor.getXMLInputFactory(message).
-                createXMLStreamReader(bos.getInputStream(), encoding);
+            XMLInputFactory factory = StaxInInterceptor.getXMLInputFactory(message);
+            synchronized (factory) {
+                xsr = factory.createXMLStreamReader(bos.getInputStream(), encoding);
+            }
             
             // move to the soap body            
             while (true) {                



Mime
View raw message