[ 
https://issues.apache.org/jira/browse/CXF-3531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ka-Lok Fung updated CXF-3531:
-----------------------------

    Attachment: cxf.post.mediatype.trunk.diff

Potential patch for this issue.

Basically, if an {{IllegalArgumentException}} while parsing the MediaType, we 
will convert that into a {{WebApplicationException}} with a 415 status code.

Added a systest to catch this scenario. Unfortunately, I had to use 
{{HttpURLConnection}} instead of {{WebClient}} because {{WebClient}} actually 
validates media types :)

> CXF doesn't always generate 415 when POSTing to a resource with an invalid 
> media type
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-3531
>                 URL: https://issues.apache.org/jira/browse/CXF-3531
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4, 2.3.4
>         Environment: JDK 1.6
>            Reporter: Ka-Lok Fung
>            Priority: Minor
>             Fix For: 2.4.1, 2.3.5
>
>         Attachments: cxf.post.mediatype.trunk.diff
>
>
> When you POST to a resource using an invalid Content-Type of "foo", CXF 
> doesn't return 415.
> Instead, CXF throws a 500 because an IllegalArgumentException is thrown 
> instead of a WebApplicationException.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to