Skip to content

Commit

Permalink
Emasculated MathException secalization test to work under jdk 1.3.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@201820 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
psteitz committed Jun 26, 2005
1 parent a5c011a commit 6161ecd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/test/org/apache/commons/math/MathExceptionTest.java
Expand Up @@ -113,6 +113,22 @@ public void testSerialization() {
PrintWriter pw2 = new PrintWriter(ps2, true);
image.printStackTrace(ps2);
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);
}
}
}

0 comments on commit 6161ecd

Please sign in to comment.