当前位置: 首页>>代码示例>>Java>>正文


Java Opcodes.ATHROW属性代码示例

本文整理汇总了Java中org.objectweb.asm.Opcodes.ATHROW属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.ATHROW属性的具体用法?Java Opcodes.ATHROW怎么用?Java Opcodes.ATHROW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.ATHROW属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hookMethod

/**
 * (none-javadoc)
 *
 * @see AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
 */
@Override
public MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
    if (name.equals("targetUrl")) {
        return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
            @Override
            protected void onMethodExit(int opcode) {
                if (opcode != Opcodes.ATHROW) {
                    mv.visitInsn(Opcodes.DUP);
                    invokeStatic(Type.getType(JstlImportHook.class),
                            new Method("checkJstlImport", "(Ljava/lang/String;)V"));
                }
            }
        };
    }
    return mv;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:21,代码来源:JstlImportHook.java

示例2: insert

private void insert() {
    InsnList trInsns = transformerNode.instructions;

    AbstractInsnNode node = trInsns.getLast();

    while (true) {
        if (node == null)
            break;

        if (node instanceof LabelNode) {
            node = node.getPrevious();
            continue;
        } else if (node.getOpcode() == Opcodes.RETURN) {
            trInsns.remove(node);
        } else if (node.getOpcode() == Opcodes.ATHROW && node.getPrevious().getOpcode() == Opcodes.ACONST_NULL) {
            AbstractInsnNode prev = node.getPrevious();
            trInsns.remove(node);
            trInsns.remove(prev);
        }

        break;
    }

    resultNode.instructions.insert(trInsns);
}
 
开发者ID:Yamakaja,项目名称:RuntimeTransformer,代码行数:25,代码来源:MethodJob.java

示例3: addDirectExits

private static void addDirectExits(InsnList il, BitSet entryPoints, Map<AbstractInsnNode, int[]> exitPoints) {
	int idx = 0; // ignore 0 since it has no preceding instruction

	while ((idx = entryPoints.nextSetBit(idx + 1)) != -1) {
		AbstractInsnNode prev = il.get(idx - 1);
		if (exitPoints.containsKey(prev)) continue;
		int type = prev.getType();

		if (prev.getOpcode() != Opcodes.ATHROW
				&& (prev.getOpcode() < Opcodes.IRETURN || prev.getOpcode() > Opcodes.RETURN)
				&& type != AbstractInsnNode.JUMP_INSN
				&& type != AbstractInsnNode.TABLESWITCH_INSN
				&& type != AbstractInsnNode.LOOKUPSWITCH_INSN) {
			exitPoints.put(prev, new int[] { idx });
		}
	}
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:17,代码来源:Analysis.java

示例4: visitEnd

public void visitEnd() {
	if (isSynchronized()) {
		has_monitor_operation = true;
		done = true;
		Label methodEndLabel = super.mark();
		if (exceptions!=null) {
			for(String ex: exceptions) {
				super.catchException(methodStartLabel,methodEndLabel,Type.getObjectType(ex));
				super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_EXIT_METHOD, LOG_CLASS_SIGNATURE);
				super.visitInsn(Opcodes.ATHROW);
			}
		}
		super.catchException(methodStartLabel,methodEndLabel,Type.getType(RuntimeException.class));
		super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_EXIT_METHOD, LOG_CLASS_SIGNATURE);
		super.visitInsn(Opcodes.ATHROW);
	}
	super.visitEnd();
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:18,代码来源:MonitorInstrument.java

示例5: visitEnd

public void visitEnd() {
	if (exit) {
		done = true;
		Label methodEndLabel = super.mark();
		super.catchException(methodStartLabel,methodEndLabel,Type.getType(RuntimeException.class));
		super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_STOP_METHOD, LOG_METHOD_SIGNATURE);
		super.visitInsn(Opcodes.ATHROW);
		if (exceptions!=null) {
			for(String ex: exceptions) {
				super.catchException(methodStartLabel,methodEndLabel,Type.getObjectType(ex));
				super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_STOP_METHOD, LOG_METHOD_SIGNATURE);
				super.visitInsn(Opcodes.ATHROW);
			}
		}
	}
	super.visitEnd();
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:17,代码来源:LogInstrument.java

示例6: visitEnd

public void visitEnd() {
	if (!methodDone && methodStartLabel != null && constructor) {
		methodDone = true;
		Label methodEndLabel = super.mark();
		super.catchException(methodStartLabel, methodEndLabel, Type
				.getType(RuntimeException.class));
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_ALLOC_DEC, VOID_SIGNATURE);
		super.visitInsn(Opcodes.ATHROW);
		if (exceptions != null) {
			for (String ex : exceptions) {
				super.catchException(methodStartLabel, methodEndLabel,
						Type.getObjectType(ex));
				super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
						LOG_INTERNAL_ALLOC_DEC, VOID_SIGNATURE);
				super.visitInsn(Opcodes.ATHROW);
			}
		}
	}
	super.visitEnd();
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:21,代码来源:AllocateInstrument.java

示例7: hookMethod

/**
 * (none-javadoc)
 *
 * @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
 */
@Override
public MethodVisitor hookMethod(int access, String name, String desc,
                                String signature, String[] exceptions, MethodVisitor mv) {
    if (name.equals("getConnection") && desc.startsWith("(Ljava/lang/String;Ljava/util/Properties;"
            + "Ljava/lang/Class")) {
        return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
            @Override
            protected void onMethodEnter() {
                loadArg(0);
                loadArg(1);
                invokeStatic(Type.getType(SQLDriverManagerHook.class),
                        new Method("checkSqlConnectionOnEnter", "(Ljava/lang/String;Ljava/util/Properties;)V"));
                invokeStatic(Type.getType(HookHandler.class),
                        new Method("preShieldHook", "()V"));
            }

            @Override
            protected void onMethodExit(int i) {
                if (Opcodes.ATHROW != i) {
                    loadArg(0);
                    loadArg(1);
                    invokeStatic(Type.getType(SQLDriverManagerHook.class),
                            new Method("checkSqlConnectionOnExit", "(Ljava/lang/String;Ljava/util/Properties;)V"));
                }
                invokeStatic(Type.getType(HookHandler.class),
                        new Method("postShieldHook", "()V"));
            }
        };
    }
    return mv;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:36,代码来源:SQLDriverManagerHook.java

示例8: visitInsn

@Override
public void visitInsn(final int opcode) {
    if (mv != null) {
        mv.visitInsn(opcode);
    }
    execute(opcode, 0, null);
    if ((opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN)
            || opcode == Opcodes.ATHROW) {
        this.locals = null;
        this.stack = null;
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:12,代码来源:AnalyzerAdapter.java

示例9: asmMethodThrow

/**
 * 组装被拦截方法在方法内throw时的拦截动作
 */
@SuppressWarnings("unchecked")
private static void asmMethodThrow(MethodModifierContext context) {
    InsnList il = context.mn.instructions;
    Iterator<AbstractInsnNode> it = il.iterator();
    while (it.hasNext()) {
        AbstractInsnNode abstractInsnNode = it.next();
        switch (abstractInsnNode.getOpcode()) {
            case Opcodes.ATHROW:
                il.insertBefore(abstractInsnNode, createThrowInstructions(context));
                break;
        }
    }

}
 
开发者ID:yutian-tianpl,项目名称:byte-cobweb,代码行数:17,代码来源:MethodModifier.java

示例10: isThrow

private static boolean isThrow(AbstractInsnNode insn) {
  return Opcodes.ATHROW == insn.getOpcode();
}
 
开发者ID:inferjay,项目名称:r8,代码行数:3,代码来源:JarSourceCode.java

示例11: canThrow

private boolean canThrow(AbstractInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.AALOAD:
    case Opcodes.AASTORE:
    case Opcodes.ANEWARRAY:
      // ARETURN does not throw in its dex image.
    case Opcodes.ARRAYLENGTH:
    case Opcodes.ATHROW:
    case Opcodes.BALOAD:
    case Opcodes.BASTORE:
    case Opcodes.CALOAD:
    case Opcodes.CASTORE:
    case Opcodes.CHECKCAST:
    case Opcodes.DALOAD:
    case Opcodes.DASTORE:
      // DRETURN does not throw in its dex image.
    case Opcodes.FALOAD:
    case Opcodes.FASTORE:
      // FRETURN does not throw in its dex image.
    case Opcodes.GETFIELD:
    case Opcodes.GETSTATIC:
    case Opcodes.IALOAD:
    case Opcodes.IASTORE:
    case Opcodes.IDIV:
    case Opcodes.INSTANCEOF:
    case Opcodes.INVOKEDYNAMIC:
    case Opcodes.INVOKEINTERFACE:
    case Opcodes.INVOKESPECIAL:
    case Opcodes.INVOKESTATIC:
    case Opcodes.INVOKEVIRTUAL:
    case Opcodes.IREM:
      // IRETURN does not throw in its dex image.
    case Opcodes.LALOAD:
    case Opcodes.LASTORE:
    case Opcodes.LDIV:
    case Opcodes.LREM:
      // LRETURN does not throw in its dex image.
    case Opcodes.MONITORENTER:
    case Opcodes.MONITOREXIT:
    case Opcodes.MULTIANEWARRAY:
    case Opcodes.NEW:
    case Opcodes.NEWARRAY:
    case Opcodes.PUTFIELD:
    case Opcodes.PUTSTATIC:
      // RETURN does not throw in its dex image.
    case Opcodes.SALOAD:
    case Opcodes.SASTORE:
      return true;
    case Opcodes.LDC: {
      // const-class and const-string* may throw in dex.
      LdcInsnNode ldc = (LdcInsnNode) insn;
      return ldc.cst instanceof String || ldc.cst instanceof Type;
    }
    default:
      return false;
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:57,代码来源:JarSourceCode.java

示例12: onMethodExit

protected void onMethodExit(int opcode) {
	if (done || opcode == Opcodes.ATHROW || !isSynchronized()) return;
	
	has_monitor_operation = true;
	super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_EXIT_METHOD, LOG_CLASS_SIGNATURE);
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:6,代码来源:MonitorInstrument.java

示例13: onMethodExit

public void onMethodExit(int opcode) {
	if (opcode != Opcodes.ATHROW)
		addDec();
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:4,代码来源:AllocateInstrument.java


注:本文中的org.objectweb.asm.Opcodes.ATHROW属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。