clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/2] git commit: CLEREZZA-387: SRenderlet/XmlResult was serializing XML using platform default encoding instead of UTF-8 causing problems on parsing
Date Sun, 05 Jan 2014 21:29:41 GMT
CLEREZZA-387: SRenderlet/XmlResult was serializing XML using platform default encoding instead
of UTF-8 causing problems on parsing

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

Branch: refs/heads/master
Commit: ec88e357afcc11fbb6ddc7f398a7964cce944ebd
Parents: 9cd565b
Author: retobg <reto@apache.org>
Authored: Sun Jan 5 22:29:22 2014 +0100
Committer: retobg <reto@apache.org>
Committed: Sun Jan 5 22:29:22 2014 +0100

----------------------------------------------------------------------
 platform.typerendering.scala/nbactions.xml               | 11 +++++++++++
 .../platform/typerendering/scala/XmlResult.scala         | 10 +++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/ec88e357/platform.typerendering.scala/nbactions.xml
----------------------------------------------------------------------
diff --git a/platform.typerendering.scala/nbactions.xml b/platform.typerendering.scala/nbactions.xml
new file mode 100644
index 0000000..49e8307
--- /dev/null
+++ b/platform.typerendering.scala/nbactions.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+    <action>
+        <actionName>CUSTOM-deploy to localhost:8080</actionName>
+        <displayName>deploy to localhost:8080</displayName>
+        <goals>
+            <goal>install</goal>
+            <goal>org.apache.sling:maven-sling-plugin:install</goal>
+        </goals>
+    </action>
+</actions>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/ec88e357/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
----------------------------------------------------------------------
diff --git a/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
b/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
index bcf3dcf..e920bf0 100644
--- a/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
+++ b/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
@@ -19,6 +19,7 @@
 package org.apache.clerezza.platform.typerendering.scala
 
 import java.io.OutputStream
+import java.io.OutputStreamWriter
 import java.io.PrintWriter
 import java.net.URI
 import javax.ws.rs.core.HttpHeaders
@@ -31,6 +32,7 @@ import org.apache.clerezza.rdf.ontologies._
 import org.apache.clerezza.rdf.core._
 import org.apache.clerezza.rdf.utils._
 import org.apache.clerezza.rdf.scala.utils.Preamble._
+import java.nio.charset.Charset
 import java.security.{PrivilegedAction, AccessController}
 import org.osgi.framework.{BundleContext, ServiceReference}
 import org.apache.clerezza.rdf.scala.utils.RichGraphNode
@@ -42,6 +44,8 @@ import org.apache.clerezza.rdf.scala.utils.RichGraphNode
  */
 abstract class XmlResult(arguments: XmlResult.Arguments) {
 
+  private val UTF8: Charset = Charset.forName("utf-8")
+  
   val XmlResult.Arguments(
           res: GraphNode,
           context: GraphNode,
@@ -73,7 +77,7 @@ abstract class XmlResult(arguments: XmlResult.Arguments) {
     }
     val baos = new java.io.ByteArrayOutputStream
     renderer.render(resource, context, mode, baos)
-    parseNodeSeq(new String(baos.toByteArray))
+    parseNodeSeq(new String(baos.toByteArray, UTF8))
   }
 
   /**
@@ -97,7 +101,7 @@ abstract class XmlResult(arguments: XmlResult.Arguments) {
     }
     val baos = new java.io.ByteArrayOutputStream
     renderer.render(resource, context, mode, baos)
-    parseNodeSeq(new String(baos.toByteArray))
+    parseNodeSeq(new String(baos.toByteArray, UTF8))
   }
 
   /**
@@ -127,7 +131,7 @@ abstract class XmlResult(arguments: XmlResult.Arguments) {
 
   val resultDocModifier = org.apache.clerezza.platform.typerendering.ResultDocModifier.getInstance();
 
-  val out = new PrintWriter(os)
+  val out = new PrintWriter(new OutputStreamWriter(os,UTF8))
 
   out.print(
     content match {


Mime
View raw message