// The Fault has no Message. This is the case if t had
// no message, for
// example was a NullPointerException.
fault.setMessage(t.getClass().getSimpleName());
}
WebFault faultAnnotation = t.getClass().getAnnotation(WebFault.class);
Object faultInfo = null;
try {
Method method = t.getClass().getMethod("getFaultInfo", new Class[0]);
faultInfo = method.invoke(t, new Object[0]);
} catch (Exception e) {
// do nothing here
}
if (faultAnnotation != null && faultInfo == null) {
// t has a JAX-WS WebFault annotation, which describes
// in detail the Web Service Fault that should be thrown. Add the
// detail.
Element detail = fault.getOrCreateDetail();
Element faultDetails = detail.getOwnerDocument()
.createElementNS(faultAnnotation.targetNamespace(), faultAnnotation.name());
detail.appendChild(faultDetails);
}
throw fault;
}