You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2024/11/10 21:17:54 UTC

(cxf) branch 3.5.x-fixes updated (1df0059f62 -> ee94278a50)

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

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


    from 1df0059f62 Recording .gitmergeinfo Changes
     new 390e52136f Bump org.webjars:swagger-ui from 5.17.14 to 5.18.1 (#2141)
     new d86e4ce316 CXF-9076: Exception message is not unmarshalled with JDK17+ (#2137)
     new ee94278a50 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 ++
 .../cxf/interceptor/ClientFaultConverter.java      | 25 +++++++++++---
 distribution/src/main/release/samples/pom.xml      |  2 +-
 parent/pom.xml                                     |  2 +-
 ...erver.java => ClientServerExceptionServer.java} | 20 ++++++++---
 .../systest/jaxws/ClientServerExceptionTest.java}  | 39 +++++++++-------------
 ...FirstSubService1.java => ExceptionService.java} |  6 ++--
 7 files changed, 59 insertions(+), 38 deletions(-)
 copy systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/{ArrayServiceServer.java => ClientServerExceptionServer.java} (61%)
 copy systests/{uncategorized/src/test/java/org/apache/cxf/systest/type_substitution/AppleFindClientServerTest.java => jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionTest.java} (58%)
 copy systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/{DocLitWrappedCodeFirstSubService1.java => ExceptionService.java} (89%)


(cxf) 03/03: Recording .gitmergeinfo Changes

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

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

commit ee94278a5031bd892c90b4b663da073ea65951bc
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Nov 10 15:02:29 2024 -0500

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

diff --git a/.gitmergeinfo b/.gitmergeinfo
index beb960feb6..d4f14b8e9e 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -74,6 +74,7 @@ B 22d817d86fb576479f6095a43d8f64521350b53d
 B 24143cf0fe15a9d6b8fcd435afeec6b91f61a47b
 B 242d9a76e6e9351e994b34960614bd65cf5eb1f8
 B 2438f7ebd983959935f5fb770caa4ad48ed3b0fb
+B 247de3b035aac013f12358fe8c746416506975ec
 B 251cda38688359b46545a5d814ed9b2b3b130097
 B 255e54cf8b3ba1372923cf61e405dbd875d977aa
 B 2595e3a39161fb2e07ad7e3411f7449ee9868601
@@ -259,6 +260,7 @@ B 805cfde2da7924f245807e3ac0c401268d02dd3e
 B 80e82a53cc4efe5eb9649de614c51fa07b5b8be3
 B 8111041aee68d5eaffdfef2495f28e89188ac64c
 B 8188f07e5a4111522d9f7db36c4e1990b5f64566
+B 81aa5a00617a19b784bba92b71e33f66d444b646
 B 81af252a18835f9118249eac2cc87abb4e9d3506
 B 823ae33b7724931f826bfe186ad79e5e87fd9190
 B 8252a18d68b994129a6adbcfe1330f67020eb4f0
@@ -1140,6 +1142,7 @@ M e60d84d2ad4a4e95be19eb5d326dcae1133eefb3
 M e621e802a612bd618a86bcef353dcda2ff3358f3
 M e67f566864e83c1c3811d057f7a77c498d32993a
 M e68ea9a96bf9cd0151fcdbebe87e84731c180e75
+M e6eae3c2110703c7598f615ecb563d80ebfac906
 M e6fd52bd53f8b16082d5532a7276b5165463a8a5
 M e80acb4df2793b98e8674965a548221b2d4a53b2
 M e82bb5c5d1300656d13f790e4f9547cd3ee88b23


(cxf) 01/03: Bump org.webjars:swagger-ui from 5.17.14 to 5.18.1 (#2141)

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

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

commit 390e52136f64e335217e5c07530d33d3256d9936
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Fri Nov 8 07:37:31 2024 -0500

    Bump org.webjars:swagger-ui from 5.17.14 to 5.18.1 (#2141)
    
    Bumps [org.webjars:swagger-ui](https://github.com/swagger-api/swagger-ui) from 5.17.14 to 5.18.1.
    - [Release notes](https://github.com/swagger-api/swagger-ui/releases)
    - [Changelog](https://github.com/swagger-api/swagger-ui/blob/master/.releaserc)
    - [Commits](https://github.com/swagger-api/swagger-ui/compare/v5.17.14...v5.18.1)
    
    ---
    updated-dependencies:
    - dependency-name: org.webjars:swagger-ui
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
    (cherry picked from commit 21ec58bf1e9ed621876b364d153405e44ea27a38)
    
    # Conflicts:
    #       distribution/src/main/release/samples/pom.xml
    (cherry picked from commit 93a2f9ccb79261ae4e8c0b7bec13d334b084bbcc)
    (cherry picked from commit e6eae3c2110703c7598f615ecb563d80ebfac906)
    
    # Conflicts:
    #       parent/pom.xml
---
 distribution/src/main/release/samples/pom.xml | 2 +-
 parent/pom.xml                                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/distribution/src/main/release/samples/pom.xml b/distribution/src/main/release/samples/pom.xml
index c3af18e916..78774e38de 100644
--- a/distribution/src/main/release/samples/pom.xml
+++ b/distribution/src/main/release/samples/pom.xml
@@ -35,7 +35,7 @@
         <cxf.jetty9.version>9.4.56.v20240826</cxf.jetty9.version>
         <cxf.netty.version>4.1.114.Final</cxf.netty.version>
         <cxf.httpcomponents.client.version>4.5.14</cxf.httpcomponents.client.version>
-        <cxf.swagger.ui.version>5.17.14</cxf.swagger.ui.version>
+        <cxf.swagger.ui.version>5.18.1</cxf.swagger.ui.version>
         <cxf.tika.version>2.9.1</cxf.tika.version>
         <cxf.tomcat.version>9.0.96</cxf.tomcat.version>
         <graalvm.version>21.1.0</graalvm.version>
diff --git a/parent/pom.xml b/parent/pom.xml
index 65adac9397..77696b4a29 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -213,7 +213,7 @@
         <cxf.spring.security.version>5.7.13</cxf.spring.security.version>
         <cxf.spring.version>5.3.39</cxf.spring.version>
         <cxf.stax-ex.version>1.8.3</cxf.stax-ex.version>
-        <cxf.swagger.ui.version>5.17.14</cxf.swagger.ui.version>
+        <cxf.swagger.ui.version>5.18.1</cxf.swagger.ui.version>
         <cxf.swagger.v3.version>2.1.13</cxf.swagger.v3.version>
         <cxf.swagger2.version>1.6.11</cxf.swagger2.version>
         <cxf.swagger2.guava.version>31.1-jre</cxf.swagger2.guava.version>


(cxf) 02/03: CXF-9076: Exception message is not unmarshalled with JDK17+ (#2137)

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

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

commit d86e4ce31645979e5165b8b19d5e5da7fcdad078
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Nov 10 14:45:32 2024 -0500

    CXF-9076: Exception message is not unmarshalled with JDK17+ (#2137)
    
    (cherry picked from commit 0e062b1e5b3658c0447a389da6d95fe662b97aeb)
---
 .../cxf/interceptor/ClientFaultConverter.java      | 25 ++++++++--
 .../systest/jaxws/ClientServerExceptionServer.java | 56 ++++++++++++++++++++++
 .../systest/jaxws/ClientServerExceptionTest.java   | 54 +++++++++++++++++++++
 .../apache/cxf/systest/jaxws/ExceptionService.java | 27 +++++++++++
 4 files changed, 158 insertions(+), 4 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java b/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
index e6b9f97705..c2c1f9c365 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
@@ -191,17 +191,34 @@ public class ClientFaultConverter extends AbstractInDatabindingInterceptor {
                 LogUtils.log(LOG, Level.INFO, "EXCEPTION_WHILE_CREATING_EXCEPTION", e1, e1.getMessage());
             }
         } else {
-            if (fault.getMessage() != null) {
+            Exception ex = (Exception)e; 
+            final String message = fault.getMessage();
+            if (message != null) {
                 Field f;
                 try {
                     f = Throwable.class.getDeclaredField("detailMessage");
                     ReflectionUtil.setAccessible(f);
-                    f.set(e, fault.getMessage());
+                    f.set(ex, fault.getMessage());
                 } catch (Exception e1) {
-                    //ignore
+                    try {
+                        // Fallback, try to clone the exception instead of accessing the detailMessage over reflection
+                        final Constructor<? extends Object> constructor = ReflectionUtil.getConstructor(ex.getClass(),
+                            String.class, Throwable.class); /* String message, Throwable cause */
+
+                        if (constructor != null) {
+                            final Exception clone = (Exception) constructor.newInstance(message, ex.getCause());
+                            clone.setStackTrace(ex.getStackTrace());
+                            if (ex.getSuppressed().length > 0) {
+                                Arrays.stream(ex.getSuppressed()).forEach(clone::addSuppressed);
+                            }
+                            ex = clone;
+                        }
+                    } catch (Exception e2) {
+                        /* nothing to do */
+                    }
                 }
             }
-            msg.setContent(Exception.class, e);
+            msg.setContent(Exception.class, ex);
         }
     }
 
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionServer.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionServer.java
new file mode 100644
index 0000000000..a20db6bd12
--- /dev/null
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionServer.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxws;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class ClientServerExceptionServer extends AbstractBusTestServerBase {
+    static final String PORT = allocatePort(ClientServerExceptionServer.class);
+
+    @WebService(endpointInterface = "org.apache.cxf.systest.jaxws.ExceptionService",
+        serviceName = "ExceptionService", targetNamespace = "http://cxf.apache.org/")
+    static class ExceptionServiceImpl implements ExceptionService {
+        @Override
+        public String saySomething(String text) throws IllegalArgumentException {
+            throw new IllegalArgumentException("Simulated!");
+        }
+    }
+
+    protected void run() {
+        Object implementor = new ExceptionServiceImpl();
+        String address = "http://localhost:" + PORT + "/ExceptionService";
+        Endpoint.publish(address, implementor);
+    }
+
+    public static void main(String[] args) {
+        try {
+            ClientServerExceptionServer s = new ClientServerExceptionServer();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+}
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionTest.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionTest.java
new file mode 100644
index 0000000000..d0e8fe499c
--- /dev/null
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerExceptionTest.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxws;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+
+public class ClientServerExceptionTest extends AbstractBusClientServerTestBase {
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(ClientServerExceptionServer.class, true));
+    }
+
+    @Test
+    public void exceptionMessageIsPreserved() throws MalformedURLException {
+        URL wsdlURL = new URL("http://localhost:" + ClientServerExceptionServer.PORT + "/ExceptionService?wsdl");
+        QName qname = new QName("http://cxf.apache.org/", "ExceptionService");
+        Service service = Service.create(wsdlURL, qname);
+        ExceptionService port = service.getPort(ExceptionService.class);
+
+        final IllegalArgumentException ex = assertThrows(IllegalArgumentException.class,
+            () -> port.saySomething("Hello World!"));
+        assertEquals("Simulated!", ex.getMessage());
+    }
+}
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ExceptionService.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ExceptionService.java
new file mode 100644
index 0000000000..fa2a525fa7
--- /dev/null
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ExceptionService.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxws;
+
+import javax.jws.WebService;
+
+@WebService
+interface ExceptionService {
+    String saySomething(String text) throws IllegalArgumentException;
+}