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

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


The following commit(s) were added to refs/heads/3.4.x-fixes by this push:
     new 5846b24  [CXF-8533]ensure an endpoint destination which is still in 
use won't be shutdown inproperly - Part II
5846b24 is described below

commit 5846b2432b2c697a781e8356e0ddc1439f4603e7
Author: Manuel Shenavai <[email protected]>
AuthorDate: Tue May 4 21:02:15 2021 +0200

    [CXF-8533]ensure an endpoint destination which is still in use won't be 
shutdown inproperly - Part II
    
    (cherry picked from commit 6253eb1f9dd052293b5f55429b7803de1e53642e)
---
 .../endpoint/ListenerRegistrationException.java    | 26 ++++++++++++++++++++++
 .../java/org/apache/cxf/endpoint/ServerImpl.java   | 12 +++++-----
 .../cxf/binding/soap/SoapBindingFactory.java       |  3 ++-
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git 
a/core/src/main/java/org/apache/cxf/endpoint/ListenerRegistrationException.java 
b/core/src/main/java/org/apache/cxf/endpoint/ListenerRegistrationException.java
new file mode 100644
index 0000000..296cd4a
--- /dev/null
+++ 
b/core/src/main/java/org/apache/cxf/endpoint/ListenerRegistrationException.java
@@ -0,0 +1,26 @@
+/**
+ * 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.endpoint;
+
+public class ListenerRegistrationException extends RuntimeException {
+    public ListenerRegistrationException(String message) {
+        super(message);
+    }
+}
diff --git a/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java 
b/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
index c417cb6..15d6521 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
@@ -125,15 +125,13 @@ public class ServerImpl implements Server {
             return;
         }
         LOG.fine("Server is starting.");
-        
+
         try {
             bindingFactory.addListener(destination, endpoint);
-        } catch (RuntimeException e) {
-            if (e.getMessage().contains("endpoint already registered on 
address")) {
-                //this destination is used by another endpoint with same 
endpoint address
-                //so shouldn't be destroyed by this server
-                this.destroyDest = false;
-            }
+        } catch (ListenerRegistrationException e) {
+            //this destination is used by another endpoint with same endpoint 
address
+            //so shouldn't be destroyed by this server
+            this.destroyDest = false;
             throw e;
         }
 
diff --git 
a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
 
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
index cc7986b..f9a0e60 100644
--- 
a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
+++ 
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
@@ -76,6 +76,7 @@ import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.ListenerRegistrationException;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
@@ -916,7 +917,7 @@ public class SoapBindingFactory extends 
AbstractWSDLBindingFactory {
                         
.equals(((org.apache.cxf.binding.soap.SoapBinding)b2).getSoapVersion())
                     && Boolean.FALSE.equals(o)) {
 
-                    throw new RuntimeException("Soap "
+                    throw new ListenerRegistrationException("Soap "
                                                + 
((org.apache.cxf.binding.soap.SoapBinding)b)
                                                    
.getSoapVersion().getVersion()
                                                + " endpoint already registered 
on address "

Reply via email to