diff options
Diffstat (limited to 'branches/sca-java-1.x')
-rw-r--r-- | branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java b/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java index 5b7485e3c2..0cd6286c87 100644 --- a/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java +++ b/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java @@ -120,41 +120,62 @@ public class JAXWSFaultExceptionMapper implements FaultExceptionMapper { } catch (Throwable e) { // Ignore } - try { - // FIXME: What about if the faultBeanClass is a subclass of the argument type? - ctor = exceptionClass.getConstructor(String.class, faultBeanClass, Throwable.class); - ex = ctor.newInstance(message, faultInfo, cause); - } catch (NoSuchMethodException e1) { + if (faultInfo == null) { try { - if (faultInfo != null) { - ctor = exceptionClass.getConstructor(String.class, faultInfo.getClass()); - ex = ctor.newInstance(message, faultInfo); - } else { + ctor = exceptionClass.getConstructor(String.class, Throwable.class); + ex = ctor.newInstance(message, cause); + } catch (NoSuchMethodException e1) { + try { ctor = exceptionClass.getConstructor(String.class); ex = ctor.newInstance(message); + } catch (NoSuchMethodException e2) { + try { + ctor = exceptionClass.getConstructor(Throwable.class); + ex = ctor.newInstance(cause); + } catch (NoSuchMethodException e3) { + ctor = exceptionClass.getConstructor(); + ex = ctor.newInstance(); + } } - } catch (NoSuchMethodException e2) { + } + } else { + try { + // FIXME: What about if the faultBeanClass is a subclass of the argument type? + ctor = exceptionClass.getConstructor(String.class, faultBeanClass, Throwable.class); + ex = ctor.newInstance(message, faultInfo, cause); + } catch (NoSuchMethodException e1) { try { - ctor = exceptionClass.getConstructor(String.class, Throwable.class); - ex = ctor.newInstance(message, cause); - populateException(ex, faultInfo); - } catch (NoSuchMethodException e3) { + ctor = exceptionClass.getConstructor(String.class, faultInfo.getClass()); + ex = ctor.newInstance(message, faultInfo); + } catch (NoSuchMethodException e2) { try { - ctor = exceptionClass.getConstructor(String.class); - ex = ctor.newInstance(message); + ctor = exceptionClass.getConstructor(String.class, Throwable.class); + ex = ctor.newInstance(message, cause); populateException(ex, faultInfo); - } catch (NoSuchMethodException e4) { - ctor = exceptionClass.getConstructor(); - if (ctor != null) { - ex = ctor.newInstance(); + } catch (NoSuchMethodException e3) { + try { + ctor = exceptionClass.getConstructor(String.class); + ex = ctor.newInstance(message); populateException(ex, faultInfo); - } else { - ex = new FaultException(message, faultInfo, cause); + } catch (NoSuchMethodException e4) { + try { + ctor = exceptionClass.getConstructor(); + if (ctor != null) { + ex = ctor.newInstance(); + populateException(ex, faultInfo); + } else { + ex = new FaultException(message, faultInfo, cause); + } + } catch (NoSuchMethodException e5) { + ctor = exceptionClass.getConstructor(); + ex = ctor.newInstance(); + } } } } } } + return ex; } |