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


Java CodeException类代码示例

本文整理汇总了Java中org.apache.bcel.classfile.CodeException的典型用法代码示例。如果您正苦于以下问题:Java CodeException类的具体用法?Java CodeException怎么用?Java CodeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getSurroundingCaughtExceptions

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public Set<String> getSurroundingCaughtExceptions(int pc, int maxTryBlockSize) {
    HashSet<String> result = new HashSet<String>();
    if (code == null)
        throw new IllegalStateException("Not visiting Code");
    int size = maxTryBlockSize;
    if (code.getExceptionTable() == null)
        return result;
    for (CodeException catchBlock : code.getExceptionTable()) {
        int startPC = catchBlock.getStartPC();
        int endPC = catchBlock.getEndPC();
        if (pc >= startPC && pc <= endPC) {
            int thisSize = endPC - startPC;
            if (size > thisSize) {
                result.clear();
                size = thisSize;
                Constant kind = constantPool.getConstant(catchBlock.getCatchType());
                result.add("C" + catchBlock.getCatchType());
            } else if (size == thisSize)
                result.add("C" + catchBlock.getCatchType());
        }
    }
    return result;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:24,代码来源:PreorderVisitor.java

示例2: getSurroundingTryBlock

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public static @CheckForNull
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 || catchType instanceof ConstantClass
                    && !((ConstantClass) catchType).getBytes(constantPool).equals(vmNameOfExceptionClass))
                continue;
        }
        int startPC = catchBlock.getStartPC();
        int endPC = catchBlock.getEndPC();
        if (pc >= startPC && pc <= endPC) {
            int thisSize = endPC - startPC;
            if (size > thisSize) {
                size = thisSize;
                result = catchBlock;
            }
        }
    }
    return result;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:Util.java

示例3: visit

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
@Override
public void visit(CodeException obj) {
    int type = obj.getCatchType();
    if (type == 0)
        return;
    String name = getConstantPool().constantToString(getConstantPool().getConstant(type));
    if (DEBUG) {
        String msg = "Catching " + name + " in " + getFullyQualifiedMethodName();
        if (msgs.add(msg))
            System.out.println(msg);
    }
    if (name.equals("java.lang.IllegalMonitorStateException"))
        bugReporter.reportBug(new BugInstance(this, "IMSE_DONT_CATCH_IMSE", HIGH_PRIORITY).addClassAndMethod(this)
                .addSourceLine(this.classContext, this, obj.getHandlerPC()));

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:17,代码来源:DontCatchIllegalMonitorStateException.java

示例4: uniqueLocations

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
/**
 * @param derefLocationSet
 * @return
 */
private boolean uniqueLocations(Collection<Location> derefLocationSet) {
    boolean uniqueDereferenceLocations = false;
    CodeException[] exceptionTable = method.getCode().getExceptionTable();
    if (exceptionTable == null)
        return true;
    checkForCatchAll: {
        for (CodeException e : exceptionTable)
            if (e.getCatchType() == 0)
                break checkForCatchAll;
        return true;
    }

    LineNumberTable table = method.getLineNumberTable();
    if (table == null)
        uniqueDereferenceLocations = true;
    else {
        BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method);
        for (Location loc : derefLocationSet) {
            int lineNumber = table.getSourceLine(loc.getHandle().getPosition());
            if (lineNumber > 0 && !linesMentionedMultipleTimes.get(lineNumber))
                uniqueDereferenceLocations = true;
        }
    }
    return uniqueDereferenceLocations;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:30,代码来源:FindNullDeref.java

示例5: visit

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public void visit(CodeException obj) {
	int type = obj.getCatchType();
	if (type == 0) return;
	String name = getConstantPool().constantToString(getConstantPool().getConstant(type));
	if (DEBUG) {
		String msg = "Catching " + name + " in " + getFullyQualifiedMethodName();
		if (msgs.add(msg))
			System.out.println(msg);
	}
	if (name.equals("java.lang.IllegalMonitorStateException"))
		bugReporter.reportBug(new BugInstance(this, "IMSE_DONT_CATCH_IMSE", HIGH_PRIORITY)
		        .addClassAndMethod(this)
		        .addSourceLine(this, obj.getHandlerPC()));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:DontCatchIllegalMonitorStateException.java

示例6: getExceptionScope

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public int[] getExceptionScope(){
        try {
            CodeException[] exceptionTable = this.code.getExceptionTable();
            int[] exception_scop = new int[exceptionTable.length * 2];
            for (int i = 0; i < exceptionTable.length; i++) {
                exception_scop[i * 2] = exceptionTable[i].getStartPC();
                exception_scop[i * 2 + 1] = exceptionTable[i].getEndPC();
            }
            return exception_scop;
        }catch (Exception e){
//            e.printStackTrace();
        }
        return new int[0];
    }
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:15,代码来源:StringCodeAnalysis.java

示例7: visitCodeException

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public void visitCodeException(CodeException c) {
	c.toString(pool, false);

	int catch_type = c.getCatchType();

	if (catch_type == 0)
		return;

	String temp = pool.getConstantString(catch_type, Constants.CONSTANT_Class);
	String str = Utility.compactClassName(temp, false);

	log("         catch=" + str, Project.MSG_DEBUG);
	design.checkClass(str);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:15,代码来源:VisitorImpl.java

示例8: visitCode

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
@Override
public void visitCode(Code obj) {
    code = obj;
    super.visitCode(obj);
    CodeException[] exceptions = obj.getExceptionTable();
    for (CodeException exception : exceptions)
        exception.accept(this);
    Attribute[] attributes = obj.getAttributes();
    for (Attribute attribute : attributes)
        attribute.accept(this);
    visitAfter(obj);
    code = null;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:14,代码来源:PreorderVisitor.java

示例9: visit

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
@Override
public void visit(Method method) {
    String cName = getDottedClassName();

    // System.out.println(getFullyQualifiedMethodName());
    isPublicStaticVoidMain = method.isPublic() && method.isStatic() && getMethodName().equals("main")
            || cName.toLowerCase().indexOf("benchmark") >= 0;
    prevOpcodeWasReadLine = false;
    Code code = method.getCode();
    if (code != null) {
        this.exceptionTable = code.getExceptionTable();
    }
    if (this.exceptionTable == null) {
        this.exceptionTable = new CodeException[0];
    }
    primitiveObjCtorSeen = null;
    ctorSeen = false;
    randomNextIntState = 0;
    checkForBitIorofSignedByte = false;
    isEqualsObject = getMethodName().equals("equals") && getMethodSig().equals("(Ljava/lang/Object;)Z") && !method.isStatic();
    sawInstanceofCheck = false;
    reportedBadCastInEquals = false;
    freshRandomOnTos = false;
    sinceBufferedInputStreamReady = 100000;
    sawCheckForNonNegativeSignedByte = -1000;
    sawLoadOfMinValue = false;

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:29,代码来源:DumbMethods.java

示例10: getExceptionSig

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public static String getExceptionSig(DismantleBytecode dbc, CodeException e) {
    if (e.getCatchType() == 0)
        return "Ljava/lang/Throwable;";
    Constant c = dbc.getConstantPool().getConstant(e.getCatchType());
    if (c instanceof ConstantClass)
        return "L" + ((ConstantClass) c).getBytes(dbc.getConstantPool()) + ";";
    return "Ljava/lang/Throwable;";
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:9,代码来源:OpcodeStack.java

示例11: visit

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
@Override
public void visit(Method method) {
    String cName = getDottedClassName();

    // System.out.println(getFullyQualifiedMethodName());
    isPublicStaticVoidMain = method.isPublic() && method.isStatic() && getMethodName().equals("main")
            || cName.toLowerCase().indexOf("benchmark") >= 0;
    prevOpcodeWasReadLine = false;
    Code code = method.getCode();
    if (code != null) {
        this.exceptionTable = code.getExceptionTable();
    }
    if (this.exceptionTable == null) {
        this.exceptionTable = new CodeException[0];
    }
    primitiveObjCtorSeen = null;
    ctorSeen = false;
    randomNextIntState = 0;
    checkForBitIorofSignedByte = false;
    isEqualsObject = getMethodName().equals("equals") && getMethodSig().equals("(Ljava/lang/Object;)Z") && !method.isStatic();
    sawInstanceofCheck = false;
    reportedBadCastInEquals = false;
    freshRandomOnTos = false;
    sinceBufferedInputStreamReady = 100000;
    sawCheckForNonNegativeSignedByte = -1000;
    sawLoadOfMinValue = false;
    previousMethodCall = null;

}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:30,代码来源:DumbMethods.java

示例12: getCodeExceptions

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
/**
 * @return code exceptions for `Code' attribute
 */
private CodeException[] getCodeExceptions() {
    int size = exception_vec.size();
    CodeException[] c_exc = new CodeException[size];
    try {
        for (int i = 0; i < size; i++) {
            CodeExceptionGen c = (CodeExceptionGen) exception_vec.get(i);
            c_exc[i] = c.getCodeException(cp);
        }
    } catch (ArrayIndexOutOfBoundsException e) {
    }
    return c_exc;
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:16,代码来源:MethodGen.java

示例13: visitCodeException

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public void visitCodeException(CodeException obj){
	// Code constraints are checked in Pass3 (3a and 3b).
	// This does not represent an Attribute but is only
	// related to internal BCEL data representation.

	// see visitCode(Code)
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:8,代码来源:Pass2Verifier.java

示例14: atCatchBlock

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public boolean atCatchBlock() {
    for (CodeException e : getCode().getExceptionTable())
        if (e.getHandlerPC() == getPC())
            return true;
    return false;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:7,代码来源:DismantleBytecode.java

示例15: getSurroundingTryBlock

import org.apache.bcel.classfile.CodeException; //导入依赖的package包/类
public CodeException getSurroundingTryBlock(int pc) {
    return getSurroundingTryBlock(null, pc);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:PreorderVisitor.java


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