[OLINGO-1191]Fix null issue in Edm.String

This commit is contained in:
ramya vasanth 2020-10-09 14:13:31 +05:30
parent 6f8b90bccd
commit 4baf2b695a
2 changed files with 5 additions and 1 deletions

View File

@ -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("''", "'");
}
}

View File

@ -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, "'");