cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor update to AbstractClient
Date Fri, 13 Jan 2017 12:09:29 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes a25fda846 -> 1b06c1efa


Minor update to AbstractClient


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

Branch: refs/heads/3.0.x-fixes
Commit: 1b06c1efacf751ed6d4a5214ecc297e3249e72a5
Parents: a25fda8
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Jan 13 11:59:04 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Fri Jan 13 12:09:13 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/client/AbstractClient.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1b06c1ef/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
index 0c9759e..3053e41 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
@@ -972,9 +972,10 @@ public abstract class AbstractClient implements Client {
             m.put(Message.REQUEST_URI, requestURIProperty.toString());
         }
         
-        m.put(Message.CONTENT_TYPE, headers.getFirst(HttpHeaders.CONTENT_TYPE));
+        String ct = headers.getFirst(HttpHeaders.CONTENT_TYPE);
+        m.put(Message.CONTENT_TYPE, ct);
         
-        body = checkIfBodyEmpty(body);
+        body = checkIfBodyEmpty(body, ct);
         setEmptyRequestPropertyIfNeeded(m, body);    
         
         m.setContent(List.class, getContentsList(body));
@@ -1019,12 +1020,13 @@ public abstract class AbstractClient implements Client {
     }
 
     
-    protected Object checkIfBodyEmpty(Object body) {
+    protected Object checkIfBodyEmpty(Object body, String contentType) {
         //CHECKSTYLE:OFF
         if (body != null 
             && (body.getClass() == String.class && ((String)body).length()
== 0 
             || body.getClass() == Form.class && ((Form)body).asMap().isEmpty()
-            || Map.class.isAssignableFrom(body.getClass()) && ((Map<?, ?>)body).isEmpty()

+            || Map.class.isAssignableFrom(body.getClass()) && ((Map<?, ?>)body).isEmpty()
+                && !MediaType.APPLICATION_JSON.equals(contentType)
             || body instanceof byte[] && ((byte[])body).length == 0)) {
             body = null;
         }


Mime
View raw message