OLINGO-854: reverting the changes from previous commit

This commit is contained in:
Ramesh Reddy 2016-01-22 11:33:06 -06:00
parent b5eae4f6c2
commit 322085df6b
2 changed files with 2 additions and 6 deletions

View File

@ -21,8 +21,6 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.Decoder;
import org.apache.olingo.commons.core.Encoder;
/** /**
* Implementation of the EDM primitive type String. * Implementation of the EDM primitive type String.
@ -97,11 +95,11 @@ public final class EdmString extends SingletonPrimitiveType {
uriLiteral.append(c); uriLiteral.append(c);
} }
uriLiteral.append(uriSuffix); uriLiteral.append(uriSuffix);
return Encoder.encode(uriLiteral.toString()); return uriLiteral.toString();
} }
@Override @Override
public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException { public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
return literal == null ? null : Decoder.decode(super.fromUriLiteral(literal).replace("''", "'")); return literal == null ? null : super.fromUriLiteral(literal).replace("''", "'");
} }
} }

View File

@ -33,13 +33,11 @@ public class EdmStringTest extends PrimitiveTypeBaseTest {
assertEquals("'StringValue'", instance.toUriLiteral("StringValue")); assertEquals("'StringValue'", instance.toUriLiteral("StringValue"));
assertEquals("'String''Value'", instance.toUriLiteral("String'Value")); assertEquals("'String''Value'", instance.toUriLiteral("String'Value"));
assertEquals("'String''''''Value'", instance.toUriLiteral("String'''Value")); assertEquals("'String''''''Value'", instance.toUriLiteral("String'''Value"));
assertEquals("'ab%20cd%20'", instance.toUriLiteral("ab cd "));
} }
@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("ab cd ", instance.fromUriLiteral("'ab%20cd%20'"));
expectErrorInFromUriLiteral(instance, ""); expectErrorInFromUriLiteral(instance, "");
expectErrorInFromUriLiteral(instance, "'"); expectErrorInFromUriLiteral(instance, "'");