cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r991324 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Date Tue, 31 Aug 2010 20:54:13 GMT
Author: sergeyb
Date: Tue Aug 31 20:54:13 2010
New Revision: 991324

URL: http://svn.apache.org/viewvc?rev=991324&view=rev
Log:
[CXF-2961] Applying a patch on behalf of Peter Easton, thanks

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=991324&r1=991323&r2=991324&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Tue
Aug 31 20:54:13 2010
@@ -598,6 +598,7 @@ public class WebClient extends AbstractC
 
     protected Response doChainedInvocation(String httpMethod, 
         MultivaluedMap<String, String> headers, Object body, Class<?> responseClass,
Type genericType) {
+        Throwable primaryError = null;
         
         URI uri = getCurrentURI();
         Message m = createMessage(httpMethod, headers, uri);
@@ -613,12 +614,18 @@ public class WebClient extends AbstractC
         
         try {
             m.getInterceptorChain().doIntercept(m);
+            primaryError = m.getExchange().get(Exception.class);
         } catch (Throwable ex) {
-            // we'd like a user to get the whole Response anyway if needed
+            primaryError = ex;
         }
+
         
         // TODO : this needs to be done in an inbound chain instead
         HttpURLConnection connect = (HttpURLConnection)m.get(HTTPConduit.KEY_HTTP_CONNECTION);
+        if (connect == null && primaryError != null) {
+            /** do we have a pre-connect error ? */
+            throw new WebApplicationException(primaryError);
+        }
         return handleResponse(connect, m, responseClass, genericType);
     }
     



Mime
View raw message