Fixing backmerge

Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c7b9638c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c7b9638c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c7b9638c

Branch: refs/heads/3.0.x-fixes
Commit: c7b9638cf60cc38342828192f5ce80e4a81ce9a3
Parents: 17f221b
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Fri Jul 17 16:35:40 2015 +0100
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Fri Jul 17 16:35:40 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/io/CachedStreamTestBase.java | 49 ++++++--------------
 1 file changed, 15 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c7b9638c/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java 
b/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
index 222705c..211e928 100755
--- a/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
+++ b/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
@@ -251,61 +251,42 @@ public abstract class CachedStreamTestBase extends Assert 
{
     }
 
     protected static String readFromStream(InputStream is) throws IOException {
-        try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
+        ByteArrayOutputStream buf = new ByteArrayOutputStream();
+        try {
             IOUtils.copyAndCloseInput(is, buf);
             return new String(buf.toByteArray(), "UTF-8");
+        } finally {
+            buf.close();
         }
     }
 
     protected static String readPartiallyFromStream(InputStream is, int len) 
throws IOException {
-        try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
+        ByteArrayOutputStream buf = new ByteArrayOutputStream();
+        try {
             IOUtils.copyAtLeast(is, buf, len);
             return new String(buf.toByteArray(), "UTF-8");
+        } finally {
+            buf.close();
         }
     }
  
     protected static String readFromReader(Reader is) throws IOException {
-<<<<<<< HEAD
-        StringBuffer buf = new StringBuffer();
+        StringWriter writer = new StringWriter();
         try {
-            char[] b = new char[100];
-            for (;;) {
-                int n = is.read(b, 0, b.length);
-                if (n < 0) {
-                    break;
-                }
-                buf.append(b, 0, n);
-            }
-        } finally {
-            is.close();
-=======
-        try (StringWriter writer = new StringWriter()) {
             IOUtils.copyAndCloseInput(is, writer);
             return writer.toString();
->>>>>>> 17f140e... Use IOUtils methods in CachedStreamTestBase to handle 
stream reading
+        } finally {
+            writer.close();
         }
     }
     
     protected static String readPartiallyFromReader(Reader is, int len) throws 
IOException {
-<<<<<<< HEAD
-        StringBuffer buf = new StringBuffer();
-        char[] b = new char[len];
-        int rn = 0;
-        for (;;) {
-            int n = is.read(b, 0, b.length);
-            if (n < 0) {
-                break;
-            }
-            buf.append(b, 0, n);
-            rn += n;
-            if (len <= rn) {
-                break;
-            }
-=======
-        try (StringWriter writer = new StringWriter()) {
+        StringWriter writer = new StringWriter();
+        try {
             IOUtils.copyAtLeast(is, writer, len);
             return writer.toString();
->>>>>>> 17f140e... Use IOUtils methods in CachedStreamTestBase to handle 
stream reading
+        } finally {
+            writer.close();
         }
     }
     

Reply via email to