geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: rev 47370 - geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main
Date Tue, 28 Sep 2004 01:49:44 GMT
Author: dblevins
Date: Mon Sep 27 18:49:43 2004
New Revision: 47370

Modified:
   geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ExceptionUtil.java
Log:
Don't exclude the top of the trace if it starts with things in the exclude list.


Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ExceptionUtil.java
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ExceptionUtil.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ExceptionUtil.java
Mon Sep 27 18:49:43 2004
@@ -39,22 +39,39 @@
         StackTraceElement[] trace = t.getStackTrace();
         ArrayList list = new ArrayList();
 
-        TRIM: for (int i = 0; i < trace.length; i++) {
-            String className = trace[i].getClassName();
-            for (int j = 0; j < excludedPackages.length; j++) {
-                if (className.startsWith(excludedPackages[j])) {
-                    continue TRIM;
-                }
-            }
-            for (int j = 0; j < excludedStrings.length; j++) {
-                if (className.indexOf(excludedStrings[j]) != -1) {
-                    continue TRIM;
-                }
+        boolean skip = true;
+
+        int i = 0;
+
+        // If the start of the stack trace is something
+        // on the exclude list, don't exclude it.
+        for (; i < trace.length && skip; i++) {
+            skip = skip && isExcluded(trace[i].getClassName());
+        }
+        list.add(trace[i-1]);
+
+
+        for (; i < trace.length; i++) {
+            if ( !isExcluded(trace[i].getClassName()) ){
+                list.add(trace[i]);
             }
-            list.add(trace[i]);
         }
 
         t.setStackTrace((StackTraceElement[]) list.toArray(new StackTraceElement[0]));
         trimStackTrace(t.getCause());
+    }
+
+    private static boolean isExcluded(String className) {
+        for (int j = 0; j < excludedPackages.length; j++) {
+            if (className.startsWith(excludedPackages[j])) {
+                return true;
+            }
+        }
+        for (int j = 0; j < excludedStrings.length; j++) {
+            if (className.indexOf(excludedStrings[j]) != -1) {
+                return true;
+            }
+        }
+        return false;
     }
 }

Mime
View raw message