[jboss-user] [JBossWS] - Re: CXF UserException not support?

riue do-not-reply at jboss.com
Mon Oct 20 08:47:40 EDT 2008


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);
  |    }
  | 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4183223#4183223

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4183223



More information about the jboss-user mailing list