com.unitedinternet.portal.selenium.utils.logging
Class StackTraceUtils

java.lang.Object
  extended by com.unitedinternet.portal.selenium.utils.logging.StackTraceUtils

public final class StackTraceUtils
extends java.lang.Object

Utility Methods to support searching in StackStraces related to Selenium and the logging extension.

Author:
Robert Zimmermann $Id: StackTraceUtils.java 52 2008-02-05 19:58:00Z bobbyde $

Field Summary
static java.lang.String LINE_NUMBER_SEPARATOR
          for the string representation of calling code.
 
Method Summary
static void debugStackTrace()
          Debugs on stderr the current stack-trace.
static java.lang.StackTraceElement getCurrentCallingClassAsStackTraceElement(java.lang.StackTraceElement[] testElements, java.lang.String preceedingClassName)
          Search through the current StackTrace looking for the first element after preceedingClassName.
static boolean isClassInStackTrace(java.lang.StackTraceElement[] testElements, java.lang.String className)
          Is named class in StackTrace Array?
static boolean isClassName(java.lang.StackTraceElement stackTraceElement, java.lang.String wantedClassName)
          Compare Helper.
static java.lang.String stackTraceElementWithLinenumberAsString(java.lang.StackTraceElement stackTraceElement)
          Generates a string representation of the current class with linenumber.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_NUMBER_SEPARATOR

public static final java.lang.String LINE_NUMBER_SEPARATOR
for the string representation of calling code.

See Also:
Constant Field Values
Method Detail

debugStackTrace

public static void debugStackTrace()
Debugs on stderr the current stack-trace.


stackTraceElementWithLinenumberAsString

public static java.lang.String stackTraceElementWithLinenumberAsString(java.lang.StackTraceElement stackTraceElement)
Generates a string representation of the current class with linenumber.

Parameters:
stackTraceElement - to get class name and linenumber
Returns:
string representation

isClassName

public static boolean isClassName(java.lang.StackTraceElement stackTraceElement,
                                  java.lang.String wantedClassName)
Compare Helper.

Parameters:
stackTraceElement - search className here
wantedClassName - search for this name
Returns:
found or not

getCurrentCallingClassAsStackTraceElement

public static java.lang.StackTraceElement getCurrentCallingClassAsStackTraceElement(java.lang.StackTraceElement[] testElements,
                                                                                    java.lang.String preceedingClassName)
Search through the current StackTrace looking for the first element after preceedingClassName.

Parameters:
testElements - StackTrace Array to be searched in
preceedingClassName - ClassName to be just before wanted element in the trace
Returns:
element following preceedingClassName or preceedingClassName if no further element left. null if preceedingClassName wasn't there

isClassInStackTrace

public static boolean isClassInStackTrace(java.lang.StackTraceElement[] testElements,
                                          java.lang.String className)
Is named class in StackTrace Array?

Parameters:
testElements - StackTrace Array to be searched in
className - ClassName to be searcher for
Returns:
true if class seen in testElements false else


Copyright © 2009. All Rights Reserved.