You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/10/23 19:37:50 UTC
svn commit: r587566 - in /incubator/cxf/branches/2.0.x-fixes: ./
rt/core/src/main/java/org/apache/cxf/interceptor/
systests/src/test/java/org/apache/cxf/systest/jaxws/
Author: dkulp
Date: Tue Oct 23 10:37:49 2007
New Revision: 587566
URL: http://svn.apache.org/viewvc?rev=587566&view=rev
Log:
Merged revisions 587537 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r587537 | dkulp | 2007-10-23 11:18:17 -0400 (Tue, 23 Oct 2007) | 2 lines
[CXF-1131] If getFaultInfo returns null, (xsi:nil=true on the wire), ClientFaultConverter throws a NPE.
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServiceTestFault.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=587566&r1=587565&r2=587566&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java Tue Oct 23 10:37:49 2007
@@ -24,6 +24,8 @@
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -33,6 +35,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.DataReader;
@@ -53,6 +56,7 @@
* @author Dan Diephouse
*/
public class ClientFaultConverter extends AbstractPhaseInterceptor<Message> {
+ private static final Logger LOG = LogUtils.getLogger(ClientFaultConverter.class);
public ClientFaultConverter() {
super(Phase.UNMARSHAL);
@@ -118,16 +122,22 @@
}
if (!(e instanceof Exception)) {
- Class<?> exClass = faultWanted.getProperty(Class.class.getName(), Class.class);
- Class<?> beanClass = e.getClass();
+
try {
- Constructor constructor = exClass.getConstructor(new Class[]{String.class, beanClass});
- e = constructor.newInstance(new Object[]{fault.getMessage(), e});
+ Class<?> exClass = faultWanted.getProperty(Class.class.getName(), Class.class);
+ if (e == null) {
+ Constructor constructor = exClass.getConstructor(new Class[]{String.class});
+ e = constructor.newInstance(new Object[]{fault.getMessage()});
+ } else {
+ Class<?> beanClass = e.getClass();
+ Constructor constructor = exClass.getConstructor(new Class[]{String.class, beanClass});
+ e = constructor.newInstance(new Object[]{fault.getMessage(), e});
+ }
+ msg.setContent(Exception.class, e);
} catch (Exception e1) {
- throw new Fault(e1);
+ LogUtils.log(LOG, Level.INFO, "EXCEPTION_WHILE_CREATING_EXCEPTION", e1, e1.getMessage());
}
}
- msg.setContent(Exception.class, e);
}
private boolean isDOMSupported(DataBinding db) {
Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties?rev=587566&r1=587565&r2=587566&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties Tue Oct 23 10:37:49 2007
@@ -36,3 +36,5 @@
COULD_NOT_CREATE_ANNOTATION_OBJECT=Could not create annotation object: {0}
COULD_NOT_FIND_SEICLASS=Could not find the class: {0}
EXCEPTION_WHILE_WRITING_FAULT = Exception occurred while writing fault.
+EXCEPTION_WHILE_CREATING_EXCEPTION = Exception occurred while creating exception: {0}
+
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=587566&r1=587565&r2=587566&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Tue Oct 23 10:37:49 2007
@@ -311,6 +311,13 @@
} catch (ServiceTestFault ex) {
assertEquals(10, ex.getFaultInfo().getId());
}
+ // CXF-1131 testcase
+ try {
+ port.throwException(-1);
+ fail("Expected exception not found");
+ } catch (ServiceTestFault ex) {
+ assertNull(ex.getFaultInfo());
+ }
}
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java?rev=587566&r1=587565&r2=587566&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java Tue Oct 23 10:37:49 2007
@@ -119,6 +119,9 @@
}
public int throwException(int i) throws ServiceTestFault {
+ if (i == -1) {
+ throw new ServiceTestFault("Hello!");
+ }
throw new ServiceTestFault(new ServiceTestFault.ServiceTestDetails(i));
}
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServiceTestFault.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServiceTestFault.java?rev=587566&r1=587565&r2=587566&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServiceTestFault.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServiceTestFault.java Tue Oct 23 10:37:49 2007
@@ -24,6 +24,10 @@
@WebFault()
public class ServiceTestFault extends Exception {
private ServiceTestDetails details;
+
+ public ServiceTestFault(String msg) {
+ super(msg);
+ }
public ServiceTestFault(String msg, ServiceTestDetails details) {
super(msg);
this.details = details;