uPortal 2.4.1
API Documentation

org.jasig.portal.lang
Class StackTrace

java.lang.Object
  extended byorg.jasig.portal.lang.StackTrace

public final class StackTrace
extends java.lang.Object

The StackTrace object represents a single stack frame of information. The entire set of stack frames is represented as an array of StackTrace object.

Note: The stack frame information is not always available because some JVMs strip some or all the required information.

Version:
"$Revision: 1.2 $"
Author:
Jan Nielsen

Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is another StackTrace instance representing the same execution point as this instance.
 java.lang.String getClassName()
          Returns the name of the class.
 java.lang.String getFileName()
          Returns the name of the source file.
 int getLineNumber()
          Returns the line number in the source file.
 java.lang.String getMethodName()
          Returns the name of the method.
static StackTrace[] getStackTrace()
          Returns the stack trace elements of the client.
static StackTrace getStackTrace(int index)
          Returns the specified stack trace element if it exists.
static StackTrace[] getStackTrace(java.lang.Throwable throwable)
          Returns all StackTraces in an array of the specified throwable.
 int hashCode()
          Returns a hash code value for this stack trace element.
 boolean isNativeMethod()
          Returns true if method is implemented natively.
 java.lang.String toString()
          Returns a representation of the stack frame element.
static java.lang.String toString(StackTrace[] elements)
          Returns a string representation of the stack trace elements.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getFileName

public final java.lang.String getFileName()
Returns the name of the source file. If the parser failed to find the source file name the value "Unknown" will be returned.

Returns:
name of the source file

getClassName

public final java.lang.String getClassName()
Returns the name of the class. The parser should always be able to identify the calling class.

Returns:
name of the class

getMethodName

public final java.lang.String getMethodName()
Returns the name of the method. The parser should alwas be able to identify the calling method name.

Returns:
name of the method

getLineNumber

public final int getLineNumber()
Returns the line number in the source file. If the parser is unable to determine the line number the value -1 will be returned. If the parser determines the method is a native, a -2 is returned.

Returns:
source code line number, or -1 or -2

isNativeMethod

public final boolean isNativeMethod()
Returns true if method is implemented natively.

Returns:
true is native method; otherwise false

getStackTrace

public static final StackTrace[] getStackTrace(java.lang.Throwable throwable)
Returns all StackTraces in an array of the specified throwable.

Parameters:
throwable - throwable being parsed
Returns:
array of StackTraces
Throws:
java.lang.NullPointerException - if throwable is null
java.lang.NullPointerException - if stackTrace is null
java.lang.IllegalArgumentException - if stackTrace is an empty string

getStackTrace

public static final StackTrace[] getStackTrace()
Returns the stack trace elements of the client. The array of stack trace elements start with the client's invoking frame in the zeroth element.

Returns:
array of stack trace elements of the client

getStackTrace

public static final StackTrace getStackTrace(int index)
Returns the specified stack trace element if it exists. If an invalid, either too large or too small, index is specified null is returned.

Parameters:
index - index of the stack trace element to return
Returns:
stack trace element at the index or null

toString

public final java.lang.String toString()
Returns a representation of the stack frame element. The format of the information may vary but the following examples are typical:

Returns:
string presentation of the stack frame.

toString

public static final java.lang.String toString(StackTrace[] elements)
Returns a string representation of the stack trace elements.

Parameters:
elements - stack trace elements to stringify
Returns:
string representation of the stack trace array

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified object is another StackTrace instance representing the same execution point as this instance. Two stack trace elements a and b are equal if and only if:

     equals(a.getFileName(), b.getFileName()) &&
     a.getLineNumber() == b.getLineNumber()) &&
     equals(a.getClassName(), b.getClassName()) &&
     equals(a.getMethodName(), b.getMethodName())
 
where equals is defined as:

     static boolean equals(Object a, Object b) {
         return a==b || (a != null && a.equals(b));
     }
 

Parameters:
obj - the object to be compared with this stack trace element
Returns:
true if the specified object is another StackTrace instance representing the same execution point as this instance; otherwise false

hashCode

public int hashCode()
Returns a hash code value for this stack trace element.

Returns:
hash code value

uPortal 2.4.1
API Documentation