/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { if (cause instanceof CmsMultiException) { CmsMultiException multiException = (CmsMultiException)cause; return new CmsMultiException(multiException.getExceptions()); } // not a multi exception, use standard handling return super.createException(container, cause); }
/** * Adds an exception thrown during a multi resource operation to the multi exception.<p> * * After iterating the dialog resources, use {@link #checkMultiOperationException(I_CmsMessageBundle, String)} to * display the multi exception depending on collected exceptions.<p> * * @param exc the exception that was thrown */ public void addMultiOperationException(CmsException exc) { m_multiOperationException.addException(exc); }
/** * Checks if an exception occurred during a multi resource operation, and throws a new exception if necessary.<p> * * @param messages the message bundle to use for the exception message generation * @param key the key for the exception to throw with one parameter * @throws CmsException the exception that is thrown when the multi operation was not successful */ public void checkMultiOperationException(I_CmsMessageBundle messages, String key) throws CmsException { if (m_multiOperationException.hasExceptions()) { m_multiOperationException.setMessage( new CmsMessageContainer(messages, key, new Object[] {m_multiOperationException})); throw m_multiOperationException; } }
} else { CmsMultiException resourceIssues = new CmsMultiException(); CmsMultiException permissionIssues = new CmsMultiException(); if (parent.getState().isDeleted()) { resourceIssues.addException(new CmsVfsException(Messages.get().container( Messages.ERR_DIRECT_PUBLISH_PARENT_DELETED_2, dbc.getRequestContext().removeSiteRoot(res.getRootPath()), resourceIssues.addException(new CmsVfsException(Messages.get().container( Messages.ERR_DIRECT_PUBLISH_PARENT_NEW_2, dbc.removeSiteRoot(res.getRootPath()), permissionIssues.addException(new CmsSecurityException(Messages.get().container( Messages.ERR_DIRECT_PUBLISH_NO_PERMISSIONS_1, dbc.removeSiteRoot(res.getRootPath())))); if (resourceIssues.hasExceptions() || permissionIssues.hasExceptions()) { resourceIssues.addExceptions(permissionIssues.getExceptions()); throw resourceIssues;
CmsMultiException me = new CmsMultiException(); me.addException(new CmsLockException(org.opencms.lock.Messages.get().container( org.opencms.lock.Messages.ERR_SIBLING_LOCKED_2, context.getSitePath(currentResource), if (!me.getExceptions().isEmpty()) { throw me;
/** * Adds an Exception to the list of Exceptions kept in this multi Exception.<p> * * @param exception the Exception to add */ public void addException(CmsException exception) { m_exceptions.add(exception); updateMessage(); }
/** * Creates a new multi exception using the given base message.<p> * * @param message the basic message to use */ public CmsMultiException(CmsMessageContainer message) { super(message); m_exceptions = new ArrayList<CmsException>(); setMessage(message); }
/** * Public constructor.<p> * * @param jsp an initialized JSP action element */ public CmsMultiDialog(CmsJspActionElement jsp) { super(jsp); m_multiOperationException = new CmsMultiException(); }
/** * Returns the individual message (if set) or an empty String.<p> * * @param locale the locale for the message to generate * @return the individual message (if set) or an empty String */ public String getMessage(Locale locale) { if (hasIndividualMessage()) { return m_message.key(locale); } return ""; }
if (m_throwable instanceof CmsMultiException) { CmsMultiException exc = (CmsMultiException)m_throwable; String message = exc.getMessage(m_locale); if (CmsStringUtil.isNotEmpty(message)) { result.append(message);
/** * Creates a new multi exception for the given list of <code>{@link CmsException}</code> instances.<p> * * @param exceptions a list of <code>{@link CmsException}</code> instances */ public CmsMultiException(List<CmsException> exceptions) { this(); setExceptions(exceptions); }
/** * Returns the stack trace (including the message) of an exception as a String.<p> * * If the exception is a CmsException, * also writes the root cause to the String.<p> * * @param e the exception to get the stack trace from * @return the stack trace of an exception as a String */ public static String getStackTraceAsString(Throwable e) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); if (e instanceof CmsMultiException) { CmsMultiException me = (CmsMultiException)e; Iterator it = me.getExceptions().iterator(); while (it.hasNext()) { Throwable t = (Throwable)it.next(); t.printStackTrace(printWriter); } } return stringWriter.toString(); }
} else { CmsMultiException resourceIssues = new CmsMultiException(); CmsMultiException permissionIssues = new CmsMultiException(); if (!(publishList.isUserPublishList() && publishList.getDeletedFolderList().contains(parent))) { resourceIssues.addException( new CmsVfsException( Messages.get().container( if (!(publishList.isUserPublishList() && publishList.getFolderList().contains(parent))) { resourceIssues.addException( new CmsVfsException( Messages.get().container( permissionIssues.addException( new CmsSecurityException( Messages.get().container( if (resourceIssues.hasExceptions() || permissionIssues.hasExceptions()) { resourceIssues.addExceptions(permissionIssues.getExceptions()); throw resourceIssues;
CmsMultiException me = new CmsMultiException(); me.addException( new CmsLockException( org.opencms.lock.Messages.get().container( if (!me.getExceptions().isEmpty()) { throw me;
/** * Adds all Exceptions in the given List to the list of Exceptions kept in this multi Exception.<p> * * @param exceptions the Exceptions to add */ public void addExceptions(List<CmsException> exceptions) { m_exceptions.addAll(exceptions); updateMessage(); }
/** * Creates a new multi exception using the given base message.<p> * * @param message the basic message to use */ public CmsMultiException(CmsMessageContainer message) { super(message); m_exceptions = new ArrayList(); setMessage(message); }
/** * Public constructor.<p> * * @param jsp an initialized JSP action element */ public CmsMultiDialog(CmsJspActionElement jsp) { super(jsp); m_multiOperationException = new CmsMultiException(); }
/** * Returns the individual message (if set) or an empty String.<p> * * @param locale the locale for the message to generate * @return the individual message (if set) or an empty String */ public String getMessage(Locale locale) { if (hasIndividualMessage()) { return m_message.key(locale); } return ""; }
if (m_throwable instanceof CmsMultiException) { CmsMultiException exc = (CmsMultiException)m_throwable; String message = exc.getMessage(m_locale); if (CmsStringUtil.isNotEmpty(message)) { result.append(message);
/** * Creates a new multi exception for the given list of <code>{@link CmsException}</code> instances.<p> * * @param exceptions a list of <code>{@link CmsException}</code> instances */ public CmsMultiException(List exceptions) { this(); setExceptions(exceptions); }