Class ExceptionTableEntry

java.lang.Object
org.fife.rsta.ac.java.classreader.ExceptionTableEntry

public class ExceptionTableEntry extends Object
An entry in the exception table of a Code attribute. This denotes either a catch or finally block (the section of code it covers, the type of Throwable it handles, and the location of the exception handler code).
Version:
1.0
  • Field Details

    • cf

      private ClassFile cf
      The parent class file.
    • startPC

      private int startPC
      Start of the range in the code array at which the exception handler is active.
    • endPC

      private int endPC
      End of the range in the code array at which the exception handler is active. This value must be either a valid index into the code array of the opcode of an instruction, or be equal to Code.getCodeLength().
    • handlerPC

      private int handlerPC
      The start of the exception handler. This value must be a valid index into the code array and must be the index of the opcode of an instruction.
    • catchType

      private int catchType
      If the value of catchType is nonzero, it must be a valid index into the constant pool. The constant pool entry at that index must be a ConstantClassInfo structure representing a class of exceptions that this exception handler is designated to catch. This class must be the class Throwable or one of its subclasses. The exception handler will be called only if the thrown exception is an instance of the given class or one of its subclasses.

      If the value of catchType is zero, this exception handler is for all exceptions. This is used to implement finally.

  • Constructor Details

    • ExceptionTableEntry

      public ExceptionTableEntry(ClassFile cf)
      Constructor.
      Parameters:
      cf - The parent class file.
  • Method Details

    • getCaughtThrowableType

      public String getCaughtThrowableType(boolean fullyQualified)
      Returns the name of the Throwable type caught and handled by this exception handler.
      Parameters:
      fullyQualified - Whether the name should be fully qualified.
      Returns:
      The name of the Throwable type, or null if this entry denotes a finally block.
    • getEndPC

      public int getEndPC()
    • getHandlerPC

      public int getHandlerPC()
    • getStartPC

      public int getStartPC()
    • read

      public static ExceptionTableEntry read(ClassFile cf, DataInputStream in) throws IOException
      Reads an exception table entry from an input stream.
      Parameters:
      cf - The class file.
      in - The input stream to read from.
      Returns:
      The exception table entry.
      Throws:
      IOException - If an IO error occurs.