private static Message getFaultMessage(final QName code, final String description, final String detail, final Throwable th)
{
final Message message = MessageFactory.getInstance().getMessage() ;
final Body body = message.getBody() ;
final Fault fault = message.getFault() ;
if (th != null)
{
fault.setCause(th);
fault.setReason(th.toString()) ;
}
fault.setCode(URI.create(Factory.PROCESSING_ERROR)) ;
body.add(Fault.DETAIL_CODE_CONTENT, code) ;
if (description != null)
{
body.add(Fault.DETAIL_DESCRIPTION_CONTENT, description) ;
}
if (detail != null)
{
body.add(Fault.DETAIL_DETAIL_CONTENT, detail) ;
}
fault.setReason(description) ;
return message ;
}