1 25 26 package org.netbeans.modules.classfile; 27 28 import java.io.DataInputStream ; 29 import java.io.IOException ; 30 31 36 public final class ExceptionTableEntry { 37 38 int startPC; 39 int endPC; 40 int handlerPC; 41 CPClassInfo catchType; 43 static ExceptionTableEntry[] loadExceptionTable(DataInputStream in, ConstantPool pool) 44 throws IOException { 45 int n = in.readUnsignedShort(); 46 ExceptionTableEntry[] exceptions = new ExceptionTableEntry[n]; 47 for (int i = 0; i < n; i++) 48 exceptions[i] = new ExceptionTableEntry(in, pool); 49 return exceptions; 50 } 51 52 53 ExceptionTableEntry(DataInputStream in, ConstantPool pool) 54 throws IOException { 55 loadExceptionEntry(in, pool); 56 } 57 58 private void loadExceptionEntry(DataInputStream in, ConstantPool pool) 59 throws IOException { 60 startPC = in.readUnsignedShort(); 61 endPC = in.readUnsignedShort(); 62 handlerPC = in.readUnsignedShort(); 63 int typeIndex = in.readUnsignedShort(); 64 if (typeIndex != 0) try { 66 catchType = pool.getClass(typeIndex); 67 } catch (IndexOutOfBoundsException e) { 68 throw new InvalidClassFileAttributeException( 69 "invalid catchType (" + typeIndex + ") in exception table entry", e); 70 } 71 } 72 73 77 public final int getStartPC() { 78 return startPC; 79 } 80 81 86 public final int getEndPC() { 87 return endPC; 88 } 89 90 94 public final int getHandlerPC() { 95 return handlerPC; 96 } 97 98 103 public final CPClassInfo getCatchType() { 104 return catchType; 105 } 106 } 107 | Popular Tags |