private void checkToolsLoaded(JSAP jsap) { URLClassLoader loader; try { loader = (URLClassLoader) ClassLoader.getSystemClassLoader(); loader.loadClass("com.sun.jdi.AbsentInformationException"); } catch (ClassNotFoundException e) { System.err.println("Tools.jar must be loaded. The classpath given for your app is: "+System.getProperty("java.class.path")); LauncherUtils.printUsage(jsap, LauncherType.PIPELINE); } }
public static void checkEnvironmentVariable(String envVariable, JSAP jsap, LauncherType launcherType) { if (System.getenv(envVariable) == null || System.getenv(envVariable).equals("")) { System.err.println("You must set the following environment variable: "+envVariable); LauncherUtils.printUsage(jsap, launcherType); } }
private void checkNopolSolverPath(JSAP jsap) { String solverPath = this.getConfig().getZ3solverPath(); if (solverPath != null) { File file = new File(solverPath); if (!file.exists()) { System.err.println("The Nopol solver path should be an existing file: " + file.getPath() + " does not exist."); LauncherUtils.printUsage(jsap, LauncherType.PIPELINE); } } else { System.err.println("The Nopol solver path should be provided."); LauncherUtils.printUsage(jsap, LauncherType.PIPELINE); } }
private void checkNextBuildId(JSAP jsap) { if (this.getConfig().getNextBuildId() == InputBuildId.NO_PATCH) { System.err.println("A pair of builds needs to be provided in BEARS mode."); LauncherUtils.printUsage(jsap, LauncherType.PIPELINE); } }
public static void checkArguments(JSAP jsap, JSAPResult arguments, LauncherType launcherType) { if (!arguments.success()) { // print out specific error messages describing the problems for (java.util.Iterator<?> errs = arguments.getErrorMessageIterator(); errs.hasNext();) { System.err.println("Error: " + errs.next()); } printUsage(jsap, launcherType); } if (getArgHelp(arguments)) { printUsage(jsap, launcherType); } if (launcherType == LauncherType.PIPELINE) { checkEnvironmentVariable(Utils.M2_HOME, jsap, launcherType); } checkPushUrlArg(jsap, arguments, launcherType); }
public static void checkPushUrlArg(JSAP jsap, JSAPResult arguments, LauncherType launcherType) { if (getArgPushUrl(arguments) != null) { if (!Utils.matchesGithubRepoUrl(getArgPushUrl(arguments))) { System.err.println("The value of the argument pushurl is wrong."); LauncherUtils.printUsage(jsap, launcherType); } } }