cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: Moxy wraps some of the XMLStreamExceptions an extra layer deep.
Date Wed, 16 Jul 2014 17:18:48 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 8bf20a7f2 -> 877b14d08


Moxy wraps some of the XMLStreamExceptions an extra layer deep.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/877b14d0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/877b14d0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/877b14d0

Branch: refs/heads/master
Commit: 877b14d0866a0d6e08b54662d23fc5fd4eb60e73
Parents: 8bf20a7
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Jul 16 13:03:45 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Jul 16 13:03:45 2014 -0400

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/provider/AbstractJAXBProvider.java | 12 ++++++++++--
 .../systest/jaxrs/JAXRSClientServerSpringBookTest.java  |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/877b14d0/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
index ff6d5a7..74646a6 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
@@ -82,6 +82,7 @@ import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.jaxrs.utils.schemas.SchemaHandler;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.staxutils.DepthExceededStaxException;
 import org.apache.cxf.staxutils.DepthRestrictingStreamReader;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.staxutils.DocumentDepthProperties;
@@ -731,8 +732,15 @@ public abstract class AbstractJAXBProvider<T> extends AbstractConfigurableProvid
         StringBuilder sb = handleExceptionStart(e);
         Throwable linked = e.getLinkedException();
         if (linked != null && linked.getMessage() != null) {
-            if (read && linked instanceof XMLStreamException && linked.getMessage().startsWith("Maximum
Number")) {
-                throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413));

+            Throwable cause = linked;
+            while (read && cause != null) {
+                if (cause instanceof XMLStreamException && cause.getMessage().startsWith("Maximum
Number")) {
+                    throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413));

+                }
+                if (cause instanceof DepthExceededStaxException) {
+                    throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413));

+                }
+                cause = cause.getCause();
             }
             sb.append(linked.getMessage()).append(". ");
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/877b14d0/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
index f2da064..133c0f0 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
@@ -844,7 +844,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
         Response r = wc.post(is);
         assertEquals(400, r.getStatus());
         String content = IOUtils.readStringFromStream((InputStream)r.getEntity());
-        assertTrue(content.contains("Invalid content was found starting with element 'id'"));
+        assertTrue(content, content.contains("Invalid content was found starting with element"));
     }
     
     private void doPost(String endpointAddress, int expectedStatus, String contentType,


Mime
View raw message