use of com.sun.xml.ws.encoding.soap.SerializationException in project metro-jax-ws by eclipse-ee4j.
the class SOAPFaultBuilder method createDetailFromUserDefinedException.
private static Object createDetailFromUserDefinedException(CheckedExceptionImpl ce, Object exception) {
Class detailBean = ce.getDetailBean();
if (ce.getExceptionClass().equals(detailBean))
return exception;
Field[] fields = detailBean.getDeclaredFields();
try {
Object detail = detailBean.newInstance();
for (Field f : fields) {
Method em = exception.getClass().getMethod(getReadMethod(f));
try {
Method sm = detailBean.getMethod(getWriteMethod(f), em.getReturnType());
sm.invoke(detail, em.invoke(exception));
} catch (NoSuchMethodException ne) {
// Try to use exception bean's public field to populate the value.
Field sf = detailBean.getField(f.getName());
sf.set(detail, em.invoke(exception));
}
}
return detail;
} catch (Exception e) {
throw new SerializationException(e);
}
}
Aggregations