/** * Creates the html code for the given error message and the * provided Exception.<p> * * @param errorMsg the error message to place in the html code * @param t the exception to add to the error message * * @return the html code for the error message */ private String createError(String errorMsg, Throwable t) { StringBuffer msg = new StringBuffer(); msg.append(errorMsg); msg.append("\n"); msg.append(t.getMessage()); msg.append("\n"); msg.append(CmsException.getStackTraceAsString(t)); return createError(msg.toString()); }
/** * Creates the html code for the given error message and the * provided Exception.<p> * * @param errorMsg the error message to place in the html code * @param t the exception to add to the error message * * @return the html code for the error message */ private String createError(String errorMsg, Throwable t) { StringBuffer msg = new StringBuffer(); msg.append(errorMsg); msg.append("\n"); msg.append(t.getMessage()); msg.append("\n"); msg.append(CmsException.getStackTraceAsString(t)); return createError(msg.toString()); }
/** * Internal method to parse and execute a setup script.<p> * * @param databaseKey the database variant of the script * @param sqlScript the name of the script * @param replacers the replacements to perform in the script * @param abortOnError if a error occurs this flag indicates if to continue or to abort */ private void executeSql(String databaseKey, String sqlScript, Map<String, String> replacers, boolean abortOnError) { String filename = null; try { filename = m_basePath + "setup" + File.separator + "database" + File.separator + databaseKey + File.separator + sqlScript; executeSql(new FileReader(filename), replacers, abortOnError); } catch (FileNotFoundException e) { if (m_errorLogging) { m_errors.add("Database setup SQL script not found: " + filename); m_errors.add(CmsException.getStackTraceAsString(e)); } } }
/** * Returns the formatted stack trace.<p> * * @return the formatted stack trace */ public String getStacktrace() { String stacktrace = CmsException.getStackTraceAsString(getLoginException()); stacktrace = CmsEncoder.escapeXml(stacktrace); return stacktrace; }
/** * Returns the formatted stack trace.<p> * * @return the formatted stack trace */ public String getStacktrace() { String stacktrace = CmsException.getStackTraceAsString(getLoginException()); stacktrace = CmsEncoder.escapeXml(stacktrace); return stacktrace; }
/** * Returns the HTML formatted error stack of a Throwable.<p> * * The error stack is used by the common error screen * that is displayed if an error occurs.<p> * * @param t the throwable to get the errorstack from * @return the formatted value of the errorstack parameter */ public static String getFormattedErrorstack(Throwable t) { String stacktrace = CmsException.getStackTraceAsString(t); if (CmsStringUtil.isEmpty(stacktrace)) { return ""; } else { stacktrace = CmsStringUtil.escapeJavaScript(stacktrace); stacktrace = CmsEncoder.escapeXml(stacktrace); StringBuffer result = new StringBuffer(256); result.append("<html><body style='background-color: Window; overflow: scroll;'><pre>"); result.append(stacktrace); result.append("</pre></body></html>"); return result.toString(); } }
System.out.println("Class not found exception: " + e); m_errors.add(Messages.get().getBundle().key(Messages.ERR_LOAD_JDBC_DRIVER_1, DbDriver)); m_errors.add(CmsException.getStackTraceAsString(e)); } catch (Exception e) { if (logErrors) { System.out.println("Exception: " + CmsException.getStackTraceAsString(e)); m_errors.add(CmsException.getStackTraceAsString(e));
/** * Returns the HTML formatted error stack of a Throwable.<p> * * The error stack is used by the common error screen * that is displayed if an error occurs.<p> * * @param t the throwable to get the errorstack from * @return the formatted value of the errorstack parameter */ public static String getFormattedErrorstack(Throwable t) { String stacktrace = CmsException.getStackTraceAsString(t); if (CmsStringUtil.isEmpty(stacktrace)) { return ""; } else { stacktrace = CmsStringUtil.escapeJavaScript(stacktrace); stacktrace = CmsEncoder.escapeXml(stacktrace); StringBuffer result = new StringBuffer(256); result.append( "<html><body style='background-color: /*begin-color Window*/#ffffff/*end-color*/; overflow: scroll;'><pre>"); result.append(stacktrace); result.append("</pre></body></html>"); return result.toString(); } }
html.append( "<p><b>The recommended value for running OpenCms is 16MB, please set it in your MySQL configuration (in your <code>my.ini</code> or <code>my.cnf</code> file).</b></p>\n"); html.append(CmsException.getStackTraceAsString(exception));
if (m_errorLogging) { m_errors.add("Error executing SQL statement: " + statement); m_errors.add(CmsException.getStackTraceAsString(e)); if (m_errorLogging) { m_errors.add("Error executing SQL statement: " + statement); m_errors.add(CmsException.getStackTraceAsString(e)); m_errors.add(CmsException.getStackTraceAsString(e));
buf.append("aT('"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n"); buf.append("<span class='throw'>"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n");
buf.append("aT('"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n"); buf.append("<span class='throw'>"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n");
/** * @see org.opencms.main.I_CmsRequestHandler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String) */ public void handle(HttpServletRequest req, HttpServletResponse res, String name) throws IOException { final HANDLER_NAMES handlerName = HANDLER_NAMES.valueOf(name); if (handlerName != null) { try { Context context = initializeRequest(req, res); if ((context.m_params.get(CommonParams.Q) != null) || (context.m_params.get(CommonParams.FQ) != null)) { switch (handlerName) { case SolrSelect: context.m_index.select(res, context.m_cms, context.m_query, true); break; case SolrSpell: context.m_index.spellCheck(res, context.m_cms, context.m_query); break; default: break; } } } catch (Exception e) { res.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); String message = Messages.get().getBundle().key(Messages.GUI_SOLR_UNEXPECTED_ERROR_0); String formattedException = CmsException.getStackTraceAsString(e).replace("\n", "<br/>"); res.getWriter().println( Messages.get().getBundle().key(Messages.GUI_SOLR_ERROR_HTML_1, message + formattedException)); } } }
String stacktrace = CmsException.getStackTraceAsString(exception); if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) { stacktrace = null;
report.println(e); } else { msg = CmsException.getStackTraceAsString(e);
report.println(e); } else { msg = CmsException.getStackTraceAsString(e);
report.println(Messages.get().container( Messages.RPT_DELETE_EXPIRED_FAILED_1, new String[] {CmsException.getStackTraceAsString(e)}), I_CmsReport.FORMAT_ERROR);
Messages.get().container( Messages.RPT_DELETE_EXPIRED_FAILED_1, new String[] {CmsException.getStackTraceAsString(e)}), I_CmsReport.FORMAT_ERROR);
CmsMessageContainer error = Messages.get().container( Messages.GUI_REPORT_LANGUAGEC0PY_ERROR_2, new String[] {m_copyresources[i], CmsException.getStackTraceAsString(f)});