Author: bimargulies
Date: Thu Nov 20 04:59:47 2008
New Revision: 719222

URL: http://svn.apache.org/viewvc?rev=719222&view=rev
Log:
CXF-1923, improve error message for @SOAPBinding(style=RPC) on a method.

Added:
    
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java
   (with props)
Modified:
    
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties

Added: 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java?rev=719222&view=auto
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java
 (added)
+++ 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java
 Thu Nov 20 04:59:47 2008
@@ -0,0 +1,51 @@
+/**
+ * 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.jaxws;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.i18n.UncheckedException;
+
+/**
+ * This exception is thrown when CXF discovers inconsistent or unsupported 
JAX-WS annotations. 
+ */
+public class JaxWsConfigurationException extends UncheckedException {
+
+    /**
+     * @param msg
+     */
+    public JaxWsConfigurationException(Message msg) {
+        super(msg);
+    }
+
+    /**
+     * @param msg
+     * @param t
+     */
+    public JaxWsConfigurationException(Message msg, Throwable t) {
+        super(msg, t);
+    }
+
+    /**
+     * @param cause
+     */
+    public JaxWsConfigurationException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=719222&r1=719221&r2=719222&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
 (original)
+++ 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
 Thu Nov 20 04:59:47 2008
@@ -46,10 +46,12 @@
 import javax.xml.ws.WebFault;
 
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxws.JaxWsConfigurationException;
 import org.apache.cxf.service.factory.AbstractServiceConfiguration;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
@@ -672,11 +674,9 @@
 
         SOAPBinding ann = m.getAnnotation(SOAPBinding.class);
         if (ann != null) {
-            if (ann.style().equals(Style.RPC)) {        
-                throw new Fault(new RuntimeException("Method [" 
-                                                     + m.getName() 
-                                                     + "] processing error: " 
-                                                     + "SOAPBinding can not on 
method with RPC style"));
+            if (ann.style().equals(Style.RPC)) { 
+                Message message = new Message("SOAPBinding_MESSAGE_RPC", LOG, 
m.getName());
+                throw new Fault(new JaxWsConfigurationException(message));
             }
             return !(ann.parameterStyle().equals(ParameterStyle.BARE));
         }

Modified: 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties?rev=719222&r1=719221&r2=719222&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
 (original)
+++ 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
 Thu Nov 20 04:59:47 2008
@@ -25,5 +25,6 @@
 MALFORMED_URL_IN_WEBSERVICE_ANNOTATION_EXC = Malformed url in @WebService 
annotation attribute wsdlLocation.
 LOAD_WSDL_EXC = Could not load WSDL from URL {0}.
 COULD_NOT_FIND_ENDPOINT = Could not find endpoint named {0}.  Possible values 
are {1}.
+SOAPBinding_MESSAGE_RPC= JAX-WS SOAPBinding annotation with Style of RPC found 
on method {0}. This is not supported.
 INVALID_REQUEST_WRAPPER = @RequestWrapper class {0} is the same as the actual 
parameter {1}.  This is likely not to work. 
 INVALID_RESPONSE_WRAPPER = @ResponseWrapper class {0} is the same as the 
actual return class {1}.  This is likely not to work. 


Reply via email to