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 19:06:23 UTC

[1/3] cxf git commit: Removing printlns + adding some logging

Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a108a6e56 -> 9dfa5cf3b


Removing printlns + adding some logging


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

Branch: refs/heads/3.1.x-fixes
Commit: 9dfa5cf3b704912a27e5adc5c218653cef8136b3
Parents: 55e9924
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Apr 21 17:17:48 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Apr 21 18:06:17 2016 +0100

----------------------------------------------------------------------
 .../oauth2/services/AbstractImplicitGrantService.java  |  1 -
 .../security/oauth2/services/AbstractOAuthService.java |  8 +++-----
 .../security/oauth2/services/AccessTokenService.java   |  6 ++++++
 .../oauth2/services/RedirectionBasedGrantService.java  | 13 ++++++-------
 .../cxf/rs/security/oidc/idp/OidcImplicitService.java  |  1 +
 5 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9dfa5cf3/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 497270d..3a18a66 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,7 +62,6 @@ 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/9dfa5cf3/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java
index 994f0d7..7873aa8 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java
@@ -100,13 +100,11 @@ public abstract class AbstractOAuthService {
      * @throws {@link OAuthServiceExcepption} if no matching Client is found
      */
     protected Client getValidClient(String clientId) throws OAuthServiceException {
-        Client client = null;
-        
         if (clientId != null) {
-            client = dataProvider.getClient(clientId);
+            return dataProvider.getClient(clientId);
         }
-        return client;
-        
+        LOG.fine("No valid client found as the given clientId is null");
+        return null;
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/cxf/blob/9dfa5cf3/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java
index 61bac1c..28410b8 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java
@@ -21,6 +21,7 @@ package org.apache.cxf.rs.security.oauth2.services;
 
 import java.util.LinkedList;
 import java.util.List;
+import java.util.logging.Level;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.POST;
@@ -90,6 +91,8 @@ public class AccessTokenService extends AbstractTokenService {
         if (!OAuthUtils.isGrantSupportedForClient(client, 
                                                   isCanSupportPublicClients(),
                                                   params.getFirst(OAuthConstants.GRANT_TYPE))) {
+            LOG.log(Level.FINE, "The grant type {} is not supported for the client",
+                     params.getFirst(OAuthConstants.GRANT_TYPE));
             return createErrorResponse(params, OAuthConstants.UNAUTHORIZED_CLIENT);    
         }
         
@@ -102,6 +105,7 @@ public class AccessTokenService extends AbstractTokenService {
         // Find the grant handler
         AccessTokenGrantHandler handler = findGrantHandler(params);
         if (handler == null) {
+            LOG.fine("No Grant Handler found");
             return createErrorResponse(params, OAuthConstants.UNSUPPORTED_GRANT_TYPE);
         }
         
@@ -119,6 +123,7 @@ public class AccessTokenService extends AbstractTokenService {
             return handleException(oauthEx, OAuthConstants.INVALID_GRANT);
         }
         if (serverToken == null) {
+            LOG.fine("No access token was created");
             return createErrorResponse(params, OAuthConstants.INVALID_GRANT);
         }
         
@@ -139,6 +144,7 @@ public class AccessTokenService extends AbstractTokenService {
     protected void checkAudience(Client c, MultivaluedMap<String, String> params) { 
         String audienceParam = params.getFirst(OAuthConstants.CLIENT_AUDIENCE);
         if (!OAuthUtils.validateAudience(audienceParam, c.getRegisteredAudiences())) {
+            LOG.fine("Error validating the audience parameter");
             throw new OAuthServiceException(new OAuthError(OAuthConstants.ACCESS_DENIED));
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/9dfa5cf3/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 3a8394d..5ed3e2c 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
@@ -24,6 +24,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.logging.Level;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
@@ -78,7 +79,6 @@ public abstract class RedirectionBasedGrantService extends AbstractOAuthService
                                            String supportedGrantType) {
         this.supportedResponseTypes = supportedResponseTypes;
         this.supportedGrantType = supportedGrantType;
-System.out.println("SUPP: " + supportedGrantType);
     }
     
     /**
@@ -123,7 +123,6 @@ System.out.println("SUPP: " + supportedGrantType);
         // 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);
@@ -139,22 +138,20 @@ System.out.println("HERE1");
         
         // 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)) {
+            LOG.fine("The grant type is not supported");
             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)) {
+            LOG.fine("The response type is null or not supported");
             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;
@@ -164,14 +161,15 @@ System.out.println("HERE5");
                                                            useAllClientScopes,
                                                            partialMatchScopeValidation);
         } catch (OAuthServiceException ex) {
+            LOG.log(Level.FINE, "Error parsing scopes", ex);
             return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_SCOPE);
         }
-System.out.println("HERE6");
         // Convert the requested scopes to OAuthPermission instances
         List<OAuthPermission> requestedPermissions = null;
         try {
             requestedPermissions = getDataProvider().convertScopeToPermissions(client, requestedScope);
         } catch (OAuthServiceException ex) {
+            LOG.log(Level.FINE, "Error converting scopes into OAuthPermissions", ex);
             return createErrorResponse(params, redirectUri, OAuthConstants.INVALID_SCOPE);
         }
         // Validate the audience
@@ -179,6 +177,7 @@ System.out.println("HERE6");
         // Right now if the audience parameter is set it is expected to be contained
         // in the list of Client audiences set at the Client registration time.
         if (!OAuthUtils.validateAudience(clientAudience, client.getRegisteredAudiences())) {
+            LOG.fine("Error validating audience parameter");
             throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
         }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/9dfa5cf3/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
index faaac6d..60d1773 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcImplicitService.java
@@ -66,6 +66,7 @@ public class OidcImplicitService extends ImplicitGrantService {
                                           Client client) {    
         // Validate the nonce, it must be present for the Implicit flow
         if (params.getFirst(OAuthConstants.NONCE) == null) {
+            LOG.fine("A nonce is required for the Implicit flow");
             throw new OAuthServiceException(new OAuthError(OAuthConstants.INVALID_REQUEST));
         }
         return super.startAuthorization(params, userSubject, client);


[2/3] cxf git commit: NPE fix

Posted by co...@apache.org.
NPE fix


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

Branch: refs/heads/3.1.x-fixes
Commit: 55e9924dd0694f09ef8b3343b566699dfd2f266f
Parents: 37defa8
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Apr 21 17:04:44 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Apr 21 18:06:17 2016 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/55e9924d/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
index 22a4a69..edade5b 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcHybridService.java
@@ -74,7 +74,7 @@ public class OidcHybridService extends OidcImplicitService {
         StringBuilder sb = super.prepareGrant(state, client, requestedScope, 
                                                           approvedScope, userSubject, preAuthorizedToken);
    
-        if (state.getResponseType().startsWith(OAuthConstants.CODE_RESPONSE_TYPE)) {
+        if (state.getResponseType() != null && state.getResponseType().startsWith(OAuthConstants.CODE_RESPONSE_TYPE)) {
             String code = codeService.getGrantCode(state, client, requestedScope,
                                                    approvedScope, userSubject, preAuthorizedToken);
             


[3/3] cxf git commit: More stream stuff

Posted by co...@apache.org.
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/37defa84
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/37defa84
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/37defa84

Branch: refs/heads/3.1.x-fixes
Commit: 37defa84d8002e1c0ec582f5c1c68643bc3b66d6
Parents: a108a6e
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 18:06:17 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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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/37defa84/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) {