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

Frederik Zimmer commented on OLINGO-873:
----------------------------------------

Calling a function with a collection will still result in 
functionName(paramName=["stringValue"]) and not something like 
functionName(paramName=@p)?@p=["stringValue"]
When I look into the ABNF:
functionParameter = parameterName EQ ( parameterAlias / primitiveLiteral )
then I don't think that the current version is allowed because ["stringValue"] 
is not a primitiveLiteral.

Test:
@Test
  public void testOLINGO873() throws ODataDeserializerException {
    final ODataClient client = ODataClientFactory.getClient();
    final URI uri = 
client.newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("EntitySet").
        appendOperationCallSegment("functionName").build();
    final Map<String, ClientValue> parameters = new HashMap<String, 
ClientValue>();
    final ClientPrimitiveValue value = client.getObjectFactory().
        newPrimitiveValueBuilder().buildString("parameterValue");
    final ClientCollectionValue<ClientValue> collectionValue = 
client.getObjectFactory().newCollectionValue("Edm.String");
    collectionValue.add(value);
    
    parameters.put("parameterName", collectionValue);
    URI newUri = URIUtils.buildFunctionInvokeURI(uri, parameters);
    assertNotNull(newUri);
    
assertEquals("http://host/service/EntitySet/functionName(parameterName%3D%40p)"
        +"?%40p=%5b%22parameterValue%22%5d", newUri.toASCIIString());
  }

> Invalid representation of function parameters in URL
> ----------------------------------------------------
>
>                 Key: OLINGO-873
>                 URL: https://issues.apache.org/jira/browse/OLINGO-873
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: (Java) V4 4.1.0
>            Reporter: Frederik Zimmer
>
> Calling a function with a string parameter will lead to 
> functionName(paramName=stringValue)
> The correct version would be
> functionName(paramName='stringValue')
> Complex and collection parameters can only be expressed with a parameter 
> alias. ABNF:
> functionParameter  = parameterName EQ ( parameterAlias / primitiveLiteral ).
> This is not done, so passing complex or collection parameters to a function 
> call will lead to invalid urls. Example:
> Calling a function with a string collection param with one value will lead to 
> functionName(paramName=[stringValue])
> The correct version would be:
> functionName(paramName=@p)?@p=["stringValue"]
> The bug is in org.apache.olingo.client.core.uri.URIUtils method 
> buildFunctionInvokeURI.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to