private boolean pickExceptionHandler(Throwable e) { for (TryCatchBlockReader tryCatch : currentBlock.readTryCatchBlocks()) { Class<?> exceptionType; try { exceptionType = tryCatch.getExceptionType() != null ? Class.forName(tryCatch.getExceptionType(), false, classLoader) : null; } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Can't find exception class " + tryCatch.getExceptionType()); } if (exceptionType == null || exceptionType.isInstance(e)) { currentBlock = tryCatch.getProtectedBlock(); return true; } } return false; }
public static List<TryCatchBlock> copyTryCatches(BasicBlockReader block, Program target) { List<TryCatchBlock> result = new ArrayList<>(); for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { TryCatchBlock tryCatchCopy = new TryCatchBlock(); tryCatchCopy.setExceptionType(tryCatch.getExceptionType()); tryCatchCopy.setHandler(target.basicBlockAt(tryCatch.getHandler().getIndex())); result.add(tryCatchCopy); } return result; }
private ExceptionConsumer createExceptionConsumer(MethodDependency methodDep, BasicBlockReader block) { List<? extends TryCatchBlockReader> tryCatchBlocks = block.readTryCatchBlocks(); ClassReader[] exceptions = new ClassReader[tryCatchBlocks.size()]; DependencyNode[] vars = new DependencyNode[tryCatchBlocks.size()]; for (int i = 0; i < tryCatchBlocks.size(); ++i) { TryCatchBlockReader tryCatch = tryCatchBlocks.get(i); if (tryCatch.getExceptionType() != null) { exceptions[i] = dependencyAnalyzer.getClassSource().get(tryCatch.getExceptionType()); } if (tryCatch.getHandler().getExceptionVariable() != null) { vars[i] = methodDep.getVariable(tryCatch.getHandler().getExceptionVariable().getIndex()); } } return new ExceptionConsumer(dependencyAnalyzer, exceptions, vars, methodDep); }
for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { sb.append(prefix).append(" catch "); if (tryCatch.getExceptionType() != null) {
for (TryCatchBlockReader templateTryCatch : templateBlock.readTryCatchBlocks()) { TryCatchBlock tryCatch = new TryCatchBlock(); tryCatch.setExceptionType(templateTryCatch.getExceptionType());
@Override protected void processMethod(MethodDependency methodDep) { MethodReader method = methodDep.getMethod(); ProgramReader program = method.getProgram(); if (program != null) { FastInstructionAnalyzer instructionAnalyzer = new FastInstructionAnalyzer(this); instructionAnalyzer.setCaller(method.getReference()); for (BasicBlockReader block : program.getBasicBlocks()) { block.readAllInstructions(instructionAnalyzer); for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { if (tryCatch.getExceptionType() != null) { linkClass(tryCatch.getExceptionType()); } } } methodDep.variableNodes = new DependencyNode[program.variableCount()]; for (int i = 0; i < methodDep.variableNodes.length; ++i) { methodDep.variableNodes[i] = instancesNode; } } if (method.hasModifier(ElementModifier.SYNCHRONIZED)) { processAsyncMethod(methodDep); } }
for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { if (tryCatch.getExceptionType() != null) { dependencyAnalyzer.linkClass(tryCatch.getExceptionType());
private boolean pickExceptionHandler(Throwable e) { for (TryCatchBlockReader tryCatch : currentBlock.readTryCatchBlocks()) { Class<?> exceptionType; try { exceptionType = tryCatch.getExceptionType() != null ? Class.forName(tryCatch.getExceptionType(), false, classLoader) : null; } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Can't find exception class " + tryCatch.getExceptionType()); } if (exceptionType == null || exceptionType.isInstance(e)) { currentBlock = tryCatch.getProtectedBlock(); return true; } } return false; }
public static List<TryCatchBlock> copyTryCatches(BasicBlockReader block, Program target) { List<TryCatchBlock> result = new ArrayList<>(); for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { TryCatchBlock tryCatchCopy = new TryCatchBlock(); tryCatchCopy.setExceptionType(tryCatch.getExceptionType()); tryCatchCopy.setHandler(target.basicBlockAt(tryCatch.getHandler().getIndex())); result.add(tryCatchCopy); } return result; }
private ExceptionConsumer createExceptionConsumer(MethodDependency methodDep, BasicBlockReader block) { List<? extends TryCatchBlockReader> tryCatchBlocks = block.readTryCatchBlocks(); ClassReader[] exceptions = new ClassReader[tryCatchBlocks.size()]; DependencyNode[] vars = new DependencyNode[tryCatchBlocks.size()]; for (int i = 0; i < tryCatchBlocks.size(); ++i) { TryCatchBlockReader tryCatch = tryCatchBlocks.get(i); if (tryCatch.getExceptionType() != null) { exceptions[i] = dependencyChecker.getClassSource().get(tryCatch.getExceptionType()); } if (tryCatch.getHandler().getExceptionVariable() != null) { vars[i] = methodDep.getVariable(tryCatch.getHandler().getExceptionVariable().getIndex()); } } return new ExceptionConsumer(dependencyChecker, exceptions, vars, methodDep); }
for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { sb.append(prefix).append(" catch "); if (tryCatch.getExceptionType() != null) {
for (TryCatchBlockReader templateTryCatch : templateBlock.readTryCatchBlocks()) { TryCatchBlock tryCatch = new TryCatchBlock(); tryCatch.setExceptionType(templateTryCatch.getExceptionType());
for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) { if (tryCatch.getExceptionType() != null) { dependencyChecker.linkClass(tryCatch.getExceptionType(), new CallLocation(caller.getMethod()));