You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2010/12/17 18:04:27 UTC

svn commit: r1050452 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java

Author: jleroux
Date: Fri Dec 17 17:04:27 2010
New Revision: 1050452

URL: http://svn.apache.org/viewvc?rev=1050452&view=rev
Log:
I think this is the correct solution for the problem I temporarily fixed some hours ago (r1050364+r1050367: was for a blocking deadlock issue, see https://issues.apache.org/jira/browse/OFBIZ-4065 - OFBIZ-4065 for details)

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java?rev=1050452&r1=1050451&r2=1050452&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java Fri Dec 17 17:04:27 2010
@@ -105,9 +105,7 @@ public final class UtilIO {
     public static void copy(Reader reader, boolean closeIn, Appendable out) throws IOException {
         try {
             CharBuffer buffer = CharBuffer.allocate(4096);
-            int r;
-            while ((r = reader.read(buffer)) != -1) {
-        	if (r == 0) break;
+            while (reader.read(buffer) > 0) {
                 buffer.rewind();
                 out.append(buffer);
                 buffer.flip();
@@ -249,8 +247,7 @@ public final class UtilIO {
             StringBuilder sb = new StringBuilder();
             char[] buf = new char[4096];
             int r;
-            while ((r = reader.read(buf, 0, 4096)) != -1) {
-        	if (r == 0) break;
+            while ((r = reader.read(buf, 0, 4096)) > 0) {
                 sb.append(buf, 0, r);
             }
             return filterLineEndings(sb).toString();