/** * Wraps an execption into a MuleMessage with an Exception payload and returns the Xml * representation of it * * @param result the result of the invocation or null if the exception occurred before or during * the invocation * @param e the Exception thrown * @return an Xml String message result */ protected String handleException(UMOMessage result, Throwable e) { logger.error("Failed to process admin request: " + e.getMessage(), e); if (result == null) { result = new MuleMessage(new NullPayload(), (Map) null); } result.setExceptionPayload(new ExceptionPayload(e)); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, result); return out.toString(MuleManager.getConfiguration().getEncoding()); } catch (Exception e1) { logger.error(e.toString(), e); return e.getMessage(); } }