Author: veithen
Date: Sat Aug 27 13:45:02 2011
New Revision: 1162353
URL: http://svn.apache.org/viewvc?rev=1162353&view=rev
Log:
Corrected the code used to copy data from an InputStream to an OutputStream.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java?rev=1162353&r1=1162352&r2=1162353&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
Sat Aug 27 13:45:02 2011
@@ -80,17 +80,10 @@ public class BufferUtils {
byte[] buffer = getTempBuffer();
try {
- int bytesRead = is.read(buffer);
-
-
- // Continue reading until no bytes are read and no
- // bytes are now available.
- while (bytesRead > 0 || is.available() > 0) {
- if (bytesRead > 0) {
+ int bytesRead;
+ while ((bytesRead = is.read(buffer)) != -1) {
os.write(buffer, 0, bytesRead);
}
- bytesRead = is.read(buffer);
- }
} finally {
releaseTempBuffer(buffer);
}