/** * Returns all exceptions which have the <CODE>causeType</CODE> and generated by a component of <CODE>componentInfo</CODE>. * * @param pageErrors * @param causeType * @return */ public static Collection<HstComponentException> getExceptionsByCauseType(PageErrors pageErrors, HstComponentInfo componentInfo, Class<? extends Throwable> causeType) { List<HstComponentException> exceptions = null; for (HstComponentException exception : pageErrors.getComponentExceptions(componentInfo)) { Throwable cause = exception.getCause(); if (cause != null && causeType.isAssignableFrom(cause.getClass())) { if (exceptions == null) { exceptions = new ArrayList<HstComponentException>(); } exceptions.add(exception); } } if (exceptions == null) { exceptions = Collections.emptyList(); } return exceptions; }
/** * Returns all exceptions which have the <CODE>causeType</CODE>. * * @param pageErrors * @param causeType * @return */ public static Collection<HstComponentException> getExceptionsByCauseType(PageErrors pageErrors, Class<? extends Throwable> causeType) { List<HstComponentException> exceptions = null; for (HstComponentException exception : pageErrors.getAllComponentExceptions()) { Throwable cause = exception.getCause(); if (cause != null && causeType.isAssignableFrom(cause.getClass())) { if (exceptions == null) { exceptions = new ArrayList<HstComponentException>(); } exceptions.add(exception); } } if (exceptions == null) { exceptions = Collections.emptyList(); } return exceptions; }
Throwable cause = exception.getCause();