cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1059970 - in /cxf/branches/2.3.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPException.java systests/transports/
Date Mon, 17 Jan 2011 16:16:43 GMT
Author: dkulp
Date: Mon Jan 17 16:16:42 2011
New Revision: 1059970

URL: http://svn.apache.org/viewvc?rev=1059970&view=rev
Log:
Merged revisions 1059511 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1059511 | cschneider | 2011-01-16 03:15:18 -0500 (Sun, 16 Jan 2011) | 1 line
  
  CXF-3249 Better handling of HTTP 401 responses and other HTTP error codes
........

Added:
    cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPException.java
      - copied unchanged from r1059511, cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPException.java
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/branches/2.3.x-fixes/systests/transports/   (props changed)

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1059970&r1=1059969&r2=1059970&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Mon Jan 17 16:16:42 2011
@@ -21,6 +21,7 @@ package org.apache.cxf.transport.http;
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -2246,11 +2247,13 @@ public class HTTPConduit 
                 }
             }
             
-            if (responseCode == HttpURLConnection.HTTP_NOT_FOUND
-                && !MessageUtils.isTrue(outMessage.getContextualProperty(
-                    "org.apache.cxf.http.no_io_exceptions"))) {
-                throw new IOException("HTTP response '" + responseCode + ": " 
-                    + connection.getResponseMessage() + "'");
+            // This property should be set in case the exceptions should not be handled here
+            // For example jax rs uses this
+            boolean noExceptions = MessageUtils.isTrue(outMessage.getContextualProperty(
+                "org.apache.cxf.http.no_io_exceptions"));
+            if (responseCode >= 400 && responseCode != 500 && !noExceptions)
{
+                throw new HTTPException(responseCode, connection.getResponseMessage(), 
+                                        connection.getURL());
             }
 
             
@@ -2322,8 +2325,10 @@ public class HTTPConduit 
                     in = connection.getInputStream();
                 }
             }
-            // if (in == null) : it's perfectly ok for non-soap http services
-            // have no response body : those interceptors which do need it will check anyway
       
+            if (in == null) {
+                // Create an empty stream to avoid NullPointerExceptions
+                in = new ByteArrayInputStream(new byte[] {});
+            }
             inMessage.setContent(InputStream.class, in);
             
             

Propchange: cxf/branches/2.3.x-fixes/systests/transports/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan 17 16:16:42 2011
@@ -8,3 +8,5 @@ eclipse-classes
 .project
 .wtpmodules
 
+
+activemq-data



Mime
View raw message