From b0a7e3cf4a65ea95c79cf002596428d0aed2e26e Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 22 May 2007 23:30:15 +0000
Subject: [PATCH] Remove the dependence on AspectJ for all non method-entry and method-exit related debug messages. All debug statements will now work w/o  weaving enabled. However, method-entry and method-exit debug messages work only with weaving enabled.

---
 opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java |   37 +++++++++++++------------------------
 1 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java b/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
index f8b85b4..5da3423 100644
--- a/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
+++ b/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
@@ -94,7 +94,7 @@
         // Skip leading frames debug logging classes
         while (firstFrame < frames.length &&
             isFrameForPackage(frames[firstFrame],
-                              "org.opends.server.loggers")) {
+                              "org.opends.server.loggers.debug")) {
           firstFrame++;
         }
 
@@ -123,32 +123,26 @@
    */
   public static String formatStackTrace(Throwable t)
   {
-    return formatStackTrace(t, null, COMPLETE_STACK, true);
+    return formatStackTrace(t, COMPLETE_STACK, true);
   }
 
   /**
    * Generate a String representation of the possibly filtered stack trace
    * of the given Throwable.
    * @param t - the Throwable for which to generate the stack trace.
-   * @param filter - a FrameFilter to use to exclude some stack frames from
-   * the trace.  If null, no filtering is performed.
    * @param maxDepth - the maximum number of stack frames to include in the
    * trace.
    * @param includeCause - also include the stack trace for the cause Throwable.
    * @return the stack trace.
    */
-  public static String formatStackTrace(Throwable t, FrameFilter filter,
-                                        int maxDepth, boolean includeCause)
+  public static String formatStackTrace(Throwable t, int maxDepth,
+                                        boolean includeCause)
   {
     StringBuffer buffer= new StringBuffer();
 
     while(t != null)
     {
       StackTraceElement[] frames = t.getStackTrace();
-      if(filter != null)
-      {
-        frames = filter.getFilteredStackTrace(frames);
-      }
 
       if (frames != null) {
         int frameLimit=  Math.min(maxDepth, frames.length);
@@ -188,37 +182,32 @@
   /**
    * Generate a String representation of the possibly filtered stack trace
    * from the current position in executation.
-   * @param filter - a FrameFilter to use to exclude some stack frames from
-   * the trace.  If null, no filtering is performed.
+   *
+   * @param stackTrace - The stack trace elements to format.
    * @param maxDepth - the maximum number of stack frames to include in the
    * trace.
    * @return the stack trace.
    */
-  public static String formatStackTrace(FrameFilter filter, int maxDepth)
+  public static String formatStackTrace(StackTraceElement[] stackTrace,
+                                        int maxDepth)
   {
     StringBuffer buffer= new StringBuffer();
 
-    StackTraceElement[] frames = Thread.currentThread().getStackTrace();
-    if(filter != null)
-    {
-      frames = filter.getFilteredStackTrace(frames);
-    }
-
-    if (frames != null) {
-      int frameLimit=  Math.min(maxDepth, frames.length);
+    if (stackTrace != null) {
+      int frameLimit=  Math.min(maxDepth, stackTrace.length);
       if (frameLimit > 0) {
 
 
         for (int i= 0; i < frameLimit; i++) {
           buffer.append("  ");
-          buffer.append(frames[i]);
+          buffer.append(stackTrace[i]);
           buffer.append(EOL);
         }
 
-        if(frameLimit < frames.length)
+        if(frameLimit < stackTrace.length)
         {
           buffer.append("  ...(");
-          buffer.append(frames.length - frameLimit);
+          buffer.append(stackTrace.length - frameLimit);
           buffer.append(" more)");
           buffer.append(EOL);
         }

--
Gitblit v1.10.0