[jbossws-commits] JBossWS SVN: r18860 - in stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf: client/serviceref and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Aug 25 06:35:57 EDT 2014


Author: asoldano
Date: 2014-08-25 06:35:56 -0400 (Mon, 25 Aug 2014)
New Revision: 18860

Modified:
   stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
   stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java
Log:
[JBWS-3820] Throw meaningfull exception when JAX-WS 2.2 Service constructors are required


Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java	2014-08-23 15:15:44 UTC (rev 18859)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java	2014-08-25 10:35:56 UTC (rev 18860)
@@ -33,6 +33,7 @@
 import org.jboss.logging.Cause;
 import org.jboss.logging.Message;
 import org.jboss.logging.MessageBundle;
+import org.jboss.wsf.spi.WSFException;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.WSFDeploymentException;
 
@@ -221,4 +222,6 @@
     @Message(id = 24101, value = "Could not find endpoint config name: %s")
     WSFDeploymentException couldNotFindEndpointConfigName(String name);
     
+    @Message(id = 24104, value = "Service class %s is missing required JAX-WS 2.2 additional constructors")
+    WSFException missingJAXWS22ServiceConstructor(String className, @Cause Throwable cause);
 }

Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java	2014-08-23 15:15:44 UTC (rev 18859)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java	2014-08-25 10:35:56 UTC (rev 18860)
@@ -250,7 +250,7 @@
    }
 
    private Service instantiateService(final UnifiedServiceRefMetaData serviceRefMD, final Class<?> serviceClass)
-         throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
+         throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, WSFException
    {
       final WebServiceFeature[] features = getFeatures(serviceRefMD);
       final QName serviceQName = this.getServiceQName(serviceRefMD, serviceClass);
@@ -297,10 +297,12 @@
          {
             if (features != null)
             {
-               Constructor<?> ctor = serviceClass.getConstructor(new Class[]
-               {URL.class, QName.class, WebServiceFeature[].class});
-               target = (Service) ctor.newInstance(new Object[]
-               {wsdlURL, serviceQName, features});
+               try {
+                  Constructor<?> ctor = serviceClass.getConstructor(new Class[] {URL.class, QName.class, WebServiceFeature[].class});
+                  target = (Service) ctor.newInstance(new Object[] {wsdlURL, serviceQName, features});
+               } catch (NoSuchMethodException nsme) {
+                  throw org.jboss.wsf.stack.cxf.Messages.MESSAGES.missingJAXWS22ServiceConstructor(serviceClass.getName(), nsme);
+               }
             }
             else
             {
@@ -314,10 +316,12 @@
          {
             if (features != null)
             {
-               Constructor<?> ctor = serviceClass.getConstructor(new Class[]
-               {WebServiceFeature[].class});
-               target = (Service) ctor.newInstance(new Object[]
-               {features});
+               try {
+                  Constructor<?> ctor = serviceClass.getConstructor(new Class[] {WebServiceFeature[].class});
+                  target = (Service) ctor.newInstance(new Object[] {features});
+               } catch (NoSuchMethodException nsme) {
+                  throw org.jboss.wsf.stack.cxf.Messages.MESSAGES.missingJAXWS22ServiceConstructor(serviceClass.getName(), nsme);
+               }
             }
             else
             {



More information about the jbossws-commits mailing list