sylvain 2003/04/10 06:59:33
Modified: src/java/org/apache/cocoon/selection ExceptionSelector.java Log: Enhancement proposed by <[EMAIL PROTECTED]> and <[EMAIL PROTECTED]> Revision Changes Path 1.2 +8 -5 cocoon-2.1/src/java/org/apache/cocoon/selection/ExceptionSelector.java Index: ExceptionSelector.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/selection/ExceptionSelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ExceptionSelector.java 1 Apr 2003 21:25:09 -0000 1.1 +++ ExceptionSelector.java 10 Apr 2003 13:59:32 -0000 1.2 @@ -81,7 +81,7 @@ * <li>an exception can be unrolled, meaning we try to get its cause and then consider this cause for * the exception name</li> * Note that both "name" and "unroll" can be specified. In that case, we first try to unroll the exception, - * and if no cause is found, then the "name" attribute is considered. + * and if none of the causes has a name, then the "name" attribute is considered. * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @since 2.1 @@ -157,12 +157,15 @@ for (int i = 0; i < this.clazz.length; i++) { if (this.clazz[i].isInstance(thr)) { - //getLogger().debug("Throwable of class " + thr.getClass().getName() + " is instance of " + - // this.clazz[i].getName() + ". Name='" + this.name[i] + ", Unroll=" + this.unroll[i]); + // If exception needs to be unrolled, and it has a cause, + // return the cause name, if not null (recursively) if (this.unroll[i]) { Throwable cause = ExceptionUtils.getCause(thr); if (cause != null) { - return findName(cause); + String causeName = findName(cause); + if (causeName != null) { + return causeName; + } } }