private List<Target> computeTargets(final ArgumentParser parser, final List<String> explicitEndpoints, final List<String> domainsArguments, final String srvName) { if (explicitEndpoints != null && !explicitEndpoints.isEmpty()) { final List<Target> targets = Lists.newArrayListWithExpectedSize(explicitEndpoints.size()); for (final String endpoint : explicitEndpoints) { targets.add(Target.from(URI.create(endpoint))); } return targets; } else if (domainsArguments != null && !domainsArguments.isEmpty()) { final Iterable<String> domains = parseDomains(domainsArguments); return Target.from(srvName, domains); } else if (!cliConfig.getMasterEndpoints().isEmpty()) { final List<URI> cliConfigMasterEndpoints = cliConfig.getMasterEndpoints(); final List<Target> targets = Lists.newArrayListWithExpectedSize( cliConfigMasterEndpoints.size()); for (final URI endpoint : cliConfigMasterEndpoints) { targets.add(Target.from(endpoint)); } return targets; } else if (!cliConfig.getDomainsString().isEmpty()) { final Iterable<String> domains = parseDomainsString(cliConfig.getDomainsString()); return Target.from(srvName, domains); } handleError(parser, new ArgumentParserException( "no masters specified. Use the -z or -d option to specify which helios " + "cluster/master to connect to", parser)); return ImmutableList.of(); }
stdErr.println(e.getMessage()); e.getParser().printHelp(stdErr); return false;
main = new AgentMain(args); } catch (ArgumentParserException e) { e.printStackTrace(); System.exit(1); return; // never get here, but this lets java know for sure we won't continue
public static void main(String[] args) { try { mainHelper(args, null); } catch (ArgumentParserException exception) { exception.getParser().handleError(exception); System.exit(1); } catch (Throwable ex) { ex.printStackTrace(); System.exit(1); } }
System.out.println(e.getMessage()); argumentParser.printHelp(); LOGGER.error("FAILURE: "+e.getLocalizedMessage()); } catch (SurveyException se) { System.err.println("FAILURE: " + se.getMessage());
@Override public String getMessage() { return realError.getMessage(); }
public static void main(String[] args) { try { mainHelper(args); } catch (ArgumentParserException exception) { exception.getParser().handleError(exception); System.exit(1); } catch (Throwable ex) { ex.printStackTrace(); System.exit(1); } }
configFolderPath, outputFolderPath, sinceDate, untilDate, formats, isAutomaticallyLaunching); } catch (ArgumentParserException ape) { throw new ParseException(getArgumentParser().formatUsage() + ape.getMessage() + "\n");
@Override public Pair<String, String> convert(ArgumentParser parser, Argument arg, String val) throws ArgumentParserException { int pos = val.indexOf('='); if (pos < 0) { throw new ArgumentParserException(val + " is not a property specification", parser); } return Pair.of(val.substring(0, pos), val.substring(pos + 1)); } }
stdErr.println(e.getMessage()); e.getParser().printHelp(stdErr); return false;
public static void main(String[] args) { try { mainHelper(args); } catch (ArgumentParserException exception) { exception.getParser().handleError(exception); System.exit(1); } catch (Throwable ex) { ex.printStackTrace(); System.exit(1); } }
main = new AgentMain(args); } catch (ArgumentParserException e) { e.printStackTrace(); System.exit(1); return; // never get here, but this lets java know for sure we won't continue
throw new ArgumentParserException(parser);
@Override public void handleError(ArgumentParserException e, PrintWriter writer) { if (e.getParser() != this) { e.getParser().handleError(e, writer); return; writer.write(TextHelper.wrap(config_.textWidthCounter_,String.format( TextHelper.LOCALE_ROOT, localize("errorLine"), config_.prog_, e.getMessage()), config_.formatWidth_, 0, "", "")); if (e instanceof UnrecognizedArgumentException) {
public static void main(String[] args) { try { mainHelper(args); } catch (ArgumentParserException exception) { exception.getParser().handleError(exception); System.exit(1); } catch (IOException | ParseTimeoutException exception) { exception.printStackTrace(); System.exit(1); } }
private void verifyNotExists(ArgumentParser parser, Path file) throws ArgumentParserException, IOException { if (fs.exists(file)) { throw new ArgumentParserException("File found: " + file, parser); } }
@Override public void handleError(ArgumentParserException e, PrintWriter writer) { if (e.getParser() != this) { e.getParser().handleError(e, writer); return; writer.write(TextHelper.wrap(config_.textWidthCounter_,String.format( TextHelper.LOCALE_ROOT, localize("errorLine"), config_.prog_, e.getMessage()), config_.formatWidth_, 0, "", "")); if (e instanceof UnrecognizedArgumentException) {
public static void main(String[] args) { try { mainHelper(args, null); } catch (ArgumentParserException exception) { exception.getParser().handleError(exception); System.exit(1); } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } }
private void verifyExists(ArgumentParser parser, Path file) throws ArgumentParserException, IOException { if (!fs.exists(file)) { throw new ArgumentParserException("File not found: " + file, parser); } }
stdErr.println(e.getMessage()); e.getParser().printHelp(stdErr); return false;