Bug 7206 - Chinese improper code problem. 42/51742/2
authorGeng Xingyuan <geng.xingyuan@zte.com.cn>
Fri, 18 Nov 2016 13:17:24 +0000 (21:17 +0800)
committerJakub Toth <jatoth@cisco.com>
Sat, 11 Feb 2017 11:48:59 +0000 (11:48 +0000)
Change-Id: Iedad5f4cfce270216811788b217bced62ff88428
Signed-off-by: Geng Xingyuan <geng.xingyuan@zte.com.cn>
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/PATCHXmlBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/NormalizedNodeXmlBodyWriter.java

index 3d78e952fd55dd17ed12466843e3bbeb6c6acca0..633cd73c3de1df7be88f45dc8cbdab62ecee2e78 100644 (file)
@@ -13,6 +13,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.Map.Entry;
 import javanet.staxutils.IndentingXMLStreamWriter;
 import javax.ws.rs.Produces;
@@ -86,7 +87,7 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
 
         XMLStreamWriter xmlWriter;
         try {
-            xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream);
+            xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream, StandardCharsets.UTF_8.name());
             if (t.getWriterParameters().isPrettyPrint()) {
                 xmlWriter = new IndentingXMLStreamWriter(xmlWriter);
             }
index 3a92515bcbcfe4977a2e80d06e293a44a3eb8892..0918d509e6296751aab2bb8e6818bb113ff10d43 100644 (file)
@@ -12,6 +12,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
@@ -62,7 +63,7 @@ public class PATCHXmlBodyWriter implements MessageBodyWriter<PATCHStatusContext>
             throws IOException, WebApplicationException {
 
         try {
-            final XMLStreamWriter xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream);
+            final XMLStreamWriter xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream, StandardCharsets.UTF_8.name());
             writeDocument(xmlWriter, patchStatusContext);
         } catch (final XMLStreamException e) {
             throw new IllegalStateException(e);
index dea493ea27eb5f6695f1d64ffaf01634d4478111..0bd6d6de9df80c30ba34fe8b72f5946ad830724b 100644 (file)
@@ -282,7 +282,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
 
         final XMLStreamWriter xmlWriter;
         try {
-            xmlWriter = XML_FACTORY.createXMLStreamWriter(outStream, "UTF-8");
+            xmlWriter = XML_FACTORY.createXMLStreamWriter(outStream, StandardCharsets.UTF_8.name());
         } catch (final XMLStreamException e) {
             throw new IllegalStateException(e);
         } catch (final FactoryConfigurationError e) {
index a0fb26fb6ab3f62372f2ab35117182a5eff5c13e..a6230627a9c706d8c7491564ab5a1406c3a01bc0 100644 (file)
@@ -13,6 +13,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Set;
 import javanet.staxutils.IndentingXMLStreamWriter;
@@ -86,7 +87,7 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
 
         XMLStreamWriter xmlWriter;
         try {
-            xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream);
+            xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream, StandardCharsets.UTF_8.name());
             if (t.getWriterParameters().isPrettyPrint()) {
                 xmlWriter = new IndentingXMLStreamWriter(xmlWriter);
             }