//create try statements...
for(CodeExceptionGen ceg : method.getExceptionHandlers()) {
InstructionHandle min = ceg.getStartPC();
InstructionHandle max = ceg.getEndPC();
BlockRange tryRange = new BlockRange();
tryRange.setStart(min);
tryRange.setEnd(max);
AbstractIntermediate handle = igc.findNextNode(ceg.getHandlerPC());
LOG.debug("RANGE: "+ceg);
LOG.debug("Range: "+tryRange+" , Target: "+handle.getInstruction().getPosition()+" , Handle: "+handle.getInstruction());
if(ceg.getCatchType() == null) {
if(!tryRangeFinally.containsKey(ceg.getHandlerPC())) {
tryRangeFinally.put(ceg.getHandlerPC(), new LinkedList<CodeExceptionGen>());
}
tryRangeFinally.get(ceg.getHandlerPC()).add(ceg);
continue;
}
tryBlock.add(tryRange);
if(!tryRangeGen.containsKey(tryRange)) {
tryRangeGen.put(tryRange, new LinkedList<CodeExceptionGen>());
}
tryRangeGen.get(tryRange).add(ceg);
}
for(BlockRange tryRange : tryBlock) {
//create try block... create each catch block... link the two together for graph sake.
//look up block...
InstructionHandle start = tryRange.getStart();
TryIntermediate tryIntermediate = new TryIntermediate(start);
tryIntermediate.getBlockRange().setStart(tryRange.getStart());
tryIntermediate.getBlockRange().setEnd(tryRange.getEnd());
igc.getGraph().addVertex(tryIntermediate);
//add line between try and node.