From c7f2404b970ab5a745815c9388fa0f5a6d4b67d3 Mon Sep 17 00:00:00 2001 From: Daniel Rall Date: Wed, 25 Sep 2002 05:50:49 +0000 Subject: [PATCH] Corrected semantics of ExceptionWithoutCause broken in CVS rev 1.3. The point of the ExceptionWithoutCause is to test for false-positive nested exception method signature matches. Documented this in the header JavaDoc for both the ExceptionWithCause and ExceptionWithoutCause classes, and changed the nested exception method name of the latter from getCause() to getTargetException() to avoid conflicts with getCause() method of JDK 1.4's Exception class (which returns Throwable). git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137060 13f79535-47bb-0310-9956-ffa450edef68 --- .../lang/exception/ExceptionUtilsTestCase.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java b/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java index 023d7da5b..6abe20925 100644 --- a/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java +++ b/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java @@ -107,6 +107,11 @@ public class ExceptionUtilsTestCase extends junit.framework.TestCase assertEquals(ExceptionUtils.getThrowableCount(null), 0); } + /** + * Provides a method with a well known chained/nested exception + * name which matches the full signature (e.g. has a return value + * of Throwable. + */ private static class ExceptionWithCause extends Exception { private Throwable cause; @@ -122,11 +127,15 @@ public class ExceptionUtilsTestCase extends junit.framework.TestCase } } + /** + * Provides a method with a well known chained/nested exception + * name which does not match the full signature (e.g. lacks a + * return value of Throwable. + */ private static class ExceptionWithoutCause extends Exception { - public Throwable getCause() + public void getTargetException() { - return null; } } }