cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1549628 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Date Mon, 09 Dec 2013 17:46:45 GMT
Author: sergeyb
Date: Mon Dec  9 17:46:45 2013
New Revision: 1549628

URL: http://svn.apache.org/r1549628
Log:
Merged revisions 1549623 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1549623 | sergeyb | 2013-12-09 17:31:10 +0000 (Mon, 09 Dec 2013) | 1 line
  
  [CXF-5447] Checking for empty byte arrays to prevent POST issues over HTTPUrlConnection
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1549623

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1549628&r1=1549627&r2=1549628&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Mon Dec  9 17:46:45 2013
@@ -1015,12 +1015,15 @@ public abstract class AbstractClient imp
     }
 
     protected Object checkIfBodyEmpty(Object body) {
+        //CHECKSTYLE:OFF
         if (body != null 
             && (body.getClass() == String.class && ((String)body).length()
== 0 
             || body.getClass() == Form.class && ((Form)body).getData().isEmpty()
-            || Map.class.isAssignableFrom(body.getClass()) && ((Map<?, ?>)body).isEmpty()))
{
+            || Map.class.isAssignableFrom(body.getClass()) && ((Map<?, ?>)body).isEmpty()

+            || body instanceof byte[] && ((byte[])body).length == 0)) {
             body = null;
         }
+        //CHECKSTYLE:ON
         return body;
     }
     

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1549628&r1=1549627&r2=1549628&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Mon Dec  9 17:46:45 2013
@@ -1051,6 +1051,16 @@ public class JAXRSClientServerBookTest e
     }
     
     @Test
+    public void testEmptyPostBytes() throws Exception {
+        WebClient wc = 
+            WebClient.create("http://localhost:" 
+                             + PORT + "/bookstore/emptypost");
+        Response response = wc.post(new byte[]{});
+        assertEquals(204, response.getStatus());
+        assertNull(response.getMetadata().getFirst("Content-Type"));
+    }
+    
+    @Test
     public void testEmptyPut() throws Exception {
         WebClient wc = 
             WebClient.create("http://localhost:" 



Mime
View raw message