commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r201820 - /jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/MathExceptionTest.java
Date Sun, 26 Jun 2005 09:59:26 GMT
Author: psteitz
Date: Sat Jun 25 20:26:42 2005
New Revision: 201820

URL: http://svn.apache.org/viewcvs?rev=201820&view=rev
Log:
Emasculated MathException secalization test to work under jdk 1.3.

Modified:
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/MathExceptionTest.java

Modified: jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/MathExceptionTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/MathExceptionTest.java?rev=201820&r1=201819&r2=201820&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/MathExceptionTest.java
(original)
+++ jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/MathExceptionTest.java
Sat Jun 25 20:26:42 2005
@@ -113,6 +113,22 @@
         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);
+        }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message