本文整理了Java中org.kohsuke.args4j.CmdLineException.getMessage()
方法的一些代码示例,展示了CmdLineException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CmdLineException.getMessage()
方法的具体详情如下:
包路径:org.kohsuke.args4j.CmdLineException
类名称:CmdLineException
方法名:getMessage
暂无
代码示例来源:origin: apache/incubator-pinot
public void execute(String[] args)
throws Exception {
try {
CmdLineParser parser = new CmdLineParser(this);
parser.parseArgument(args);
if ((_subCommand == null) || _help) {
printUsage();
} else if (_subCommand.getHelp()) {
_subCommand.printUsage();
} else {
_subCommand.execute();
}
} catch (CmdLineException e) {
LOGGER.error("Error: {}", e.getMessage());
} catch (Exception e) {
LOGGER.error("Exception caught: ", e);
}
}
代码示例来源:origin: jenkinsci/jenkins
parser.parseArgument(args);
stderr.println("");
stderr.println("ERROR: " + e.getMessage());
printUsage(stderr, parser);
return 2;
} catch (IllegalStateException e) {
stderr.println("");
stderr.println("ERROR: " + e.getMessage());
return 4;
代码示例来源:origin: kohsuke/args4j
private int run(String[] args) {
CmdLineParser p = new CmdLineParser(this);
try {
p.parseArgument(args);
run();
return 0;
} catch (CmdLineException e) {
System.err.println(e.getMessage());
p.printUsage(System.err);
return 1;
}
}
代码示例来源:origin: net.sf.ofx4j/ofx4j
private void invalidArgs(CmdLineParser parser, CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java DownloadStatement [options...] arguments...");
// print the list of available options
parser.printUsage(System.err);
System.err.println();
// print option sample. This is useful some time
System.err.println(" Example: java DownloadStatement " + parser.printExample(ExampleMode.ALL));
System.exit(1);
}
代码示例来源:origin: org.eclipse.hudson/hudson-remoting
public static void main(String[] args) throws IOException, InterruptedException {
try {
_main(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java -jar slave.jar [options...] <secret key> <slave name>");
new CmdLineParser(new Main()).printUsage(System.err);
}
}
代码示例来源:origin: kohsuke/args4j
public int run(String[] args) throws Exception {
CmdLineParser parser = new CmdLineParser(this);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
printUsage(parser);
return -1;
}
if(aptArgs.isEmpty()) {
printUsage(parser);
return 0;
}
// we'll use a separate class loader to reload our classes,
// so parameters need to be set as system properties. Ouch!
System.setProperty("args4j.outdir",outDir.getPath());
System.setProperty("args4j.format",mode.name());
if(resourceName==null) resourceName = ""; // can't have null in properties
System.setProperty("args4j.resource",resourceName);
aptArgs.add(0, "-proc:only");
aptArgs.add(1, "-processor");
aptArgs.add(2, AnnotationProcessorImpl.class.getName());
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
return javac.run(System.in, System.out, System.err, aptArgs.toArray(new String[0]));
}
代码示例来源:origin: jenkinsci/jenkins
p.parseArgument(args.toArray(new String[args.size()]));
auth = authenticator.authenticate();
if (auth==Jenkins.ANONYMOUS)
LOGGER.log(Level.FINE, String.format("Failed call to CLI command %s, with %d arguments, as user %s.",
getName(), args.size(), auth != null ? auth.getName() : "<unknown>"), e);
stderr.println("");
stderr.println("ERROR: " + e.getMessage());
printUsage(stderr, p);
return 2;
LOGGER.log(Level.FINE, String.format("Failed call to CLI command %s, with %d arguments, as user %s.",
getName(), args.size(), auth != null ? auth.getName() : "<unknown>"), e);
stderr.println("");
stderr.println("ERROR: " + e.getMessage());
return 4;
代码示例来源:origin: net.sf.ofx4j/ofx4j
private void invalidArgs(CmdLineParser parser, CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java DownloadAccountInfo [options...] arguments...");
// print the list of available options
parser.printUsage(System.err);
System.err.println();
// print option sample. This is useful some time
System.err.println(" Example: java DownloadAccountInfo " + parser.printExample(ExampleMode.ALL));
System.exit(1);
}
代码示例来源:origin: hudson/hudson-2.x
public static void main(String[] args) throws IOException, InterruptedException {
try {
_main(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java -jar slave.jar [options...] <secret key> <slave name>");
new CmdLineParser(new Main()).printUsage(System.err);
}
}
代码示例来源:origin: apache/incubator-pinot
public void execute(String[] args)
throws Exception {
try {
CmdLineParser parser = new CmdLineParser(this);
parser.parseArgument(args);
if ((_subCommand == null) || _help) {
printUsage();
} else if (_subCommand.getHelp()) {
_subCommand.printUsage();
_status = true;
} else {
_status = _subCommand.execute();
}
} catch (CmdLineException e) {
LOGGER.error("Error: {}", e.getMessage());
} catch (Exception e) {
LOGGER.error("Exception caught: ", e);
}
}
代码示例来源:origin: kohsuke/args4j
System.err.println("The system property '"
+ PARAMETER_NAME
+ "' must contain the classname to start.");
Class clazz = Class.forName(classname);
Object bean = clazz.newInstance();
parser = new CmdLineParser(bean);
classHasOptions = hasAnnotation(clazz, Option.class);
parser.parseArgument(args);
System.err.println("Cant find the class '"
+ classname
+ "' as specified in the system property '"
System.err.println(e.getMessage());
System.err.print(classname);
if (classHasOptions) System.err.print(" [options]");
代码示例来源:origin: kaklakariada/portmapper
public boolean parse(final String[] args) {
try {
parser.parseArgument(asList(args));
return true;
} catch (final CmdLineException e) {
System.err.println(e.getMessage());
printHelp();
return false;
}
}
代码示例来源:origin: stoicflame/ofx4j
private void invalidArgs(CmdLineParser parser, CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java DownloadAccountInfo [options...] arguments...");
// print the list of available options
parser.printUsage(System.err);
System.err.println();
// print option sample. This is useful some time
System.err.println(" Example: java DownloadAccountInfo " + parser.printExample(ExampleMode.ALL));
System.exit(1);
}
代码示例来源:origin: jenkinsci/remoting
public static void main(String[] args) throws IOException, InterruptedException {
try {
_main(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java -jar agent.jar [options...] <secret key> <agent name>");
new CmdLineParser(new Main()).printUsage(System.err);
}
}
代码示例来源:origin: jbake-org/jbake
private LaunchOptions parseArguments(String[] args) {
LaunchOptions res = new LaunchOptions();
CmdLineParser parser = new CmdLineParser(res);
try {
parser.parseArgument(args);
} catch (final CmdLineException e) {
printUsage(res);
throw new JBakeException("Invalid commandline arguments: " + e.getMessage(), e);
}
return res;
}
代码示例来源:origin: args4j/args4j
System.err.println("The system property '"
+ PARAMETER_NAME
+ "' must contain the classname to start.");
Class clazz = Class.forName(classname);
Object bean = clazz.newInstance();
parser = new CmdLineParser(bean);
classHasOptions = hasAnnotation(clazz, Option.class);
parser.parseArgument(args);
System.err.println("Cant find the class '"
+ classname
+ "' as specified in the system property '"
System.err.println(e.getMessage());
System.err.print(classname);
if (classHasOptions) System.err.print(" [options]");
代码示例来源:origin: childe/hangout
public void parseCmd() {
printVersion();
try {
parser.parseArgument(arguments);
// If help is needed
if (isHelp) {
parser.printUsage(System.err);
System.exit(0);
}
} catch (CmdLineException e) {
System.err.println(e.getMessage());
// print the list of available options
System.exit(1);
}
}
代码示例来源:origin: stoicflame/ofx4j
private void invalidArgs(CmdLineParser parser, CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java DownloadStatement [options...] arguments...");
// print the list of available options
parser.printUsage(System.err);
System.err.println();
// print option sample. This is useful some time
System.err.println(" Example: java DownloadStatement " + parser.printExample(ExampleMode.ALL));
System.exit(1);
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-remoting
public static void main(String[] args) throws IOException, InterruptedException {
try {
_main(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("java -jar slave.jar [options...] <secret key> <slave name>");
new CmdLineParser(new Main()).printUsage(System.err);
}
}
代码示例来源:origin: muumin/spring-boot-batch-sample
private Optional<CommandLineOptions> getOptions(String... args) throws CmdLineException {
CommandLineOptions option = new CommandLineOptions();
CmdLineParser parser = new CmdLineParser(option);
if (args.length == 0) {
parser.printUsage(System.err);
return Optional.empty();
}
try {
parser.parseArgument(args);
return Optional.of(option);
} catch (CmdLineException ex) {
log.error("Exception: {}", ex.getMessage());
parser.printUsage(System.err);
throw ex;
}
}
内容来源于网络,如有侵权,请联系作者删除!