if (getPC() < fbi.startPC) { return; if (getPC() == fbi.startPC) { if (OpcodeUtils.isAStore(seen)) { fbi.exReg = RegisterUtils.getAStoreReg(this, seen); } else { removeEarliestFinallyBlock(); sawOpcode(seen); return; fbi.monitorCount--; if (fbi.monitorCount < 0) { removeEarliestFinallyBlock(); sawOpcode(seen); return; removeEarliestFinallyBlock(); sawOpcode(seen); return; } else if (OpcodeUtils.isALoad(seen)) { bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); removeEarliestFinallyBlock(); } else if (OpcodeUtils.isStandardInvoke(seen)) { try { JavaClass cls = Repository.lookupClass(getClassConstantOperand()); Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand());
/** * looks to see if any try/catch block exists inside this finally block, that wrap the current pc. This is a lax check as the try catch block may not catch * exceptions that are thrown, but doing so would be prohibitively slow. But it should catch some problems. * * @param fBlockInfo * the finally block the pc is currently in * * @return if all exceptions are caught inside this finally block */ private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) { CodeException[] catchExceptions = getCode().getExceptionTable(); if (CollectionUtils.isEmpty(catchExceptions)) { return false; } int pc = getPC(); for (CodeException ex : catchExceptions) { if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc) && (ex.getStartPC() >= fBlockInfo.startPC)) { return true; } } return false; }
/** * looks to see if any try/catch block exists inside this finally block, that wrap the current pc. This is a lax check as the try catch block may not catch * exceptions that are thrown, but doing so would be prohibitively slow. But it should catch some problems. * * @param fBlockInfo * the finally block the pc is currently in * * @return if all exceptions are caught inside this finally block */ private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) { CodeException[] catchExceptions = getCode().getExceptionTable(); if (CollectionUtils.isEmpty(catchExceptions)) { return false; } int pc = getPC(); for (CodeException ex : catchExceptions) { if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc) && (ex.getStartPC() >= fBlockInfo.startPC)) { return true; } } return false; }
if (getPC() < fbi.startPC) { return; if (getPC() == fbi.startPC) { if (OpcodeUtils.isAStore(seen)) { fbi.exReg = RegisterUtils.getAStoreReg(this, seen); } else { removeEarliestFinallyBlock(); sawOpcode(seen); return; fbi.monitorCount--; if (fbi.monitorCount < 0) { removeEarliestFinallyBlock(); sawOpcode(seen); return; removeEarliestFinallyBlock(); sawOpcode(seen); return; } else if (OpcodeUtils.isALoad(seen)) { bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); removeEarliestFinallyBlock(); } else if (OpcodeUtils.isStandardInvoke(seen)) { try { JavaClass cls = Repository.lookupClass(getClassConstantOperand()); Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand());