Emasculated MathException secalization test to work under jdk 1.3.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@201820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a5c011a640
commit
6161ecdc32
|
@ -113,6 +113,22 @@ public class MathExceptionTest extends TestCase {
|
||||||
PrintWriter pw2 = new PrintWriter(ps2, true);
|
PrintWriter pw2 = new PrintWriter(ps2, true);
|
||||||
image.printStackTrace(ps2);
|
image.printStackTrace(ps2);
|
||||||
String stack2 = baos2.toString();
|
String stack2 = baos2.toString();
|
||||||
assertEquals(stack, stack2);
|
|
||||||
|
// See if JDK supports nested exceptions. If not, stack trace of
|
||||||
|
// inner exception will not be serialized
|
||||||
|
boolean jdkSupportsNesting = false;
|
||||||
|
try {
|
||||||
|
Throwable.class.getDeclaredMethod("getCause", new Class[0]);
|
||||||
|
jdkSupportsNesting = true;
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
jdkSupportsNesting = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jdkSupportsNesting) {
|
||||||
|
assertEquals(stack, stack2);
|
||||||
|
} else {
|
||||||
|
assertTrue(stack2.indexOf(inMsg) != -1);
|
||||||
|
assertTrue(stack2.indexOf("MathConfigurationException") != -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue