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

Christian Amend commented on OLINGO-981:
----------------------------------------

[~rareddy] Hi Ramesh,

I had a look at the code. "NavPropertyETTwoPrimOne" has the property 
"Nullable=flase". The code you committed does not take this into account and 
thus would allow a client to send a binding operation which sets a non nullable 
navigation property to null.

In my opinion there should be a check to see if the binding can be null before 
allowing a null value. WDYT?

Best Regards,
Christian

> Binding operation null on to one
> --------------------------------
>
>                 Key: OLINGO-981
>                 URL: https://issues.apache.org/jira/browse/OLINGO-981
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.2.0
>            Reporter: Héctor Navarro
>            Assignee: Ramesh Reddy
>             Fix For: (Java) V4 4.3.0
>
>
> Apache Olingo isn't compliant with OData 4 feature "For nullable 
> single-valued navigation properties the value null may be used to remove the 
> relationship". 
> I believe if the navigation property is a single entity (to one relationship) 
> and it is defined as nullable, it can be null, as sais at OData documentation 
> ("For nullable single-valued navigation properties the value null may be used 
> to remove the relationship.").
>  
> As example, we can use 
> org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializerEntityTest.bindingOperationNullOnToOne():
>  
>   @Test
>   public void bindingOperationNullOnToOne() throws Exception {
>     String entityString =
>         "{\"PropertyInt16\":32767,"
>             + "\"PropertyString\":\"First Resource - positive values\","
>             + "\"[email protected]\":null"
>             + "}";
>     expectException(entityString, "ETAllPrim",
>         DeserializerException.MessageKeys.INVALID_NULL_ANNOTATION);
>   }
>  
> I believe that if we define NavPropertyETTwoPrimOne as nullable, it shouldn't 
> throw INVALID_NULL_ANNOTATION exception. 



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

Reply via email to