You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2016/04/21 18:01:31 UTC

cxf git commit: More stream stuff

Repository: cxf
Updated Branches:
  refs/heads/master 0b609b0ab -> 8269b3c46


More stream stuff


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

Branch: refs/heads/master
Commit: 8269b3c46dcd88c4cff754c0df5ec92d020acd09
Parents: 0b609b0
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Apr 21 17:00:48 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Apr 21 17:01:24 2016 +0100

----------------------------------------------------------------------
 core/src/main/java/org/apache/cxf/helpers/IOUtils.java  | 12 +-----------
 .../oauth2/services/AbstractImplicitGrantService.java   |  1 +
 .../oauth2/services/RedirectionBasedGrantService.java   |  7 +++++++
 .../org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java | 12 ++++++------
 .../cxf/systest/jaxrs/JAXRSClientServerBookTest.java    |  8 +-------
 .../jaxrs/JAXRSClientServerNonSpringBookTest.java       |  8 +-------
 .../jaxrs/JAXRSClientServerProxySpringBookTest.java     |  8 +-------
 ...JAXRSClientServerResourceCreatedOutsideBookTest.java |  8 +-------
 .../JAXRSClientServerResourceCreatedSpringBookTest.java |  8 +-------
 .../systest/jaxrs/JAXRSClientServerSpringBookTest.java  |  8 +-------
 .../apache/cxf/systest/jaxrs/JAXRSMultipartTest.java    |  8 +-------
 .../org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java |  8 +-------
 .../jaxrs/security/AbstractSpringSecurityTest.java      |  8 +-------
 13 files changed, 24 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/core/src/main/java/org/apache/cxf/helpers/IOUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/helpers/IOUtils.java b/core/src/main/java/org/apache/cxf/helpers/IOUtils.java
index 7c3b828..194ee25 100644
--- a/core/src/main/java/org/apache/cxf/helpers/IOUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/IOUtils.java
@@ -319,17 +319,7 @@ public final class IOUtils {
 
     public static String readStringFromStream(InputStream in)
         throws IOException {
-
-        StringBuilder sb = new StringBuilder(1024);
-
-        try {
-            for (int i = in.read(); i != -1; i = in.read()) {
-                sb.append((char) i);
-            }
-            return sb.toString();
-        } finally {
-            in.close();
-        }
+        return toString(in);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
index 3a18a66..497270d 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractImplicitGrantService.java
@@ -62,6 +62,7 @@ public abstract class AbstractImplicitGrantService extends RedirectionBasedGrant
                                           List<String> approvedScope,
                                           UserSubject userSubject,
                                           ServerAccessToken preAuthorizedToken) {
+System.out.println("STATE: " + (state == null));
         StringBuilder sb =
             prepareGrant(state, client, requestedScope, approvedScope, userSubject, preAuthorizedToken);
         return Response.seeOther(URI.create(sb.toString())).build();

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
index f7c3218..3a8394d 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
@@ -78,6 +78,7 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
                                            String supportedGrantType) {
         this.supportedResponseTypes = supportedResponseTypes;
         this.supportedGrantType = supportedGrantType;
+System.out.println("SUPP: " + supportedGrantType);
     }
     
     /**
@@ -122,6 +123,7 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
         // Make sure the end user has authenticated, check if HTTPS is used
         SecurityContext sc = getAndValidateSecurityContext(params);
         Client client = getClient(params);
+System.out.println("HERE1");
         // Create a UserSubject representing the end user 
         UserSubject userSubject = createUserSubject(sc, params);
         return startAuthorization(params, userSubject, client);
@@ -137,18 +139,22 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
         
         // Validate the provided request URI, if any, against the ones Client provided
         // during the registration
+System.out.println("HERE2");
         String redirectUri = validateRedirectUri(client, params.getFirst(OAuthConstants.REDIRECT_URI)); 
         
+System.out.println("HERE3");
         // Enforce the client confidentiality requirements
         if (!OAuthUtils.isGrantSupportedForClient(client, canSupportPublicClient(client), supportedGrantType)) {
             return createErrorResponse(params, redirectUri, OAuthConstants.UNAUTHORIZED_CLIENT);
         }
+System.out.println("HERE4");
         
         // Check response_type
         String responseType = params.getFirst(OAuthConstants.RESPONSE_TYPE);
         if (responseType == null || !getSupportedResponseTypes().contains(responseType)) {
             return createErrorResponse(params, redirectUri, OAuthConstants.UNSUPPORTED_RESPONSE_TYPE);
         }
+System.out.println("HERE5");
         // Get the requested scopes
         String providedScope = params.getFirst(OAuthConstants.SCOPE);
         List<String> requestedScope = null;
@@ -160,6 +166,7 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
         } catch (OAuthServiceException ex) {
             return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_SCOPE);
         }
+System.out.println("HERE6");
         // Convert the requested scopes to OAuthPermission instances
         List<OAuthPermission> requestedPermissions = null;
         try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
index d4ca6c4..706df72 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
@@ -248,12 +248,12 @@ public class JAXRSAtomBookTest extends AbstractBusClientServerTestBase {
     }
     
     private InputStream copyIn(InputStream in) throws Exception {
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        in.close();
-        in = bos.getInputStream();
-        bos.close();
-        return in;
+        try (CachedOutputStream bos = new CachedOutputStream()) {
+            IOUtils.copyAndCloseInput(in, bos);
+            in = bos.getInputStream();
+            bos.close();
+            return in;
+        }
     }
     private String getStringFromInputStream(InputStream in) throws Exception {
         return IOUtils.toString(in);

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
index 61fdeec..2e7bdd6 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
@@ -63,7 +63,6 @@ import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -2750,12 +2749,7 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase {
     
     
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
index 75e966e..dcfafba 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
@@ -31,7 +31,6 @@ import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -272,12 +271,7 @@ public class JAXRSClientServerNonSpringBookTest extends AbstractBusClientServerT
     }
     
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
index 60200f0..40d8b7a 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
@@ -35,7 +35,6 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.jaxrs.model.wadl.WadlGenerator;
@@ -229,12 +228,7 @@ public class JAXRSClientServerProxySpringBookTest extends AbstractBusClientServe
     }
     
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
     private String stripXmlInstructionIfNeeded(String str) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java
index 77b30b8..e4d1270 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java
@@ -28,7 +28,6 @@ import java.net.URL;
 import java.net.URLConnection;
 
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
@@ -111,12 +110,7 @@ public class JAXRSClientServerResourceCreatedOutsideBookTest extends AbstractBus
         return str;
     }
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
index efa661f..1586e0a 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
@@ -24,7 +24,6 @@ import java.net.URL;
 import java.net.URLConnection;
 
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
@@ -124,12 +123,7 @@ public class JAXRSClientServerResourceCreatedSpringBookTest extends AbstractBusC
     }
     
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
index 5994269..5e274ab 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
@@ -51,7 +51,6 @@ import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
@@ -955,12 +954,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
     }
     
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
index 16dfeaf..4f07c1e 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
@@ -56,7 +56,6 @@ import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -1004,12 +1003,7 @@ public class JAXRSMultipartTest extends AbstractBusClientServerTestBase {
     }
     
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
     private Book readBookFromInputStream(InputStream is) throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
index 655c355..b541842 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
@@ -60,7 +60,6 @@ import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.interceptor.transform.TransformInInterceptor;
 import org.apache.cxf.interceptor.transform.TransformOutInterceptor;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.ClientConfiguration;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
@@ -936,12 +935,7 @@ public class JAXRSSoapBookTest extends AbstractBusClientServerTestBase {
     }
 
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        String str = new String(bos.getBytes()); 
-        in.close();
-        bos.close();
-        return str;
+        return IOUtils.toString(in);
     }
 
     private InputStream getHttpInputStream(String endpointAddress) throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/8269b3c4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
index af74fca..bf879f2 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
@@ -25,18 +25,12 @@ import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 public abstract class AbstractSpringSecurityTest extends AbstractBusClientServerTestBase {
 
     private String getStringFromInputStream(InputStream in) throws Exception {        
-        CachedOutputStream bos = new CachedOutputStream();
-        IOUtils.copy(in, bos);
-        in.close();
-        bos.close();
-        //System.out.println(bos.getOut().toString());        
-        return bos.getOut().toString();        
+        return IOUtils.toString(in); 
     }
     
     protected String base64Encode(String value) {