roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gango...@apache.org
Subject svn commit: r427608 - /incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
Date Tue, 01 Aug 2006 15:23:47 GMT
Author: gangolli
Date: Tue Aug  1 08:23:47 2006
New Revision: 427608

URL: http://svn.apache.org/viewvc?rev=427608&view=rev
Log:
Fix an encoding bug hit when retrieving cached content as a string.  

Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java?rev=427608&r1=427607&r2=427608&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
Tue Aug  1 08:23:47 2006
@@ -52,7 +52,8 @@
     
     
     /**
-     * Get the content cached in this object as a byte array.
+     * Get the content cached in this object as a byte array.  If you convert
+     * this back to a string yourself, be sure to re-encode in "UTF-8".
      *
      * NOTE: the content is only a representation of the data written to the
      *       enclosed Writer up until the last call to flush().
@@ -69,7 +70,12 @@
      *       enclosed Writer up until the last call to flush().
      */
     public String getContentAsString() {
-        return new String(this.content);
+        try {
+            return new String(this.content,"UTF-8");
+        } catch (UnsupportedEncodingException uex) {
+            // shouldn't ever happen - violates Java Spec.
+            throw new RuntimeException(uex);
+        }
     }
     
     



Mime
View raw message