You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/03/12 15:38:07 UTC

[cxf] branch 3.3.x-fixes updated (9853d09 -> 7e512fb)

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

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


    from 9853d09  CXF-8235 Handle null continuation in AsyncResponseImpl instead of throwing a NullPointerException (#649)
     new 2923c9f  Update to microprofile.rest.client 1.4.1
     new eeae6cd  CXF-8234 - Add the encoding to the TransformOutInterceptor XMLStreamWriter
     new 7e512fb  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                                      |  3 ++
 .../transform/TransformOutInterceptor.java         | 23 ++++++++++++++-
 .../cxf/staxutils/transform/TransformUtils.java    | 27 ++++++++++++++++--
 parent/pom.xml                                     |  2 +-
 .../org/apache/cxf/systest/jaxrs/BookStore.java    |  5 ++--
 systests/microprofile/client/weld/pom.xml          | 33 ++++++++++++++++++++--
 6 files changed, 84 insertions(+), 9 deletions(-)


[cxf] 03/03: Recording .gitmergeinfo Changes

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

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

commit 7e512fb562400fd98171b15d3f9e24e3cab9f42a
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Mar 12 14:21:03 2020 +0000

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

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 162929b..5b3ff89 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -87,6 +87,7 @@ B 7689d884a64db0352cdb1ac9ee0628a26491f35a
 B 7b333d06910b3d4a84dd77a3c76b48d1b44525b3
 B 7f20ddfabf5b2ed4c84b1ae6a1cac715f8d6b076
 B 80b32bb41504ecf23eaafb1d62aac8c9c3f5d405
+B 85b048e674b16541cf6a4a35ea96a7d1081faca9
 B 85ba0e6e65374df37b253f32a183b336b6d64991
 B 8723ff4f63020ba966268561b689fd9eb4349fda
 B 88871e7b3becec513eeec7eb215ee1cb7d02bc3d
@@ -127,6 +128,7 @@ B c9a2275276c6f8099585519372c24fda1cd7c3e0
 B cc4ea93826655c45eb5dd65290300ee42fe8d596
 B cdf7685cf7a7583ee076e97706d82d5271f582b1
 B d076d4494d96d268a196d4d48602b36d7086680d
+B d34a270473c308bd8f51d4a518ea7933a1db4e46
 B d4d4b1e740a48103811e33094adb19d5c22ca108
 B da4dfeed6867ed628dc05c9a2dbedbebdf33db21
 B de03dfae71010bd3719430d8d7453732f4c151ea
@@ -176,6 +178,7 @@ M 69b805a97fa96716c8f76278e577ba122c2727e2
 M 6b7e50b87d74dc6b7d1e830b373c7e30c04e14a2
 M 6e828d6f0fea652231d0cdc9990169c3583ad03a
 M 79466c55a2a1191df9c28a02568b82a8c3d08fbd
+M 7971b506283502c26aafb97c0f6e50633f126cdd
 M 7b50181ebc445bb84d3463b284643432399bc0f8
 M 7ef814556d727c147d6f625cbb1170edfd24a752
 M 92a00fc05e2437d2d0cf98099060ba4e1f6dac99


[cxf] 01/03: Update to microprofile.rest.client 1.4.1

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

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

commit 2923c9f6f96bfee85132ba32b3364652d959f9ee
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Wed Mar 11 10:14:56 2020 +0300

    Update to microprofile.rest.client 1.4.1
    
    (cherry picked from commit 7971b506283502c26aafb97c0f6e50633f126cdd)
    
    # Conflicts:
    #	parent/pom.xml
---
 parent/pom.xml                            |  2 +-
 systests/microprofile/client/weld/pom.xml | 33 ++++++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index d5c3535..b469580 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -161,7 +161,7 @@
         <cxf.lucene.version>4.9.1</cxf.lucene.version>
         <cxf.maven.core.version>3.6.2</cxf.maven.core.version>
         <cxf.microprofile.config.version>1.1</cxf.microprofile.config.version>
-        <cxf.microprofile.rest.client.version>1.4.0</cxf.microprofile.rest.client.version>
+        <cxf.microprofile.rest.client.version>1.4.1</cxf.microprofile.rest.client.version>
         <cxf.mina.version>2.0.21</cxf.mina.version>
         <cxf.mockito.version>2.28.1</cxf.mockito.version>
         <cxf.msv.version>2013.6.1</cxf.msv.version>
diff --git a/systests/microprofile/client/weld/pom.xml b/systests/microprofile/client/weld/pom.xml
index 8629300..39b2d47 100644
--- a/systests/microprofile/client/weld/pom.xml
+++ b/systests/microprofile/client/weld/pom.xml
@@ -92,10 +92,34 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>reserve-network-port</id>
+                        <goals>
+                            <goal>reserve-network-port</goal>
+                        </goals>
+                        <phase>initialize</phase>
+                        <configuration>
+                            <portNames>
+                                <portName>wiremock.server.port</portName>
+                            </portNames>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>uk.co.automatictester</groupId>
                 <artifactId>wiremock-maven-plugin</artifactId>
-                <!-- Note, updating to 4.4.1 causes a weird Xalan error when building the distribution -->
-                <version>4.4.0</version>
+                <version>6.0.0</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>com.github.tomakehurst</groupId>
+                        <artifactId>wiremock</artifactId>
+                        <version>2.26.3</version>
+                    </dependency>
+                </dependencies>
                 <executions>
                     <execution>
                         <phase>generate-test-sources</phase>
@@ -104,7 +128,7 @@
                         </goals>
                         <configuration>
                             <dir>${project.build.outputDirectory}</dir>
-                            <params>${cxf.wiremock.params}</params>
+                            <params>--port ${wiremock.server.port}</params>
                         </configuration>
                     </execution>
                 </executions>
@@ -118,6 +142,9 @@
                     <suiteXmlFiles>
                         <suiteXmlFile>testng.xml</suiteXmlFile>
                     </suiteXmlFiles>
+                    <systemPropertyVariables>
+                        <wiremock.server.port>${wiremock.server.port}</wiremock.server.port>
+                    </systemPropertyVariables>
                 </configuration>
             </plugin>
         </plugins>


[cxf] 02/03: CXF-8234 - Add the encoding to the TransformOutInterceptor XMLStreamWriter

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

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

commit eeae6cde0faedd144a8cb5bdcd21326f7dc6056b
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Mar 11 14:18:54 2020 +0000

    CXF-8234 - Add the encoding to the TransformOutInterceptor XMLStreamWriter
    
    (cherry picked from commit 36111759cd4534a395750eb5b17ebfec3c60287d)
---
 .../transform/TransformOutInterceptor.java         | 23 +++++++++++++++++-
 .../cxf/staxutils/transform/TransformUtils.java    | 27 ++++++++++++++++++++--
 .../org/apache/cxf/systest/jaxrs/BookStore.java    |  5 ++--
 3 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
index 505c3d1..ba3a242 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
@@ -21,6 +21,7 @@ package org.apache.cxf.interceptor.transform;
 
 
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Map;
 
@@ -28,10 +29,12 @@ import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.interceptor.StaxOutEndingInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.staxutils.transform.TransformUtils;
 
 import static org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION;
@@ -109,14 +112,32 @@ public class TransformOutInterceptor extends AbstractPhaseInterceptor<Message> {
         }
     }
 
+    private String getEncoding(Message message) {
+        Exchange ex = message.getExchange();
+        String encoding = (String)message.get(Message.ENCODING);
+        if (encoding == null && ex.getInMessage() != null) {
+            encoding = (String) ex.getInMessage().get(Message.ENCODING);
+            message.put(Message.ENCODING, encoding);
+        }
+
+        if (encoding == null) {
+            encoding = StandardCharsets.UTF_8.name();
+            message.put(Message.ENCODING, encoding);
+        }
+        return encoding;
+    }
+
     protected XMLStreamWriter createTransformWriterIfNeeded(XMLStreamWriter writer, OutputStream os) {
+        Message m = PhaseInterceptorChain.getCurrentMessage();
+        String encoding = getEncoding(m);
         return TransformUtils.createTransformWriterIfNeeded(writer, os,
                                                       outElementsMap,
                                                       outDropElements,
                                                       outAppendMap,
                                                       outAttributesMap,
                                                       attributesToElements,
-                                                      defaultNamespace);
+                                                      defaultNamespace,
+                                                      encoding);
     }
 
     public void setOutTransformElements(Map<String, String> outElements) {
diff --git a/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java b/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
index 04a146f..e2c856b 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
@@ -43,7 +43,16 @@ public final class TransformUtils {
     }
 
     public static XMLStreamWriter createNewWriterIfNeeded(XMLStreamWriter writer, OutputStream os) {
-        return writer == null ? StaxUtils.createXMLStreamWriter(os) : writer;
+        return createNewWriterIfNeeded(writer, os, null);
+    }
+
+    public static XMLStreamWriter createNewWriterIfNeeded(XMLStreamWriter writer, OutputStream os, String encoding) {
+        if (writer != null) {
+            return writer;
+        } else if (encoding != null) {
+            return StaxUtils.createXMLStreamWriter(os, encoding);
+        }
+        return StaxUtils.createXMLStreamWriter(os);
     }
 
     public static XMLStreamWriter createTransformWriterIfNeeded(XMLStreamWriter writer,
@@ -70,9 +79,23 @@ public final class TransformUtils {
                                                                 Map<String, String> outAttributesMap,
                                                                 boolean attributesToElements,
                                                                 String defaultNamespace) {
+        return createTransformWriterIfNeeded(writer, os, outElementsMap, outDropElements,
+                                             outAppendMap, outAttributesMap, attributesToElements,
+                                             defaultNamespace, null);
+    }
+
+    public static XMLStreamWriter createTransformWriterIfNeeded(XMLStreamWriter writer,
+                                                                OutputStream os,
+                                                                Map<String, String> outElementsMap,
+                                                                List<String> outDropElements,
+                                                                Map<String, String> outAppendMap,
+                                                                Map<String, String> outAttributesMap,
+                                                                boolean attributesToElements,
+                                                                String defaultNamespace,
+                                                                String encoding) {
         if (outElementsMap != null || outDropElements != null
             || outAppendMap != null || attributesToElements) {
-            writer = new OutTransformWriter(createNewWriterIfNeeded(writer, os), outElementsMap, outAppendMap,
+            writer = new OutTransformWriter(createNewWriterIfNeeded(writer, os, encoding), outElementsMap, outAppendMap,
                                             outDropElements, outAttributesMap, attributesToElements, defaultNamespace);
         }
         return writer;
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
index 17898b9..6418293 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
@@ -1509,7 +1509,8 @@ public class BookStore {
         String ct1 = httpHeaders.getMediaType().toString();
         String ct2 = httpHeaders.getRequestHeader("Content-Type").get(0);
         String ct3 = httpHeaders.getRequestHeaders().getFirst("Content-Type");
-        if (!("application/xml".equals(ct1) && ct1.equals(ct2) && ct1.equals(ct3))) {
+        if (!(ct1.startsWith("application/xml") && ct2.startsWith("application/xml")
+            && ct3.startsWith("application/xml"))) {
             throw new RuntimeException("Unexpected content type");
         }
 
@@ -1704,7 +1705,7 @@ public class BookStore {
         return Response.accepted(name).build();
     }
 
-    
+
     @POST
     @Path("/empty202")
     @Consumes("text/plain")