summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2012-10-01 05:09:58 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2012-10-01 05:09:58 +0000
commitd0c8102a6750eae0fa290f14d4505c254e8f097d (patch)
tree8f99d0d3950db5c6171d9ed06bbbdb28f896e4d8 /sca-java-2.x/trunk/modules
parentc526245f6de45f24c78745ef4c33f4e336ea3606 (diff)
Fix the entity consumption
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1392211 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java
index b6c7312edc..2ec467a61f 100644
--- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java
@@ -55,7 +55,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.client.HttpClient;
-import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.ByteArrayEntity;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.WireFormat;
import org.apache.tuscany.sca.binding.rest.RESTBinding;
@@ -284,14 +284,9 @@ public class RESTBindingInvoker implements Invoker {
} catch (ClientWebException e) {
ClientResponse clientResponse = e.getResponse();
// Consume the entity
- String error = clientResponse.getEntity(String.class);
- StringEntity stringEntity;
- try {
- stringEntity = error == null ? null : new StringEntity(error);
- clientResponse.setEntity(stringEntity);
- } catch (UnsupportedEncodingException e1) {
- // Ignore
- }
+ byte[] error = clientResponse.getEntity(byte[].class);
+ ByteArrayEntity errorEntity = error == null ? null : new ByteArrayEntity(error);
+ clientResponse.setEntity(errorEntity);
throw e;
}
return msg;