Tabnine Logo
MethodVisitor.visitTryCatchBlock
Code IndexAdd Tabnine to your IDE (free)

How to use
visitTryCatchBlock
method
in
org.objectweb.asm.MethodVisitor

Best Java code snippets using org.objectweb.asm.MethodVisitor.visitTryCatchBlock (Showing top 20 results out of 630)

origin: cglib/cglib

public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
  mv1.visitTryCatchBlock(start, end, handler, type);
  mv2.visitTryCatchBlock(start, end, handler, type);
}

origin: cglib/cglib

public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
  mv1.visitTryCatchBlock(start, end, handler, type);
  mv2.visitTryCatchBlock(start, end, handler, type);
}

origin: scouter-project/scouter

@Override
public void visitMaxs(int maxStack, int maxLocals) {
  Label endFinally = new Label();
  mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
  mv.visitLabel(endFinally);
  mv.visitInsn(DUP);
  int errIdx = newLocal(Type.getType(Throwable.class));
  mv.visitVarInsn(Opcodes.ASTORE, errIdx);
  mv.visitVarInsn(Opcodes.ALOAD, statIdx);
  mv.visitVarInsn(Opcodes.ALOAD, errIdx);
  mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_MAIN, END_METHOD, END_SIGNATURE, false);
  mv.visitInsn(ATHROW);
  mv.visitMaxs(maxStack + 8, maxLocals + 2);
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEAPICALL, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_SQL, END_METHOD, END_SIGNATURE2, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_KAFKA, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);
    mv.visitVarInsn(Opcodes.ALOAD, strArgIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_SQL, CONNECT_METHOD, ERR_SIGNATURE,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);// stat
    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);// throwable
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESUBCALL, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, END_METHOD, END_SIGNATURE,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_RABBIT, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TARGET, END_METHOD, END_METHOD_DESC,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TARGET, END_METHOD, END_METHOD_DESC,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TARGET, END_METHOD, END_METHOD_DESC,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    AsmUtil.PUSH(mv, -3);

    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESQL, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

@Override
public void visitMaxs(int maxStack, int maxLocals) {
  Label endFinally = new Label();
  mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
  mv.visitLabel(endFinally);
  mv.visitInsn(DUP);
  int errIdx = newLocal(Type.getType(Throwable.class));
  mv.visitVarInsn(Opcodes.ASTORE, errIdx);
  mv.visitVarInsn(Opcodes.ALOAD, statIdx);
  mv.visitVarInsn(Opcodes.ALOAD, errIdx);
  AsmUtil.PUSH(mv, -3);
  mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESQL, END_METHOD, END_SIGNATURE,false);
  mv.visitInsn(ATHROW);
  mv.visitMaxs(maxStack + 8, maxLocals + 2);
}
origin: cglib/cglib

public void catch_exception(Block block, Type exception) {
  if (block.getEnd() == null) {
    throw new IllegalStateException("end of block is unset");
  }
  mv.visitTryCatchBlock(block.getStart(),
             block.getEnd(),
             mark(),
             exception.getInternalName());
}
origin: cglib/cglib

public void catch_exception(Block block, Type exception) {
  if (block.getEnd() == null) {
    throw new IllegalStateException("end of block is unset");
  }
  mv.visitTryCatchBlock(block.getStart(),
             block.getEnd(),
             mark(),
             exception.getInternalName());
}
origin: pxb1988/dex2jar

/**
 * an empty try-catch block will cause other crash, we check this by finding non-label stmts between
 * {@link Trap#start} and {@link Trap#end}. if find we add the try-catch or we drop the try-catch.
 *
 * @param ir
 * @param asm
 */
private void reBuildTryCatchBlocks(IrMethod ir, MethodVisitor asm) {
  for (Trap trap : ir.traps) {
    boolean needAdd = false;
    for (Stmt p = trap.start.getNext(); p != null && p != trap.end; p = p.getNext()) {
      if (p.st != ST.LABEL) {
        needAdd = true;
        break;
      }
    }
    if (needAdd) {
      for (int i = 0; i < trap.handlers.length; i++) {
        String type = trap.types[i];
        asm.visitTryCatchBlock((Label) trap.start.tag, (Label) trap.end.tag, (Label) trap.handlers[i].tag,
            type == null ? null : toInternal(type));
      }
    }
  }
}
org.objectweb.asmMethodVisitorvisitTryCatchBlock

Javadoc

Visits a try catch block.

Popular methods of MethodVisitor

  • visitMethodInsn
    Visits a method instruction. A method instruction is an instruction that invokes a method.
  • visitInsn
    Visits a zero operand instruction.
  • visitVarInsn
    Visits a local variable instruction. A local variable instruction is an instruction that loads or st
  • visitMaxs
    Visits the maximum stack size and the maximum number of local variables of the method.
  • visitEnd
    Visits the end of the method. This method, which is the last one to be called, is used to inform the
  • visitCode
    Starts the visit of the method's code, if any (i.e. non abstract method).
  • visitFieldInsn
    Visits a field instruction. A field instruction is an instruction that loads or stores the value of
  • visitTypeInsn
    Visits a type instruction. A type instruction is an instruction that takes the internal name of a cl
  • visitLabel
    Visits a label. A label designates the instruction that will be visited just after it.
  • visitLdcInsn
    Visits a LDC instruction. Note that new constant types may be added in future versions of the Java V
  • visitJumpInsn
    Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction
  • visitIntInsn
    Visits an instruction with a single int operand.
  • visitJumpInsn,
  • visitIntInsn,
  • visitLocalVariable,
  • visitAnnotation,
  • visitLineNumber,
  • visitFrame,
  • visitTableSwitchInsn,
  • visitParameterAnnotation,
  • visitIincInsn

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • BoxLayout (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now