class ErrorBean {

    public String getExceptionStackTrace(Throwable t) {
        if (null == t) {
            return "";
        }

        LOGGER.log(Level.SEVERE, "Unexpected error condition", t);
        StringWriter sw = new StringWriter();
        try (PrintWriter w = new PrintWriter(sw)) {
            t.printStackTrace(w);
        }
        return sw.toString();
    }

}