cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5851] Ignoring null attachments in client proxies
Date Fri, 04 Jul 2014 16:18:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 3997e7ad2 -> a84a73b9b


[CXF-5851] Ignoring null attachments in client proxies


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

Branch: refs/heads/2.7.x-fixes
Commit: a84a73b9b743fa229aa7ec4b3c22c185b7c6fe2c
Parents: 3997e7a
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jul 4 17:00:00 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jul 4 17:18:27 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/client/ClientProxyImpl.java    |  5 ++++-
 .../apache/cxf/systest/jaxrs/JAXRSMultipartTest.java    |  7 +++++++
 .../org/apache/cxf/systest/jaxrs/MultipartStore.java    | 12 ++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a84a73b9/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index 102d3d1..88ea621 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -563,7 +563,10 @@ public class ClientProxyImpl extends AbstractClient implements
         for (Parameter p : fm) {
             Multipart part = getMultipart(ori, p.getIndex());
             if (part != null) {
-                atts.add(new Attachment(part.value(), part.type(), params[p.getIndex()]));
+                Object objectPart = params[p.getIndex()];
+                if (objectPart != null) {   
+                    atts.add(new Attachment(part.value(), part.type(), objectPart));
+                }
             }
         }
         return atts;        

http://git-wip-us.apache.org/repos/asf/cxf/blob/a84a73b9/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
index b01a9c7..473ae5c 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
@@ -306,6 +306,13 @@ public class JAXRSMultipartTest extends AbstractBusClientServerTestBase
{
     }
     
     @Test
+    public void testNullPartProxy() throws Exception {
+        MultipartStore store = 
+            JAXRSClientFactory.create("http://localhost:" + PORT, MultipartStore.class);
+        assertEquals("nobody home2", store.testNullParts("value1", null));
+    }
+    
+    @Test
     public void testUseProxyToAddBookAndSimpleParts() throws Exception {
         MultipartStore store = 
             JAXRSClientFactory.create("http://localhost:" + PORT, MultipartStore.class);

http://git-wip-us.apache.org/repos/asf/cxf/blob/a84a73b9/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
index 70f90c1..39e580f 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
@@ -184,6 +184,18 @@ public class MultipartStore {
             return "nobody home";
         }
     }
+    @POST
+    @Path("/books/testnullparts")
+    @Consumes("multipart/form-data")
+    @Produces("text/plain")
+    public String testNullParts(@Multipart(value = "someid") String value,
+                                @Multipart(value = "someid2", required = false) String value2)
{
+        if (value2 != null) {
+            return value + value2;
+        } else {
+            return "nobody home2";
+        }
+    }
     
     @POST
     @Path("/books/testnullpartprimitive")


Mime
View raw message