Class ExceptionTableEntry


  • public class ExceptionTableEntry
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      private int catchType
      If the value of catchType is nonzero, it must be a valid index into the constant pool.
      private ClassFile cf
      The parent class file.
      private int endPC
      End of the range in the code array at which the exception handler is active.
      private int handlerPC
      The start of the exception handler.
      private int startPC
      Start of the range in the code array at which the exception handler is active.
    • Field Detail

      • 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 Detail

      • ExceptionTableEntry

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

      • getCaughtThrowableType

        public java.lang.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,
                                               java.io.DataInputStream in)
                                        throws java.io.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:
        java.io.IOException - If an IO error occurs.