You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2016/07/27 14:00:23 UTC

olingo-odata4 git commit: OLINGO-977: Adding the XML declaration to the response of Complex Collection

Repository: olingo-odata4
Updated Branches:
  refs/heads/master 68d2e23ad -> aa8f2cfc2


OLINGO-977: Adding the XML declaration to the response of Complex Collection


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/aa8f2cfc
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/aa8f2cfc
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/aa8f2cfc

Branch: refs/heads/master
Commit: aa8f2cfc2fc5e72343ef7aaf7f238f0d51289cc2
Parents: 68d2e23
Author: Ramesh Reddy <ra...@jboss.org>
Authored: Wed Jul 27 08:57:13 2016 -0500
Committer: Ramesh Reddy <ra...@jboss.org>
Committed: Wed Jul 27 08:57:41 2016 -0500

----------------------------------------------------------------------
 .../olingo/server/core/serializer/xml/ODataXmlSerializer.java     | 2 +-
 .../olingo/server/core/serializer/xml/ODataXmlSerializerTest.java | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aa8f2cfc/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
index 6f8d513..47489c9 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
@@ -1081,7 +1081,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       CircleStreamBuffer buffer = new CircleStreamBuffer();
       outputStream = buffer.getOutputStream();
       XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
-
+      writer.writeStartDocument(DEFAULT_CHARSET, "1.0");
       writer.writeStartElement(METADATA, Constants.VALUE, NS_METADATA);
       writer.writeNamespace(METADATA, NS_METADATA);
       writer.writeNamespace(DATA, NS_DATA);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/aa8f2cfc/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
index 7407f06..d110622 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
@@ -2175,7 +2175,8 @@ public class ODataXmlSerializerTest {
                     .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
                     .build())
                 .build()).getContent());
-    String expected = "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+    String expected = "<?xml version='1.0' encoding='UTF-8'?>\n"
+        + "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
         "  xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
         + "m:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\"\n" +
         "  m:context=\"$metadata#ESMixPrimCollComp(32767)/CollPropertyComp\"\n" +