diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmString.java index 8e9a42a59..29b44b426 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmString.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmString.java @@ -99,7 +99,10 @@ public final class EdmString extends SingletonPrimitiveType { } @Override - public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException { + public String fromUriLiteral(String literal) throws EdmPrimitiveTypeException { + if (literal != null && literal.equalsIgnoreCase("null")) { + literal = "'" + literal + "'"; + } return literal == null ? null : super.fromUriLiteral(literal).replace("''", "'"); } } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java index b5f2a89d5..68b58200a 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java @@ -38,6 +38,7 @@ public class EdmStringTest extends PrimitiveTypeBaseTest { @Test public void fromUriLiteral() throws Exception { assertEquals("String''Value", instance.fromUriLiteral("'String''''Value'")); + assertEquals("null", instance.fromUriLiteral("null")); expectErrorInFromUriLiteral(instance, ""); expectErrorInFromUriLiteral(instance, "'");