OLINGO-906: correcting xml serializer to return correct internal code

This commit is contained in:
Ramesh Reddy 2016-03-14 17:06:21 -05:00
parent 92fa7cd62e
commit 979d96c083
2 changed files with 3 additions and 3 deletions

View File

@ -163,7 +163,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
writer.writeStartElement("error");
writer.writeDefaultNamespace(NS_METADATA);
writeErrorDetails(String.valueOf(error.getStatusCode()), error.getMessage(), error.getTarget(), writer);
writeErrorDetails(String.valueOf(error.getCode()), error.getMessage(), error.getTarget(), writer);
if (error.getDetails() != null && !error.getDetails().isEmpty()) {
writer.writeStartElement(Constants.ERROR_DETAILS);
for (ODataErrorDetail inner : error.getDetails()) {

View File

@ -48,7 +48,7 @@ public class ServerErrorXmlSerializerTest {
String jsonString = IOUtils.toString(stream);
assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
+ "<error xmlns=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ "<code>0</code>"
+ "<code>Code</code>"
+ "<message>ErrorMessage</message>"
+ "</error>",
jsonString);
@ -74,7 +74,7 @@ public class ServerErrorXmlSerializerTest {
String jsonString = IOUtils.toString(stream);
assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
+ "<error xmlns=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ "<code>0</code>"
+ "<code>code</code>"
+ "<message>err message</message>"
+ "<target>target</target>"
+ "<details>"