private static void spawnExceptionChildren(ExecutionGraph graph, ExecutionNode node,
ExceptionHandlerAddressResolver exceptionResolver) throws UnhandledVirtualException {
if (node.mayThrowException()) {
for (Throwable exception : node.getExceptions()) {
if (log.isTraceEnabled()) {
log.trace("{} may throw virtual exception: ", node, exception);
}
int childAddress = exceptionResolver.resolve(exception, node.getAddress());
if (childAddress >= 0) {
ExecutionNode childNode = spawnChild(graph, node, childAddress);
childNode.getContext().getMethodState().assignExceptionRegister(exception);
} else {
if (node.getChildLocations().length == 0) {
if (log.isErrorEnabled()) {
log.error("{} unhandled virtual exception: ", node, exception);
}
throw new UnhandledVirtualException(exception);
} else {
if (log.isTraceEnabled()) {
log.trace("{} possible unhandled virtual exception: ", node, exception);
}
}
}
}
}
}