Source:
public static void main(String[] args) { int returnCode = -1; Main main = new Main(); NopolResult result = null; try { main.initJSAP(); if (!main.parseArguments(args)) { return; } final NopolContext nopolContext = main.getNopolContext(); if (nopolContext.getSynthesis() == NopolContext.NopolSynthesis.DYNAMOTH) { URLClassLoader loader = (URLClassLoader) ClassLoader.getSystemClassLoader(); try { loader.loadClass("com.sun.jdi.Value"); } catch (ClassNotFoundException e) { System.err.println("For using Dynamoth, you must add tools.jar in your classpath from your installed jdk"); System.exit(-1); } } switch (nopolContext.getMode()) { case REPAIR: switch (nopolContext.getType()) { case LOOP: Infinitel infinitel = new Infinitel(nopolContext); infinitel.repair(); break; default: final NoPol nopol = new NoPol(nopolContext); final ExecutorService executor = Executors.newSingleThreadExecutor(); final Future<NopolResult> nopolExecution = executor.submit( new Callable() { @Override public Object call() throws Exception { return nopol.build(); } }); try { executor.shutdown(); result = nopolExecution.get(nopolContext.getMaxTimeInMinutes(), TimeUnit.MINUTES); } catch (TimeoutException exception) { result = nopol.getNopolResult(); result.setNopolStatus(NopolStatus.TIMEOUT); LoggerFactory.getLogger(Main.class).error("Timeout: execution time > " + nopolContext.getMaxTimeInMinutes() + " " + TimeUnit.MINUTES, exception); } break; } break; case RANKING: Ranking ranking = new Ranking(nopolContext); System.out.println(ranking.summary()); break; } } catch (Exception e) { e.printStackTrace(); main.showUsage(); } if (result != null) { System.out.println(result.getNopolStatus()); returnCode = (result.getPatches().isEmpty()) ? 1 : 0; } System.exit(returnCode); }

Target:
public static void main(String[] args) { int returnCode = -1; Main main = new Main(); NopolResult result = null; try { main.initJSAP(); if (!main.parseArguments(args)) { return; } final NopolContext nopolContext = main.getNopolContext(); if (nopolContext.getSynthesis() == NopolContext.NopolSynthesis.DYNAMOTH) { URLClassLoader loader = (URLClassLoader) ClassLoader.getSystemClassLoader(); try { loader.loadClass("com.sun.jdi.Value"); } catch (ClassNotFoundException e) { System.err.println("For using Dynamoth, you must add tools.jar in your classpath from your installed jdk"); System.exit(-1); } } switch (nopolContext.getMode()) { case REPAIR: switch (nopolContext.getType()) { case LOOP: Infinitel infinitel = new Infinitel(nopolContext); infinitel.repair(); break; default: final NoPol nopol = new NoPol(nopolContext); final ExecutorService executor = Executors.newSingleThreadExecutor(); final Future<NopolResult> nopolExecution = executor.submit( new Callable() { @Override public Object call() throws Exception { return nopol.build(); } }); try { executor.shutdown(); result = nopolExecution.get(nopolContext.getMaxTimeInMinutes(), TimeUnit.MINUTES); } catch (TimeoutException exception) { result = nopol.getNopolResult(); result.setNopolStatus(NopolStatus.TIMEOUT); LoggerFactory.getLogger(Main.class).error("Timeout: execution time > " + nopolContext.getMaxTimeInMinutes() + " " + TimeUnit.MINUTES, exception); } break; } break; case RANKING: Ranking ranking = new Ranking(nopolContext); System.out.println(ranking.summary()); break; } } catch (Exception e) { e.printStackTrace(); main.showUsage(); } if (result != null) { System.out.println(result.getNopolStatus()); returnCode = (result.getPatches().isEmpty()) ? -1 : 0; } System.exit(returnCode); }