You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Jamie Williams (JIRA)" <ji...@apache.org> on 2015/03/12 19:24:38 UTC

[jira] [Created] (OLINGO-591) RestUtil query parameter extraction methods incorrectly extract an empty parameter when evaluating a zero-length query string

Jamie Williams created OLINGO-591:
-------------------------------------

             Summary: RestUtil query parameter extraction methods incorrectly extract an empty parameter when evaluating a zero-length query string
                 Key: OLINGO-591
                 URL: https://issues.apache.org/jira/browse/OLINGO-591
             Project: Olingo
          Issue Type: Bug
    Affects Versions: V2 2.0.3
            Reporter: Jamie Williams
            Priority: Minor


When org.apache.olingo.odata2.core.servlet.RestUtil.extractQueryParameters is invoked with a zero-length String value for the 'queryString' parameter the method incorrectly adds a Map entry with a zero-length String key and a corresponding zero-length String value.

The same is true of the org.apache.olingo.odata2.core.servlet.RestUtil.extractAllQueryParameters, but in that case the Map entry value is a List containing a single empty String.

This can cause incorrect request parsing results if the returned Maps are supplied as to org.apache.olingo.odata2.core.uri.UriParserImpl.parse or org.apache.olingo.odata2.core.uri.UriParserImpl.parseAll. As org.apache.olingo.odata2.core.uri.UriParserImpl.distributeQueryParameters will simply interpret a key that doesn't start with "$" as a non-system query option, they empty key/value pair will be added to the otherQueryParameters Map which will in turn be added to UriInfo.customQueryParameters in org.apache.olingo.odata2.core.uri.UriParserImpl.handleOtherQueryParammeters. The final result is that the returned UriInfo will be an incorrect representation of the request URI.

The problem in each step is from a lack of checking for String emptiness. This is most easily solved by adding that check in addition to the existing null checks in the two RestUtil methods.



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