本文整理了Java中org.apache.commons.cli.ParseException.printStackTrace()
方法的一些代码示例,展示了ParseException.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParseException.printStackTrace()
方法的具体详情如下:
包路径:org.apache.commons.cli.ParseException
类名称:ParseException
方法名:printStackTrace
暂无
代码示例来源:origin: wildfly/wildfly
public VaultTool(String[] args) {
initOptions();
parser = new PosixParser();
try {
cmdLine = parser.parse(options, args, true);
} catch (ParseException e) {
System.out.println(SecurityLogger.ROOT_LOGGER.problemParsingCommandLineParameters());
e.printStackTrace(System.err);
System.exit(2);
}
}
代码示例来源:origin: opensourceBIM/BIMserver
public OptionsParser(String... args) {
Options options = new Options();
options.addOption("plugins", true, "Directory from which to load a plugin bundle, can be used multiple times for different plugin bundles");
options.addOption("home", true, "The home directory to use, default is [cwd]/home");
CommandLineParser parser = new DefaultParser();
pluginDirectories = null;
try {
CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption("plugins")) {
String[] plugins = cmd.getOptionValues("plugins");
pluginDirectories = new Path[plugins.length];
for (int i=0; i<plugins.length; i++) {
pluginDirectories[i] = Paths.get(plugins[i]);
if (!Files.isDirectory(pluginDirectories[i])) {
throw new RuntimeException("plugins parameter must point to a directory (" + pluginDirectories[i] + ")");
}
}
}
if (cmd.hasOption("home")) {
home = Paths.get(cmd.getOptionValue("home"));
}
} catch (ParseException e) {
e.printStackTrace();
}
}
代码示例来源:origin: apache/metron
private static CommandLine parse(Options options, String[] args) {
/*
* The general gist is that in order to pass args to storm jar,
* we have to disregard options that we don't know about in the CLI.
* Storm will ignore our args, we have to do the same.
*/
CommandLineParser parser = new PosixParser() {
@Override
protected void processOption(String arg, ListIterator iter) throws ParseException {
if(getOptions().hasOption(arg)) {
super.processOption(arg, iter);
}
}
};
try {
return ParserOptions.parse(parser, args);
} catch (ParseException pe) {
pe.printStackTrace();
final HelpFormatter usageFormatter = new HelpFormatter();
usageFormatter.printHelp("ParserTopologyCLI", null, options, null, true);
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if (HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if (InspectorOptions.HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(TaxiiOptions.HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(BulkLoadOptions.HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(ConfigurationOptions.HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if (MaxmindDbEnrichmentLoader.GeoEnrichmentOptions.HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (org.apache.commons.cli.ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(String name, CommandLineParser parser, String[] args, CLIOptions[] values, CLIOptions helpOption) {
try {
CommandLine cli = parser.parse(getOptions(values), args);
if(helpOption.has(cli)) {
printHelp(name, values);
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp(name, values);
System.exit(-1);
return null;
}
}
}
代码示例来源:origin: apache/metron
pe.printStackTrace();
final HelpFormatter usageFormatter = new HelpFormatter();
usageFormatter.printHelp(LatencySummarizer.class.getSimpleName().toLowerCase(), null, options, null, true);
代码示例来源:origin: apache/metron
/**
* Extracts the valid command line options from a given command line.
*
* @param parser The command line parser.
* @param args The command line to parse.
* @return The command line options.
* @throws ParseException If the command line cannot be parsed successfully.
*/
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("invalid arguments: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
throw e;
}
}
代码示例来源:origin: apache/metron
public static CommandLine parse(CommandLineParser parser, String[] args) {
try {
CommandLine cli = parser.parse(getOptions(), args);
if(HELP.has(cli)) {
printHelp();
System.exit(0);
}
return cli;
} catch (ParseException e) {
System.err.println("Unable to parse args: " + Joiner.on(' ').join(args));
e.printStackTrace(System.err);
printHelp();
System.exit(-1);
return null;
}
}
代码示例来源:origin: apache/metron
cmd = ParserOptions.parse(parser, args);
} catch (ParseException pe) {
pe.printStackTrace();
final HelpFormatter usageFormatter = new HelpFormatter();
usageFormatter.printHelp("HLLPMeasurement", null, options, null, true);
内容来源于网络,如有侵权,请联系作者删除!