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 2021/09/29 17:37:25 UTC

[cxf] branch 3.4.x-fixes updated (da0ebae -> 3379747)

This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a change to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from da0ebae  Recording .gitmergeinfo Changes
     new 69590fe  [CXF-7396] Close some input streams/readers when copying from various source objects to output
     new ed26fd6  Some dependency updates
     new 3379747  Recording .gitmergeinfo Changes

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitmergeinfo                                      |  6 ++
 .../databinding/source/XMLStreamDataWriter.java    | 29 +++++++--
 parent/pom.xml                                     | 12 ++--
 .../apache/cxf/systest/jaxws/ClientServerTest.java | 69 ++++++++++++++++++++++
 4 files changed, 106 insertions(+), 10 deletions(-)

[cxf] 01/03: [CXF-7396] Close some input streams/readers when copying from various source objects to output

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 69590fe82d3dc1a1e0d7c42753c2465a1380abea
Author: Daniel Kulp <dk...@apache.org>
AuthorDate: Tue Aug 17 16:54:09 2021 -0400

    [CXF-7396] Close some input streams/readers when copying from various source objects to output
    
    (cherry picked from commit 148f59425afbe5c95786d5f65912cd7c3c1fcc9c)
---
 .../databinding/source/XMLStreamDataWriter.java    | 29 +++++++--
 .../apache/cxf/systest/jaxws/ClientServerTest.java | 69 ++++++++++++++++++++++
 2 files changed, 94 insertions(+), 4 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java b/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
index 1a388a7..fa01975 100644
--- a/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
+++ b/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
@@ -18,7 +18,9 @@
  */
 package org.apache.cxf.databinding.source;
 
+import java.io.Closeable;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collection;
 import java.util.logging.Logger;
 
@@ -28,6 +30,7 @@ import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.Validator;
 
@@ -67,22 +70,24 @@ public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> {
 
     @SuppressWarnings("PMD.UseTryWithResources")
     public void write(Object obj, XMLStreamWriter writer) {
-        try {
+        Closeable toClose = null;
+        try {            
             if (obj instanceof DataSource) {
                 DataSource ds = (DataSource)obj;
+                InputStream is = ds.getInputStream();
+                toClose = is;                    
                 if (schema != null) {
-                    DOMSource domSource = new DOMSource(StaxUtils.read(ds.getInputStream()));
+                    DOMSource domSource = new DOMSource(StaxUtils.read(is));
                     Validator schemaValidator = schema.newValidator();
                     schemaValidator.setErrorHandler(
                         new MtomValidationErrorHandler(schemaValidator.getErrorHandler(), domSource.getNode()));
                     schemaValidator.validate(domSource);
                     StaxUtils.copy(domSource, writer);
                 } else {
-                    XMLStreamReader reader = StaxUtils.createXMLStreamReader(ds.getInputStream());
+                    XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
                     StaxUtils.copy(reader, writer);
                     reader.close();
                 }
-
             } else if (obj instanceof Node) {
                 if (obj instanceof DocumentFragment) {
                     obj = org.apache.cxf.helpers.DOMUtils.getDomDocumentFragment((DocumentFragment)obj);
@@ -111,6 +116,14 @@ public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> {
                     && ((DOMSource) s).getNode() == null) {
                     return;
                 }
+                if (s instanceof StreamSource) {
+                    StreamSource ss = (StreamSource)s;
+                    if (ss.getInputStream() != null) {
+                        toClose = ss.getInputStream();
+                    } else {
+                        toClose = ss.getReader();
+                    }
+                }
                 StaxUtils.copy(s, writer);
             }
         } catch (XMLStreamException e) {
@@ -121,6 +134,14 @@ public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> {
         } catch (SAXException e) {
             throw new Fault("COULD_NOT_WRITE_XML_STREAM_CAUSED_BY", LOG, e,
                             e.getClass().getCanonicalName(), e.getMessage());
+        } finally {
+            if (toClose != null) {
+                try {
+                    toClose.close();
+                } catch (IOException ex) {
+                    //likely already closed, not something we need to worry about
+                }
+            }
         }
     }
 
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
index 912aa8a..72b37e6 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.systest.jaxws;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.InputStream;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -53,6 +54,8 @@ import javax.xml.ws.soap.SOAPFaultException;
 
 import org.w3c.dom.Document;
 
+import com.google.common.io.Files;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.common.logging.LogUtils;
@@ -61,6 +64,8 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
 import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxws.DispatchImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -1001,6 +1006,70 @@ public class ClientServerTest extends AbstractBusClientServerTestBase {
 
         assertEquals(requestString, StaxUtils.toString(response));
     }
+    
+    @Test
+    public void testEchoProviderThresholdAsync() throws Exception {
+        final File f = Files.createTempDir();
+        LOG.info("Using temp folder: " + f.getAbsolutePath());
+        
+        System.setProperty("org.apache.cxf.io.CachedOutputStream.OutputDirectory", f.getAbsolutePath());
+        CachedOutputStream.setDefaultThreshold(5);
+        
+        String requestString = "<echo/>";
+        Service service = Service.create(serviceName);
+        service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
+                        "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
+        Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
+                                                                   StreamSource.class,
+                                                                   Service.Mode.PAYLOAD);
+        dispatcher.getRequestContext().put("javax.xml.ws.client.receiveTimeout", "5000");
+        
+        StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
+        StreamSource response = dispatcher.invoke(request);
+
+        assertEquals(requestString, StaxUtils.toString(response));
+        
+        //give the server side a little time to process it's part and close the files
+        if (f.list().length > 0) {
+            Thread.sleep(500);
+        }
+        
+        assertEquals("Expected no files but there is at list one", 0, f.list().length);
+        FileUtils.removeDir(f);
+    }
+    
+    @Test
+    public void testEchoProviderThresholdAsyncThrows() throws Exception {
+        final File f = Files.createTempDir();
+        LOG.info("Using temp folder: " + f.getAbsolutePath());
+        
+        System.setProperty("org.apache.cxf.io.CachedOutputStream.OutputDirectory", f.getAbsolutePath());
+        CachedOutputStream.setDefaultThreshold(5);
+        
+        String requestString = "<echo/>";
+        Service service = Service.create(serviceName);
+        service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
+                        "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
+        Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
+                                                                   StreamSource.class,
+                                                                   Service.Mode.PAYLOAD);
+        dispatcher.getRequestContext().put("javax.xml.ws.client.receiveTimeout", "500");
+        
+        try {
+            StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
+            StreamSource response = dispatcher.invoke(request);
+            assertEquals(requestString, StaxUtils.toString(response));
+        } catch (final WebServiceException ex) {
+            ((DispatchImpl<StreamSource>)dispatcher).getClient().close();
+        }
+        //give the server side a little time to process it's part and close the files
+        if (f.list().length > 0) {
+            Thread.sleep(500);
+        }
+        
+        assertEquals("Expected no files but there is at list one", 0, f.list().length);
+        FileUtils.removeDir(f);
+    }
 
     @Test
     public void testEchoProviderAsyncDecoupledEndpoints() throws Exception {

[cxf] 03/03: Recording .gitmergeinfo Changes

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 3379747b84c383b18ca73115f50ac086c6f71e59
Author: Daniel Kulp <dk...@apache.org>
AuthorDate: Wed Sep 29 13:37:11 2021 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 9a211e7..ab602a0 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -7,6 +7,7 @@ B 0d47c86fce89c3709cca97f44904b6b24a5c2021
 B 0dce4cd3c0362da3a9864a1a93da0f6e5d480d7f
 B 0e235a4d7ca094ebd2a8afc6b22c00a841e2e554
 B 124fae280460ca911c6040868271328e6ca8fe98
+B 178db0d8fa34d98783d255d2beabd6e6faab4f0c
 B 1b6adcb32f93d708d817cabf2cc63973fbc069de
 B 1cb2a5fe44e390cf2106b07d8b6a8b5fffcda3e7
 B 2634ed5bcfb6001c1a72788a1152bedc6315585e
@@ -14,6 +15,7 @@ B 269c7c8fe4553c5307fd938dbba51af5a1535482
 B 27d9f6ac75162f9bbcfcf2bb2f5b569baf424a5d
 B 28780a99ff888d6e27c1c6d92dda0046bf513d33
 B 2c89d63ad40544c7b346d252398f010ba3b50a66
+B 2d2b6443d93ebe40d752bf02d2b8c0432d103e87
 B 2f28098031610f0279d93b0d4b8d32559707383d
 B 320534fa741aa00834c1d35a46efd3eedeb7229a
 B 332a02450fe1620daeaa2b65c0716e337d49095a
@@ -57,8 +59,10 @@ B 9c5658b9b39403cc95d38a61de900af0591222d5
 B a05c7db2a8c09f38e98ad08c921da55f0d5f511f
 B a06d00066c88077a1cf25766b841bd8f6cabb027
 B a7000a6dc4d61290fe96f579a43e231393ed7670
+B a7f455e36eba7d8f75be760991f23fa9be705143
 B a88e9d437b3a4e8630b33fa7d9e15a1a3bcd96c9
 B aa2874f35a9d42727bc3b3452de4e0a4b7d7ba48
+B aab3cb13cc61b0ec756680a2209db42fc3db933c
 B aec252eda5197098f9306e62edbf6a46e35cd054
 B b341f7cd05a5130f53efd56c01d14136655afe35
 B b902794f187035a6efe39e3632ccc7be0adc8a89
@@ -91,10 +95,12 @@ B fe058a4c83590e7a768e5be32c94622cbe1a3b6b
 M 011debd91b16215245e039309e620699042a9f4b
 M 0320ad320ba88a123a5296a8060d3ac1794009f6
 M 0c609dc1e242e4156ad55e10fa0699636da02ee9
+M 0dad051a0f126b1e365f83dfe1e4647a36e163f9
 M 0dda1ec488fa7187c26913d7190430bccd108bc3
 M 0f30442f3acb82e9936d4b486e07f5c341c142d2
 M 12873b9257b5de85f819346ab2325738e3f80206
 M 12a70c867e88379c520c64882ca2b261b9e9559d
+M 148f59425afbe5c95786d5f65912cd7c3c1fcc9c
 M 15185954d24578b3a848afe5bf258d9774ff03b6
 M 16df606f5ea05ad8fe5c3ab54cc4e3684067d84d
 M 1820f1a94b08ba840c3868ac3e1f3b7751540a08

[cxf] 02/03: Some dependency updates

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit ed26fd6789405690490b766bb9d1f3d888e1cfc3
Author: Daniel Kulp <dk...@apache.org>
AuthorDate: Wed Sep 29 13:34:20 2021 -0400

    Some dependency updates
    
    (cherry picked from commit 0dad051a0f126b1e365f83dfe1e4647a36e163f9)
    
    # Conflicts:
    #	parent/pom.xml
---
 parent/pom.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 3c60cce..748001c 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -79,7 +79,7 @@
         <cxf.abdera.osgi.version>1.1.3_2</cxf.abdera.osgi.version>
         <cxf.abdera.version>1.1.3</cxf.abdera.version>
         <cxf.activemq.version>5.16.3</cxf.activemq.version>
-        <cxf.ahc.version>2.12.2</cxf.ahc.version>
+        <cxf.ahc.version>2.12.3</cxf.ahc.version>
         <cxf.apacheds.version>2.0.0.AM26</cxf.apacheds.version>
         <cxf.arquillian.version>1.1.14.Final</cxf.arquillian.version>
         <cxf.arquillian.weld.container.version>2.0.1.Final</cxf.arquillian.weld.container.version>
@@ -88,7 +88,7 @@
         <cxf.atmosphere.version>2.6.1</cxf.atmosphere.version>
         <cxf.bcprov.version>1.69</cxf.bcprov.version>
         <cxf.brave.reporter.version>2.16.2</cxf.brave.reporter.version>
-        <cxf.brave.version>5.13.2</cxf.brave.version>
+        <cxf.brave.version>5.13.3</cxf.brave.version>
         <cxf.brave.zipkin.version>2.23.0</cxf.brave.zipkin.version>
         <cxf.cda.api.osgi.range>[1.1,2)</cxf.cda.api.osgi.range>
         <cxf.cdi.api.version>2.0.2</cxf.cdi.api.version>
@@ -96,9 +96,9 @@
         <cxf.classmate.version>1.5.1</cxf.classmate.version>
         <cxf.commons-codec.version>1.15</cxf.commons-codec.version>
         <cxf.commons-collections.version>3.2.2</cxf.commons-collections.version>
-        <cxf.commons-io.version>2.10.0</cxf.commons-io.version>
+        <cxf.commons-io.version>2.11.0</cxf.commons-io.version>
         <cxf.commons-jcs-jcache.version>2.1</cxf.commons-jcs-jcache.version>
-        <cxf.commons-lang3.version>3.11</cxf.commons-lang3.version>
+        <cxf.commons-lang3.version>3.12.0</cxf.commons-lang3.version>
         <cxf.commons-logging.version>1.2</cxf.commons-logging.version>
         <cxf.commons-text.version>1.9</cxf.commons-text.version>
         <cxf.derby.version>10.14.2.0</cxf.derby.version>
@@ -153,7 +153,7 @@
         <cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>
         <cxf.jexl.version>3.1</cxf.jexl.version>
         <cxf.joda.time.version>2.10.10</cxf.joda.time.version>
-        <cxf.johnzon.version>1.2.11</cxf.johnzon.version>
+        <cxf.johnzon.version>1.2.14</cxf.johnzon.version>
         <cxf.json.api.version>1.1.6</cxf.json.api.version>
         <cxf.json.bind-api.version>1.0.2</cxf.json.bind-api.version>
         <cxf.jsr250.api.version>1.0</cxf.jsr250.api.version>
@@ -230,7 +230,7 @@
 
         <!-- various OSGi related versions -->
         <cxf.aries.api.version>1.0.1</cxf.aries.api.version>
-        <cxf.aries.core.version>1.10.2</cxf.aries.core.version>
+        <cxf.aries.core.version>1.10.3</cxf.aries.core.version>
         <cxf.aries.fly.version>1.2</cxf.aries.fly.version>
         <cxf.aries.parser.version>1.6.1</cxf.aries.parser.version>
         <cxf.aries.version.range>[1.0,2)</cxf.aries.version.range>