jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r802691 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java
Date Mon, 10 Aug 2009 08:28:07 GMT
Author: stefan
Date: Mon Aug 10 08:28:07 2009
New Revision: 802691

URL: http://svn.apache.org/viewvc?rev=802691&view=rev
Log:
JCR-2250: Base64 bug - last buffer not flushed

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java?rev=802691&r1=802690&r2=802691&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java
Mon Aug 10 08:28:07 2009
@@ -23,6 +23,7 @@
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
+import java.io.BufferedWriter;
 
 /**
  * <code>Base64</code> provides Base64 encoding/decoding of strings and streams.
@@ -115,8 +116,15 @@
      */
     public static void encode(InputStream in, OutputStream out)
             throws IOException {
-        Writer writer = new OutputStreamWriter(out, CHARSET);
-        encode(in, writer);
+        Writer writer = new BufferedWriter(new OutputStreamWriter(out, CHARSET));
+        try {
+            encode(in, writer);
+        } finally {
+            try {
+                writer.flush();
+            } catch (IOException ignore) {
+            }
+        }
     }
 
     /**



Mime
View raw message