[OLINGO-1191]Fix null issue in Edm.String
This commit is contained in:
parent
6f8b90bccd
commit
4baf2b695a
|
@ -99,7 +99,10 @@ public final class EdmString extends SingletonPrimitiveType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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("''", "'");
|
return literal == null ? null : super.fromUriLiteral(literal).replace("''", "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class EdmStringTest extends PrimitiveTypeBaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void fromUriLiteral() throws Exception {
|
public void fromUriLiteral() throws Exception {
|
||||||
assertEquals("String''Value", instance.fromUriLiteral("'String''''Value'"));
|
assertEquals("String''Value", instance.fromUriLiteral("'String''''Value'"));
|
||||||
|
assertEquals("null", instance.fromUriLiteral("null"));
|
||||||
|
|
||||||
expectErrorInFromUriLiteral(instance, "");
|
expectErrorInFromUriLiteral(instance, "");
|
||||||
expectErrorInFromUriLiteral(instance, "'");
|
expectErrorInFromUriLiteral(instance, "'");
|
||||||
|
|
Loading…
Reference in New Issue