This content has been marked as final.
Show 1 reply
-
1. Re: CXF UserException not support?
riue Oct 20, 2008 8:47 AM (in response to haru01)Maybe this is a JBossWS-CXF's bug. JBossWS-CXF wraps all Exception in a RuntimeException and throws it. CXF is catching it, but it can't do nothing.
I fixed this problem by modified jbossws-cxf-3.0.3.GA/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java like that. See below.protected void handleException(Exception ex, Exchange exchange, Method m) { Throwable th = ex; if (ex instanceof InvocationTargetException) { th = ((InvocationTargetException)ex).getTargetException(); if (th != null) { for (Class<?> cl : m.getExceptionTypes()) { if (cl.isInstance(th)) { exchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT); throw new Fault(th); } } if (th instanceof Fault) { exchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT); throw (Fault)th; } } } exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); if (th instanceof Fault) throw (Fault)th; throw new Fault(th); }