diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java index 3398dc70d..5f98bd7ba 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java @@ -439,12 +439,15 @@ public class ODataJsonDeserializer implements ODataDeserializer { bindingLink.setType(Constants.ENTITY_COLLECTION_BINDING_LINK_TYPE); bindingLink.setBindingLinks(bindingLinkStrings); } else { - assertIsNullNode(key, jsonNode); if (!jsonNode.isValueNode()) { throw new DeserializerException("Binding annotation: " + key + " must be a string value.", DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key); } - bindingLink.setBindingLink(jsonNode.asText()); + if (jsonNode.isNull()) { + bindingLink.setBindingLink(null); + } else { + bindingLink.setBindingLink(jsonNode.asText()); + } bindingLink.setType(Constants.ENTITY_BINDING_LINK_TYPE); } return bindingLink; diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java index 6b46ffdac..368dda6d2 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java @@ -1029,10 +1029,12 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe + "\"PropertyString\":\"First Resource - positive values\"," + "\"NavPropertyETTwoPrimOne@odata.bind\":null" + "}"; - expectException(entityString, "ETAllPrim", - DeserializerException.MessageKeys.INVALID_NULL_ANNOTATION); + + final Entity entity = deserialize(entityString, "ETAllPrim"); + assertEquals("First Resource - positive values", entity.getProperty("PropertyString").asPrimitive()); + assertNull(entity.getNavigationBinding("NavPropertyETTwoPrimOne").getBindingLink()); } - + @Test public void bindingOperationNullOnToMany() throws Exception { String entityString = @@ -1382,5 +1384,5 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe } catch (final DeserializerException e) { assertEquals(messageKey, e.getMessageKey()); } - } + } }