Top Description Fields Constructors Methods
org.apache.bcel.classfile

public final Class CodeException

extends Object
implements Cloneable, Node, Constants
Class Inheritance
All Implemented Interfaces
org.apache.bcel.Constants, org.apache.bcel.classfile.Node, java.lang.Cloneable
Imports
java.io.DataInput, .DataOutputStream, .IOException, org.apache.bcel.Const, .Constants, org.apache.bcel.util.Args

Deprecated

as a consequence of Constants being deprecated. See corresponding docs for further information.

This class represents an entry in the exception table of the Code attribute and is used only there. It contains a range in which a particular exception handler is active.
Code_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 max_stack;
  u2 max_locals;
  u4 code_length;
  u1 code[code_length];
  u2 exception_table_length;
  {
    u2 start_pc;
    u2 end_pc;
    u2 handler_pc;
    u2 catch_type;
  } exception_table[exception_table_length];
  u2 attributes_count;
  attribute_info attributes[attributes_count];
}
See Also
Code

Field Summary

Modifier and TypeField and Description
private int
pack-priv static final CodeException[]
private int
endPc

Active.

private int
handlerPc

Starting address of exception handler, i.e., an offset from start of code.

private int
startPc

Range in the code the exception handler.

Constructor Summary

AccessConstructor and Description
public
CodeException(final CodeException
Source for copying.
c
)

Deprecated as a consequence of CodeException being deprecated.
Constructs a new instance from another instance.
pack-priv
CodeException(final DataInput
Input stream
file
)

Constructs a new instance from a DataInput.

public
CodeException(final int
Range in the code the exception handler is active, startPc is inclusive while
startPc
,
final int
is exclusive
endPc
,
final int
Starting address of exception handler, i.e., an offset from start of code.
handlerPc
,
final int
If zero the handler catches any exception, otherwise it points to the exception class which is to be caught.
catchType
)

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
public CodeException

Returns:

deep copy of this object
copy
()

Deprecated as a consequence of CodeException being deprecated.
public void
dump(final DataOutputStream
Output file stream
file
)

Dumps code exception to file stream in binary format.

public int

Returns:

0, if the handler catches any exception, otherwise it points to the exception class which is to be caught.
getCatchType
()

public int

Returns:

Exclusive end index of the region where the handler is active.
getEndPC
()

public int

Returns:

Starting address of exception handler, relative to the code.
getHandlerPC
()

public int

Returns:

Inclusive start index of the region where the handler is active.
getStartPC
()

public void
setCatchType(final int
the type of exception that is caught
catchType
)

public void
setEndPC(final int
end of handled block
endPc
)

public void
setHandlerPC(final int
where the actual code is
handlerPc
)

public void
setStartPC(final int
start of handled block
startPc
)

public String

Returns:

String representation.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public String
public String

Returns:

String representation.
toString
(final ConstantPool
constant pool source.
cp
,
final boolean
Output more if true.
verbose
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

catchTypeback to summary
private int catchType
EMPTY_CODE_EXCEPTION_ARRAYback to summary
pack-priv static final CodeException[] EMPTY_CODE_EXCEPTION_ARRAY

Deprecated

as a consequence of CodeException being deprecated. See corresponding docs for further information.

Empty array.

endPcback to summary
private int endPc

Active. startPc is inclusive, endPc exclusive.

handlerPcback to summary
private int handlerPc

Starting address of exception handler, i.e., an offset from start of code.

startPcback to summary
private int startPc

Range in the code the exception handler.

Constructor Detail

CodeExceptionback to summary
public CodeException(final CodeException c)

Deprecated

as a consequence of CodeException being deprecated. See corresponding docs for further information.

Constructs a new instance from another instance.

Parameters
c:CodeException

Source for copying.

CodeExceptionback to summary
pack-priv CodeException(final DataInput file) throws IOException

Constructs a new instance from a DataInput.

Parameters
file:DataInput

Input stream

Exceptions
IOException:
if an I/O error occurs.
CodeExceptionback to summary
public CodeException(final int startPc, final int endPc, final int handlerPc, final int catchType)

Constructs a new instance.

Parameters
startPc:int

Range in the code the exception handler is active, startPc is inclusive while

endPc:int

is exclusive

handlerPc:int

Starting address of exception handler, i.e., an offset from start of code.

catchType:int

If zero the handler catches any exception, otherwise it points to the exception class which is to be caught.

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
copyback to summary
public CodeException copy()

Deprecated

as a consequence of CodeException being deprecated. See corresponding docs for further information.

Returns:CodeException

deep copy of this object

dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Dumps code exception to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Exceptions
IOException:
if an I/O error occurs.
getCatchTypeback to summary
public int getCatchType()
Returns:int

0, if the handler catches any exception, otherwise it points to the exception class which is to be caught.

getEndPCback to summary
public int getEndPC()
Returns:int

Exclusive end index of the region where the handler is active.

getHandlerPCback to summary
public int getHandlerPC()
Returns:int

Starting address of exception handler, relative to the code.

getStartPCback to summary
public int getStartPC()
Returns:int

Inclusive start index of the region where the handler is active.

setCatchTypeback to summary
public void setCatchType(final int catchType)
Parameters
catchType:int

the type of exception that is caught

setEndPCback to summary
public void setEndPC(final int endPc)
Parameters
endPc:int

end of handled block

setHandlerPCback to summary
public void setHandlerPC(final int handlerPc)
Parameters
handlerPc:int

where the actual code is

setStartPCback to summary
public void setStartPC(final int startPc)
Parameters
startPc:int

start of handled block

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

String representation.

Annotations
@Override
toStringback to summary
public String toString(final ConstantPool cp)
toStringback to summary
public String toString(final ConstantPool cp, final boolean verbose)
Parameters
cp:ConstantPool

constant pool source.

verbose:boolean

Output more if true.

Returns:String

String representation.