Author: dkulp
Date: Thu Apr 5 20:58:35 2012
New Revision: 1310071
URL: http://svn.apache.org/viewvc?rev=1310071&view=rev
Log:
Get the async exceptions working
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServerAsyncResponse.java
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java?rev=1310071&r1=1310070&r2=1310071&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
Thu Apr 5 20:58:35 2012
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ExecutionException;
import javax.activation.DataHandler;
import javax.xml.ws.AsyncHandler;
@@ -47,6 +48,7 @@ import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.Attachment;
import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.FaultMode;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageContentsList;
import org.apache.cxf.message.MessageImpl;
@@ -148,12 +150,8 @@ public abstract class AbstractJAXWSMetho
public boolean isDone() {
return done;
}
- public Object getObject() {
- try {
- return r.get();
- } catch (Exception ex) {
- throw new Fault(ex);
- }
+ public Object getObject() throws Exception {
+ return r.get();
}
}
@@ -167,7 +165,15 @@ public abstract class AbstractJAXWSMetho
if (bop.isUnwrapped()) {
exchange.put(BindingOperationInfo.class,
bop.getWrappedOperation());
}
- return new MessageContentsList(h.getObject());
+ try {
+ return new MessageContentsList(h.getObject());
+ } catch (ExecutionException ex) {
+ exchange.getInMessage().put(FaultMode.class,
+
FaultMode.CHECKED_APPLICATION_FAULT);
+ throw createFault(ex.getCause(), m, params, true);
+ } catch (Exception ex) {
+ throw createFault(ex.getCause(), m, params, false);
+ }
}
Object o = super.invoke(exchange, serviceObject, m, params);
if (h != null && !h.hasContinuation()) {
@@ -176,7 +182,15 @@ public abstract class AbstractJAXWSMetho
if (bop.isUnwrapped()) {
exchange.put(BindingOperationInfo.class,
bop.getWrappedOperation());
}
- return new MessageContentsList(h.getObject());
+ try {
+ return new MessageContentsList(h.getObject());
+ } catch (ExecutionException ex) {
+ exchange.getInMessage().put(FaultMode.class,
+
FaultMode.CHECKED_APPLICATION_FAULT);
+ throw createFault(ex.getCause(), m, params, true);
+ } catch (Exception ex) {
+ throw createFault(ex.getCause(), m, params, false);
+ }
}
return o;
}
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServerAsyncResponse.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServerAsyncResponse.java?rev=1310071&r1=1310070&r2=1310071&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServerAsyncResponse.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServerAsyncResponse.java
Thu Apr 5 20:58:35 2012
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeoutExcep
public class ServerAsyncResponse<T> implements javax.xml.ws.Response<T> {
T value;
boolean done;
+ Throwable throwable;
/**
* Currently unused
@@ -51,17 +52,24 @@ public class ServerAsyncResponse<T> impl
done = true;
}
public T get() throws InterruptedException, ExecutionException {
+ if (throwable != null) {
+ throw new ExecutionException(throwable);
+ }
return value;
}
public T get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
return value;
}
-
+ public void exception(Throwable ex) {
+ throwable = ex;
+ done = true;
+ }
/**
* Currently unused
*/
public Map<String, Object> getContext() {
return null;
}
+
}