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

Gyula Árpád Tóth commented on OLINGO-839:
-----------------------------------------

The problem is that the cxf framework uses java.net.URLDecoder.decode to parse 
the urls, and that fails with an unchecked IllegalArgumentException on urls 
that are not encoded properly like 
http://services.odata.org/OData/OData.svc/Suppliers?$filter=Address/City%20eq%20%27Redmond%2
 . That url should end with %27 instead of %2. I was not able to find a more 
specific way to identify the issue than checking the exception text.

Whenever URIInfo.getRequestURI() is called a new URI is constructed. This 
happens in the constructor of the wrapper.
URIInfo.getQueryParameters() is also called and that start a URI parsing too. 
This is also in the constructor when the content-type of the response is 
calculated. In both cases there is a point where URLDecoder.decode is called.

My patch is more like a guideline to identify and handle the issue on the 
surface. The best would be to know if the URIInfo has a valid URI or not.

> Invalid URL may return http status code 500 instead of 400
> ----------------------------------------------------------
>
>                 Key: OLINGO-839
>                 URL: https://issues.apache.org/jira/browse/OLINGO-839
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core
>    Affects Versions: V2 2.0.5
>            Reporter: Gyula Árpád Tóth
>            Assignee: Christian Amend
>            Priority: Minor
>         Attachments: 0001-OLINGO-839-Broken-URL-response.patch
>
>
> Broken urls like: 
> http://services.odata.org/OData/OData.svc/Suppliers?$filter=Address/City%20eq%20%27Redmond%2
>  should set the http status code to 400. In olingov2 the status code is set 
> 500, because once the url parsing failed, in the ODataExceptionWrapper the 
> url is parsed again and failed again, resulting in status code 500.



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

Reply via email to