From 95780d002acf282d9069cb296d37fe28f1e140ec Mon Sep 17 00:00:00 2001 From: codistmonk Date: Mon, 19 Jul 2010 19:22:33 +0000 Subject: [PATCH] [Aprog] Updated initialization and usage of Tools.DEBUG_STACK_OFFSET. git-svn-id: https://aprog.svn.sourceforge.net/svnroot/aprog/trunk@155 7cbf5e2b-b55d-4b93-acdd-c0d7b961df51 --- Aprog/src/net/sourceforge/aprog/tools/Tools.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Aprog/src/net/sourceforge/aprog/tools/Tools.java b/Aprog/src/net/sourceforge/aprog/tools/Tools.java index 13d6745..06e4b3c 100644 --- a/Aprog/src/net/sourceforge/aprog/tools/Tools.java +++ b/Aprog/src/net/sourceforge/aprog/tools/Tools.java @@ -475,9 +475,9 @@ public final class Tools { public static final Class getCallerClass() { final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - if (stackTrace.length > 3) { + if (stackTrace.length > DEBUG_STACK_OFFSET + 2) { try { - return Class.forName(stackTrace[3].getClassName()); + return Class.forName(stackTrace[DEBUG_STACK_OFFSET + 2].getClassName()); } catch (final ClassNotFoundException exception) { // Do nothing } @@ -655,11 +655,11 @@ public final class Tools { * @return *
Range: {@code [0 .. Integer.MAX_VALUE]} */ - public static final int getDebugStackOffset() { + private static final int getDebugStackOffset() { int result = 0; for (final StackTraceElement element : Thread.currentThread().getStackTrace()) { - if (element.getClassName().equals(getCallerClass().getName())) { + if (element.getClassName().equals(Tools.class.getName())) { break; } -- 2.11.4.GIT