Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.CodeException


        Code bcode = b.getCode();
        CodeException[] acexs = acode.getExceptionTable();
        CodeException[] bcexs = bcode.getExceptionTable();
        if (acexs.length == bcexs.length) {
            for (int i = 0; i < acexs.length; i++) {
                CodeException acex = acexs[i];
                CodeException bcex = bcexs[i];
                if (acex.getCatchType() != bcex.getCatchType() ||
                    acex.getStartPC() != bcex.getStartPC() ||
                    acex.getEndPC() != bcex.getEndPC() ||
                    acex.getHandlerPC() != bcex.getHandlerPC()) {
                    return false;
                }
            }
        }
       
View Full Code Here


     * called for the instruction list.
     *
     * @param cp constant pool
     */
    public CodeException getCodeException( ConstantPoolGen cp ) {
        return new CodeException(start_pc.getPosition(), end_pc.getPosition()
                + end_pc.getInstruction().getLength(), handler_pc.getPosition(),
                (catch_type == null) ? 0 : cp.addClass(catch_type));
    }
View Full Code Here

                setMaxStack(c.getMaxStack());
                setMaxLocals(c.getMaxLocals());
                CodeException[] ces = c.getExceptionTable();
                if (ces != null) {
                    for (int j = 0; j < ces.length; j++) {
                        CodeException ce = ces[j];
                        int type = ce.getCatchType();
                        ObjectType c_type = null;
                        if (type > 0) {
                            String cen = m.getConstantPool().getConstantString(type,
                                    Constants.CONSTANT_Class);
                            c_type = new ObjectType(cen);
                        }
                        int end_pc = ce.getEndPC();
                        int length = m.getCode().getCode().length;
                        InstructionHandle end;
                        if (length == end_pc) { // May happen, because end_pc is exclusive
                            end = il.getEnd();
                        } else {
                            end = il.findHandle(end_pc);
                            end = end.getPrev(); // Make it inclusive
                        }
                        addExceptionHandler(il.findHandle(ce.getStartPC()), end, il.findHandle(ce
                                .getHandlerPC()), c_type);
                    }
                }
                Attribute[] c_attributes = c.getAttributes();
                for (int j = 0; j < c_attributes.length; j++) {
View Full Code Here

    @Override
    public void sawOpcode(int seen) {
        // System.out.println(state + " " + getPC() + " " + OPCODE_NAMES[seen]);
        if (countDown == 2 && seen == GOTO) {
            CodeException tryBlock = getSurroundingTryBlock(getPC());
            if (tryBlock != null && tryBlock.getEndPC() == getPC()) {
                pendingBug.lowerPriority();
            }
        }
        if (countDown > 0) {
            countDown--;
View Full Code Here

    CodeException getSurroundingTryBlock(ConstantPool constantPool, Code code, @CheckForNull String vmNameOfExceptionClass, int pc) {
        int size = Integer.MAX_VALUE;
        if (code.getExceptionTable() == null) {
            return null;
        }
        CodeException result = null;
        for (CodeException catchBlock : code.getExceptionTable()) {
            if (vmNameOfExceptionClass != null) {
                Constant catchType = constantPool.getConstant(catchBlock.getCatchType());
                if (catchType == null && !vmNameOfExceptionClass.isEmpty() ||  catchType instanceof ConstantClass
                        && !((ConstantClass) catchType).getBytes(constantPool).equals(vmNameOfExceptionClass)) {
View Full Code Here

   * called for the instruction list.
   *
   * @param cp constant pool
   */
  public CodeException getCodeException(ConstantPoolGen cp) {
    return new CodeException(start_pc.getPosition(),
           end_pc.getPosition() + end_pc.getInstruction().getLength(),
           handler_pc.getPosition(),
           (catch_type == null)? 0 : cp.addClass(catch_type));
  }
View Full Code Here

                setMaxStack(c.getMaxStack());
                setMaxLocals(c.getMaxLocals());
                CodeException[] ces = c.getExceptionTable();
                if (ces != null) {
                    for (int j = 0; j < ces.length; j++) {
                        CodeException ce = ces[j];
                        int type = ce.getCatchType();
                        ObjectType c_type = null;
                        if (type > 0) {
                            String cen = m.getConstantPool().getConstantString(type,
                                    Constants.CONSTANT_Class);
                            c_type = new ObjectType(cen);
                        }
                        int end_pc = ce.getEndPC();
                        int length = m.getCode().getCode().length;
                        InstructionHandle end;
                        if (length == end_pc) { // May happen, because end_pc is exclusive
                            end = il.getEnd();
                        } else {
                            end = il.findHandle(end_pc);
                            end = end.getPrev(); // Make it inclusive
                        }
                        addExceptionHandler(il.findHandle(ce.getStartPC()), end, il.findHandle(ce
                                .getHandlerPC()), c_type);
                    }
                }
                Attribute[] c_attributes = c.getAttributes();
                for (int j = 0; j < c_attributes.length; j++) {
View Full Code Here

{

  public ExceptionHandlers(Code code)
  {

    CodeException previousCodeException= null;
    for (CodeException codeException : code.getExceptionTable())
    {
      if (previousCodeException != null && previousCodeException.getHandlerPC() == codeException.getHandlerPC())
      {
        previousCodeException.setEndPC(codeException.getEndPC());
      }
      else
      {
        add(new ExceptionHandler(codeException));
      }
View Full Code Here

   public void storeExceptionTable (CodeException[] aExcepTable,
      Binary aBinary, JavaClass aCF)
   {
      for (int i = 0; i < aExcepTable.length; i++)
      {
         CodeException pExcep = aExcepTable[i];
         try
         {
            iExceptionTable.add(new ExceptionRecord(pExcep, aBinary, aCF));
         }
         catch (Throwable t)
View Full Code Here

     * called for the instruction list.
     *
     * @param cp constant pool
     */
    public CodeException getCodeException( ConstantPoolGen cp ) {
        return new CodeException(start_pc.getPosition(), end_pc.getPosition()
                + end_pc.getInstruction().getLength(), handler_pc.getPosition(),
                (catch_type == null) ? 0 : cp.addClass(catch_type));
    }
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.CodeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.