You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2014/11/04 11:55:33 UTC

[jira] [Commented] (CXF-6076) MediaType parameter not parsed correctly

    [ https://issues.apache.org/jira/browse/CXF-6076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14195992#comment-14195992 ] 

Sergey Beryozkin commented on CXF-6076:
---------------------------------------

FYI, testTypeWithExtendedParametersQuote() test is invalid, it expects a parameter without the quotes, but indeed testTypeWithExtendedAndBoundaryParameter() was failing, fixed now, thanks

> MediaType parameter not parsed correctly 
> -----------------------------------------
>
>                 Key: CXF-6076
>                 URL: https://issues.apache.org/jira/browse/CXF-6076
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.10, 2.7.13, 3.0.2
>            Reporter: Ken Meyer
>             Fix For: 3.0.3, 2.7.14
>
>
> When MediaType parameter contains a plus symbol (+), the parameter is parse incorrectly. This appears to be the result of the RegEx Pattern, COMPLEX_PARAMETERS, used in class  org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.
> org.apache.cxf.jaxrs.impl.MediaTypeHeaderProviderTest
> Some test cases:
>     @Test
>     public void testTypeWithExtendedParameters() {
>         MediaType mt = MediaType.valueOf("multipart/related;type=application/dicom+xml");
>         
>         assertEquals("multipart", mt.getType());
>         assertEquals("related", mt.getSubtype());
>         Map<String, String> params2 = mt.getParameters();
>         assertEquals(1, params2.size());
>         assertEquals("application/dicom+xml", params2.get("type")); //SUCCESSFUL
>     }
>     @Test
>     public void testTypeWithExtendedParametersQuote() {
>         MediaType mt = MediaType.valueOf("multipart/related;type=\"application/dicom+xml\"");
>         
>         assertEquals("multipart", mt.getType());
>         assertEquals("related", mt.getSubtype());
>         Map<String, String> params2 = mt.getParameters();
>         assertEquals(1, params2.size());
>         assertEquals("application/dicom+xml", params2.get("type")); //FAIL
>     }    
>     
>     @Test
>     public void testTypeWithExtendedAndBoundaryParameter() {
>         MediaType mt = MediaType.valueOf("multipart/related; type=application/dicom+xml; boundary=\"uuid:b9aecb2a-ab37-48d6-a1cd-b2f4f7fa63cb\"");
>         
>         assertEquals("multipart", mt.getType());
>         assertEquals("related", mt.getSubtype());
>         Map<String, String> params2 = mt.getParameters();
>         assertEquals(2, params2.size());
>         assertEquals("\"uuid:b9aecb2a-ab37-48d6-a1cd-b2f4f7fa63cb\"", params2.get("boundary"));
>         assertEquals("application/dicom+xml", params2.get("type")); //FAIL
>     }  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)