cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1221519 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Tue, 20 Dec 2011 23:19:17 GMT
Author: sergeyb
Date: Tue Dec 20 23:19:17 2011
New Revision: 1221519

URL: http://svn.apache.org/viewvc?rev=1221519&view=rev
Log:
[CXF-3987] Checking Content-Id in case of missing Content-Disposition

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=1221519&r1=1221518&r2=1221519&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java Tue
Dec 20 23:19:17 2011
@@ -150,10 +150,10 @@ public final class FormUtils {
         List<Attachment> atts = body.getAllAttachments();
         for (Attachment a : atts) {
             ContentDisposition cd = a.getContentDisposition();
-            if (cd == null || !MULTIPART_FORM_DATA_TYPE.equalsIgnoreCase(cd.getType())) {
+            if (cd != null && !MULTIPART_FORM_DATA_TYPE.equalsIgnoreCase(cd.getType()))
{
                 continue;
             }
-            String cdName = cd.getParameter("name");
+            String cdName = cd == null ? null : cd.getParameter("name");
             String contentId = a.getContentId();
             String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"",
"").replace("'", "");
             if (StringUtils.isEmpty(name)) { 

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1221519&r1=1221518&r2=1221519&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
Tue Dec 20 23:19:17 2011
@@ -336,8 +336,18 @@ public class JAXRSMultipartTest extends 
     }
     
     @Test
-    public void testNullableParams() throws Exception {
+    public void testNullableParamsMultipartAnnotation() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/books/testnullpart";
+        doTestNullPart(address);
+    }
+    
+    @Test
+    public void testNullableParamsFormParamAnnotation() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/books/testnullpartFormParam";
+        doTestNullPart(address);
+    }
+    
+    private void doTestNullPart(String address) throws Exception {
         WebClient client = WebClient.create(address);
         WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000);
         client.type("multipart/form-data").accept("text/plain");

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1221519&r1=1221518&r2=1221519&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Tue Dec 20 23:19:17 2011
@@ -156,6 +156,15 @@ public class MultipartStore {
     }
     
     @POST
+    @Path("/books/testnullpartFormParam")
+    @Consumes("multipart/form-data")
+    @Produces("text/plain")
+    public String testNullPartFormParam(@FormParam(value = "someid") String value) {
+        return testNullPart(value);
+    }
+    
+    
+    @POST
     @Path("/books/jaxbjsonimage")
     @Consumes("multipart/mixed")
     @Produces("multipart/mixed")



Mime
View raw message