org.apache.commons.cli.ParseException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.commons.cli.ParseException.getLocalizedMessage()方法的一些代码示例,展示了ParseException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParseException.getLocalizedMessage()方法的具体详情如下:
包路径:org.apache.commons.cli.ParseException
类名称:ParseException
方法名:getLocalizedMessage

ParseException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: apache/hive

private CommandLine getCommandLine(String[] args)  throws ParseException {
 try {
  CommandLineParser parser = new GnuParser();
  return parser.parse(cmdLineOptions, args);
 } catch (ParseException e) {
  printAndExit("HiveSchemaTool:Parsing failed. Reason: " + e.getLocalizedMessage());
  return null;
 }
}

代码示例来源:origin: apache/hive

line = parser.parse(tool.cmdLineOptions, args);
} catch (ParseException e) {
 System.err.println("UpgradeTool: Parsing failed.  Reason: " + e.getLocalizedMessage());
 printAndExit(tool);
 return;

代码示例来源:origin: apache/hive

line = parser.parse(tool.cmdLineOptions, args);
} catch (ParseException e) {
 System.err.println("PreUpgradeTool: Parsing failed.  Reason: " + e.getLocalizedMessage());
 printAndExit(tool);
 return;

代码示例来源:origin: apache/nifi

printUsage(e.getLocalizedMessage(), options);
} catch (IOException | KeeperException | InterruptedException | ExecutionException e) {
  throw new IOException(String.format("unable to perform operation: %s", e.getLocalizedMessage()), e);

代码示例来源:origin: org.w3/ldp-testsuite

public static CommandLine getCommandLine(Options options, String[] args){
  CommandLineParser parser = new BasicParser();
  CommandLine cmd = null;
  try {
    cmd = parser.parse(options, args);
  } catch (ParseException e) {
    System.err.println("ERROR: " + e.getLocalizedMessage());
    printUsage(options);
  }
  if (cmd.hasOption("help")) {
    printUsage(options);
  }
  return cmd;
}

代码示例来源:origin: org.terracotta/terracotta-ee

private static CommandLine parseDefaultCommandLine(String[] args, ConfigMode configMode)
  throws ConfigurationSetupException {
 try {
  if (args == null || args.length == 0) {
   return new PosixParser().parse(new Options(), new String[0]);
  } else {
   Options options = createOptions(configMode);
   return new PosixParser().parse(options, args);
  }
 } catch (ParseException pe) {
  throw new ConfigurationSetupException(pe.getLocalizedMessage(), pe);
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1-ee

private static CommandLine parseDefaultCommandLine(String[] args, ConfigMode configMode)
  throws ConfigurationSetupException {
 try {
  if (args == null || args.length == 0) {
   return new PosixParser().parse(new Options(), new String[0]);
  } else {
   Options options = createOptions(configMode);
   return new PosixParser().parse(options, args);
  }
 } catch (ParseException pe) {
  throw new ConfigurationSetupException(pe.getLocalizedMessage(), pe);
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1

private static CommandLine parseDefaultCommandLine(String[] args, ConfigMode configMode)
  throws ConfigurationSetupException {
 try {
  if (args == null || args.length == 0) {
   return new PosixParser().parse(new Options(), new String[0]);
  } else {
   Options options = createOptions(configMode);
   return new PosixParser().parse(options, args);
  }
 } catch (ParseException pe) {
  throw new ConfigurationSetupException(pe.getLocalizedMessage(), pe);
 }
}

代码示例来源:origin: org.jspresso/jspresso-app-launch-swing

System.err.println(ex.getLocalizedMessage());
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp(SwingLauncher.class.getSimpleName(), options);

代码示例来源:origin: maven/maven

LOGGER.info( e.getLocalizedMessage() );
CLIManager.displayHelp();
returnCode = RC_BAD_ARG;

代码示例来源:origin: net.sf.gluebooster.java.booster/gb-essentials

/**
 * Invoke this application with parameters.
 * 
 * @param parameters
 *            the command options
 * @return the result of the command
 * @throws ParseException
 *             if the parameters do not match the configuration
 */
public static <Value> Value invoke(ObjectFactory executor,
    String[] parameters) throws Exception, ParseException {
  if (parameters == null)
    parameters = new String[] {};
  try {
    CommandLineApplication command = new CommandLineApplication(
        executor);
    return (Value) command.getObjectInstance(parameters, null, null,
        null);
  } catch (ParseException ex) {
    throw new ParseException(ex.getLocalizedMessage()
        + "\n Executor: " + executor);
  } catch (Exception ex) {
    throw new IllegalStateException("Could not invoke " + executor
        + " with parameters " + Arrays.asList(parameters), ex);
  }
}

代码示例来源:origin: org.apache.axis2/axis2-adb-codegen

line = parser.parse(options, args);
} catch (ParseException ex) {
  System.out.println(ex.getLocalizedMessage());
  System.out.println();
  printUsage();

代码示例来源:origin: org.apache.nifi/nifi-toolkit-zookeeper-migrator

printUsage(e.getLocalizedMessage(), options);
} catch (IOException | KeeperException | InterruptedException | ExecutionException e) {
  throw new IOException(String.format("unable to perform operation: %s", e.getLocalizedMessage()), e);

代码示例来源:origin: apache/axis2-java

line = parser.parse(options, args);
} catch (ParseException ex) {
  System.out.println(ex.getLocalizedMessage());
  System.out.println();
  printUsage();

代码示例来源:origin: horrorho/InflatableDonkey

throw new IllegalArgumentException(ex.getLocalizedMessage());

代码示例来源:origin: OneBusAway/onebusaway-application-modules

System.err.println(ex.getLocalizedMessage());
printUsage();
System.exit(-1);

代码示例来源:origin: org.onebusaway/onebusaway-transit-data-federation-builder

System.err.println(ex.getLocalizedMessage());
printUsage();
System.exit(-1);

代码示例来源:origin: org.onebusaway/onebusaway-transit-data-federation

System.err.println(ex.getLocalizedMessage());
printUsage();
System.exit(-1);

代码示例来源:origin: net.sf.gluebooster.java.booster/gb-essentials

parameters));
} catch (ParseException ex) {
  throw new ParseException(ex.getLocalizedMessage()
      + "\nOptions were " + Arrays.asList(parameters) + "\n"
      + getOptionsHelp());

代码示例来源:origin: droidefense/engine

public static void main(String[] args) {
  DroidefenseScan scan = new DroidefenseScan(args);
  try {
    scan.loadUserPreferences();
  } catch (UnknownAnalyzerException e) {
    Log.write(LoggerType.ERROR, "Analyzer not found", e.getLocalizedMessage());
  } catch (ParseException e) {
    Log.write(LoggerType.ERROR, "Parsing exception detected", e.getLocalizedMessage());
  } catch (InvalidScanParametersException e) {
    Log.write(LoggerType.ERROR, "Invalid scan parameter provided", e.getLocalizedMessage());
  } catch (EnvironmentNotReadyException e) {
    Log.write(LoggerType.ERROR, "Environment not ready", e.getBaseMessage());
    Log.write(LoggerType.ERROR, "Please, check a valid .json file exists before executing the scan");
    scan.createDefaultConfigurationFile();
  }
}

相关文章