RuntimePermission
RuntimePermissionrelates to Java’s security mechanism and is not examined further here.
Throwable
TheThrowableclass supports Java’s exception-handling system and is the class from which
all exception classes are derived. It is discussed in Chapter 10.
SecurityManager
SecurityManageris a class that your classes can subclass to create a security manager.
Generally, you don’t need to implement your own security manager. If you do, you need
to consult the documentation that comes with your Java development system.
StackTraceElement
TheStackTraceElementclass describes a singlestack frame,which is an individual element
of a stack trace when an exception occurs. Each stack frame represents anexecution point,
which includes such things as the name of the class, the name of the method, the name of
the file, and the source-code line number. An array ofStackTraceElements is returned by
thegetStackTrace( )method of theThrowableclass.
StackTraceElementhas one constructor:
StackTraceElement(StringclassName, StringmethName, stringfileName, intline)
Here, the name of the class is specified byclassName,the name of the method is specified in
methName,the name of the file is specified byfileName,and the line number is passed inline.
If there is no valid line number, use a negative value forline.Furthermore, a value of –2 for
lineindicates that this frame refers to a native method.
The methods supported byStackTraceElementare shown in Table 16-20. These
methods give you programmatic access to a stack trace.
Chapter 16: Exploring java.lang 431
Method Description
boolean equals(Objectob) Returnstrueif the invokingStackTraceElementis the same as the
one passed inob.Other wise, it returnsfalse.
String getClassName( ) Returns the class name of the execution point described by the
invokingStackTraceElement.
String getFileName( ) Returns the filename of the execution point described by the
invokingStackTraceElement.
TABLE 16-20 The Methods Defined byStackTraceElement