1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 import java.util.*; 37 38 import org.apache.log4j.*; 39 40 public class Exceptions_attribute extends Attribute_info { 41 private Collection exceptions = new LinkedList(); 42 43 public Exceptions_attribute(Classfile classfile, Visitable owner, DataInputStream in) throws IOException { 44 super(classfile, owner); 45 46 int byteCount = in.readInt(); 47 Logger.getLogger(getClass()).debug("Attribute length: " + byteCount); 48 49 int exceptionCount = in.readUnsignedShort(); 50 Logger.getLogger(getClass()).debug("Reading " + exceptionCount + " exception(s) ..."); 51 for (int i=0; i<exceptionCount; i++) { 52 Logger.getLogger(getClass()).debug("Exception " + i + ":"); 53 Class_info exception = (Class_info) classfile.getConstantPool().get(in.readUnsignedShort()); 54 exceptions.add(exception); 55 Logger.getLogger(getClass()).debug("Class " + exception); 56 } 57 } 58 59 public Collection getExceptions() { 60 return exceptions; 61 } 62 63 public String toString() { 64 return "Exceptions"; 65 } 66 67 public void accept(Visitor visitor) { 68 visitor.visitExceptions_attribute(this); 69 } 70 } 71 | Popular Tags |