Пример #1
0
 /** Write the exceptions table */
 void writeExceptions(
     Environment env, DataOutputStream out, ConstantPool tab, Instruction first, Instruction last)
     throws IOException {
   for (Instruction inst = first; inst != last.next; inst = inst.next) {
     if (inst.opc == opc_try) {
       TryData td = (TryData) inst.value;
       writeExceptions(env, out, tab, inst.next, td.getEndLabel());
       for (Enumeration e = td.catches.elements(); e.hasMoreElements(); ) {
         CatchData cd = (CatchData) e.nextElement();
         // System.out.println("EXCEPTION: " + env.getSource() + ", pc=" + inst.pc + ", end=" +
         // td.getEndLabel().pc + ", hdl=" + cd.getLabel().pc + ", tp=" + cd.getType());
         out.writeShort(inst.pc);
         out.writeShort(td.getEndLabel().pc);
         out.writeShort(cd.getLabel().pc);
         if (cd.getType() != null) {
           out.writeShort(tab.index(cd.getType()));
         } else {
           out.writeShort(0);
         }
       }
       inst = td.getEndLabel();
     }
   }
 }