sw.append("<[CDATA[");
sw.append("<![CDATA[");
    public static String createComponentMessage(Message msg) {        try {            StringBuffer sw = new StringBuffer();            // component-task-result            sw.append("<component-task-result ");            sw.append("xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\">");            sw.append("\n\t");            // component-name            sw.append("<component-name>");            sw.append(msg.getComponent());            sw.append("</component-name>");            // component-task-result-details            sw.append("\n\t");            sw.append("<component-task-result-details>");            // task-result-details            sw.append("\n\t\t");            sw.append("<task-result-details>");            // task-id            sw.append("\n\t\t\t");            sw.append("<task-id>");            sw.append(msg.getTask());            sw.append("</task-id>");            // task-result            sw.append("\n\t\t\t");            sw.append("<task-result>");            sw.append(msg.getResult());            sw.append("</task-result>");            // message-type            if (msg.getType() != null) {                sw.append("\n\t\t\t");                sw.append("<message-type>");                sw.append(msg.getType());                sw.append("</message-type>");            }            // task-status-message            if (msg.getMessage() != null) {                sw.append("\n\t\t\t");                sw.append("<task-status-message>");                sw.append("<msg-loc-info>");                sw.append("<loc-token/>");                sw.append("<loc-message>");                sw.append(msg.getMessage());                sw.append("</loc-message>");                sw.append("</msg-loc-info>");                sw.append("</task-status-message>");            }            // exception-info            if (msg.getException() != null) {                sw.append("\n\t\t\t");                sw.append("<exception-info>");                sw.append("\n\t\t\t\t");                sw.append("<nesting-level>1</nesting-level>");                sw.append("\n\t\t\t\t");                sw.append("<msg-loc-info>");                sw.append("\n\t\t\t\t\t");                sw.append("<loc-token />");                sw.append("\n\t\t\t\t\t");                sw.append("<loc-message>");                sw.append(msg.getException().getMessage());                sw.append("</loc-message>");                sw.append("\n\t\t\t\t\t");                sw.append("<stack-trace>");                StringWriter sw2 = new StringWriter();                PrintWriter pw = new PrintWriter(sw2);                msg.getException().printStackTrace(pw);                pw.close();                sw.append("<[CDATA[");                sw.append(sw2.toString());                sw.append("]]>");                sw.append("</stack-trace>");                sw.append("\n\t\t\t\t");                sw.append("</msg-loc-info>");                sw.append("\n\t\t\t");                sw.append("</exception-info>");            }            // end: task-result-details            sw.append("\n\t\t");            sw.append("</task-result-details>");            // end: component-task-result-details            sw.append("\n\t");            sw.append("</component-task-result-details>");            // end: component-task-result            sw.append("\n");            sw.append("</component-task-result>");            // return result            return sw.toString();        } catch (Exception e) {            logger.warn("Error generating component management message", e);            return null;        }    }