java.lang.Object
java.lang.StackTraceElement
- All Implemented Interfaces:
- Serializable
- See Also:
- Top Examples, Source Code,
Throwable.getStackTrace()
public boolean equals(Object obj)
- See Also:
Hashtable
, Object.hashCode()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getClassName()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getFileName()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getLineNumber()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getMethodName()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int hashCode()
- See Also:
Hashtable
, Object.equals(java.lang.Object)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isNativeMethod()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public StackTraceElement(String declaringClass,
String methodName,
String fileName,
int lineNumber)
- See Also:
- NullPointerException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String toString()
- See Also:
Throwable.printStackTrace()
, Object
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1359]Displaying stack trace in any part of the codes
By Anonymous on 2005/03/23 15:57:48 Rate
... //Some where in my code
displayStackTraceInformation ( new Throwable ( ) ) ;
...
public static boolean displayStackTraceInformation ( Throwable ex ) {
if ( null == ex ) {
System.out.println ( "Null stack trace reference! Bailing..." ) ;
return false;
}
StringBuffer sbMsg = new StringBuffer ( ) ;
StackTraceElement [ ] stackElements = ex.getStackTrace ( ) ;
sbMsg.append ( "The " + stackElements.length + " element"
+ ( ( stackElements.length == 1 ) ? "" : "s" )
+ " of the stack trace:\n" ) ;
for ( int lcv = 0; lcv < stackElements.length; lcv++ ) {
sbMsg.append ( "\n" + stackElements [ lcv ] .toString ( ) ) ;
}
System.out.println ( sbMsg.toString ( ) ) ;
return true;
}