db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r518814 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StreamsTest.java
Date Fri, 16 Mar 2007 00:24:20 GMT
Author: myrnavl
Date: Thu Mar 15 17:24:19 2007
New Revision: 518814

URL: http://svn.apache.org/viewvc?view=rev&rev=518814
Log:
DERBY-2318 - preventing a difference between jvms in how a new Throwable stack trace is presented
to cause a false test failure.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StreamsTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StreamsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StreamsTest.java?view=diff&rev=518814&r1=518813&r2=518814
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StreamsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StreamsTest.java
Thu Mar 15 17:24:19 2007
@@ -301,7 +301,17 @@
     
     private void whereAmI() {
         if (count == 0) {
-            readerStackLevel = new Throwable().getStackTrace().length;
+            // see DERBY-2318 - some jvms report a line like:
+            // at java.lang.Throwable<init>. Ignore all Throwable lines
+            // for the count.
+            if ((new Throwable().getStackTrace().toString()).indexOf(
+                    "java.lang.Throwable".toLowerCase()) >=0)
+            {
+                readerStackLevel = 
+                    new Throwable().getStackTrace().length - 1;
+            }
+            else
+                readerStackLevel = new Throwable().getStackTrace().length;
         }
     }
     
@@ -349,7 +359,17 @@
     
     private void whereAmI()  {
         if (count == 0) {
-            readerStackLevel = new Throwable().getStackTrace().length;
+            // see DERBY-2318 - some jvms report a line like:
+            // at java.lang.Throwable<init>. Ignore all Throwable lines
+            // for the count.
+            if ((new Throwable().getStackTrace().toString()).indexOf(
+                    "java.lang.Throwable".toLowerCase()) >=0)
+            {
+                readerStackLevel = 
+                    new Throwable().getStackTrace().length - 1;
+            }
+            else
+                readerStackLevel = new Throwable().getStackTrace().length;
         }
     }
     



Mime
View raw message