You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2008/05/08 05:26:26 UTC

svn commit: r654401 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/html/java/org/apache/cocoon/transformation/NekoHTMLTransformer.java status.xml

Author: joerg
Date: Wed May  7 20:26:25 2008
New Revision: 654401

URL: http://svn.apache.org/viewvc?rev=654401&view=rev
Log:
COCOON-2063: Fix encoding issue in NekoHTMLTransformer (http://marc.info/?l=xml-cocoon-dev&m=120905050708311&w=4)

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/html/java/org/apache/cocoon/transformation/NekoHTMLTransformer.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/html/java/org/apache/cocoon/transformation/NekoHTMLTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/html/java/org/apache/cocoon/transformation/NekoHTMLTransformer.java?rev=654401&r1=654400&r2=654401&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/html/java/org/apache/cocoon/transformation/NekoHTMLTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/html/java/org/apache/cocoon/transformation/NekoHTMLTransformer.java Wed May  7 20:26:25 2008
@@ -16,8 +16,9 @@
  */
 package org.apache.cocoon.transformation;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -137,15 +138,13 @@
      * @param text the string to be tidied
      */
     private void normalize(String text) throws ProcessingException {
+        Reader reader = new StringReader(text);
         try {
             NekoHtmlSaxParser parser = new NekoHtmlSaxParser(this.properties);
 
-            ByteArrayInputStream bais =
-                new ByteArrayInputStream(text.getBytes());
-
             DOMBuilder builder = new DOMBuilder();
             parser.setContentHandler(builder);
-            parser.parse(new InputSource(bais));
+            parser.parse(new InputSource(reader));
             Document doc = builder.getDocument();
 
             IncludeXMLConsumer.includeNode(doc, this.contentHandler, this.lexicalHandler);
@@ -153,6 +152,12 @@
             throw new ProcessingException(
                 "Exception in NekoHTMLTransformer.normalize()",
                 e);
+        } finally {
+            try {
+                reader.close();
+            } catch (IOException e) {
+                throw new ProcessingException(e);
+            }
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=654401&r1=654400&r2=654401&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed May  7 20:26:25 2008
@@ -182,6 +182,9 @@
 
   <changes>
   <release version="2.1.12" date="TBD">
+    <action dev="VG" type="fix" fixes-bug="COCOON-2063">
+      HTML: Fix encoding issue in NekoHTMLTransformer.
+    </action>
     <action dev="JH" type="fix" fixes-bug="COCOON-1825" due-to="Vincent Demay" due-to-email="vincent@demay-fr.net">
       Forms: Fix @id handling on fi:group/fi:struct element in conjunction with AJAX requests.
     </action>