org.kohsuke.args4j.CmdLineException.printStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(61)

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

CmdLineException.printStackTrace介绍

暂无

代码示例

代码示例来源:origin: shunfei/indexr

public static CmdLineParser parseArgs(String[] args, Object t) {
  CmdLineParser parser = new CmdLineParser(t);
  try {
    parser.parseArgument(args);
  } catch (CmdLineException e) {
    e.printStackTrace();
    System.err.println(e.getMessage());
    parser.printUsage(System.err);
    System.err.println();
    System.exit(1);
  }
  return parser;
}

代码示例来源:origin: org.apache.beam/beam-runners-direct-java

private static ServerConfiguration parseConfiguration(String[] args) throws CmdLineException {
 ServerConfiguration configuration = new ServerConfiguration();
 CmdLineParser parser = new CmdLineParser(configuration);
 try {
  parser.parseArgument(args);
 } catch (CmdLineException e) {
  e.printStackTrace(System.err);
  printUsage(parser);
  throw e;
 }
 return configuration;
}

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

/**
 * prepare the tool for running
 */
public void prepare() {
  final CmdLineParser parser = new CmdLineParser(this);
  try {
    parser.parseArgument(this.args);
    this.validate();
  } catch (final CmdLineException e) {
    e.printStackTrace();
    System.err.println(e.getMessage());
    System.err.println("Usage: java -jar PicSlurper.jar [options...] ");
    parser.printUsage(System.err);
    System.err.println(this.getExtractUsageInfo());
    System.exit(1);
  }
}

代码示例来源:origin: io.provis/provisio-jenkins

public static void main(String[] args) throws Exception {
 // force utf-8
 System.setProperty("file.encoding", "UTF-8");
 Charset.defaultCharset();
 CLI cli = new CLI();
 CmdLineParser cmd = new CmdLineParser(cli);
 try {
  cmd.parseArgument(args);
 } catch (CmdLineException e) {
  System.out.print("Usage: java -jar provisio-jenkins-uber-<v>.jar");
  cmd.printSingleLineUsage(System.out);
  System.out.println();
  e.printStackTrace();
  return;
 }
 cli.doMain();
}

代码示例来源:origin: ORCID/ORCID-Source

public static void main(String... args) {
  MigrateEmailFrequencyData element = new MigrateEmailFrequencyData();
  CmdLineParser parser = new CmdLineParser(element);
  try {
    parser.parseArgument(args);
    //If it is null or too big
    if(element.batchSize == null || element.batchSize > 1000000) {
      element.batchSize = 50000;
    }            
  } catch (CmdLineException e) {
    LOG.error(e.getMessage(), e);
    e.printStackTrace();
    System.exit(1);            
  }
  element.migrate();
}

代码示例来源:origin: ORCID/ORCID-Source

public static void main(String... args) {
  PopulateEmailHash element = new PopulateEmailHash();
  CmdLineParser parser = new CmdLineParser(element);
  try {
    parser.parseArgument(args);
    // If it is null or too big
    if (element.batchSize == null || element.batchSize > 1000000) {
      element.batchSize = 50000;
    }
  } catch (CmdLineException e) {
    LOG.error(e.getMessage(), e);
    e.printStackTrace();
    System.exit(1);
  }
  element.migrate();
}

代码示例来源:origin: ORCID/ORCID-Source

public static void main(String... args) throws NoSuchAlgorithmException {
  RecalculateAndFixEmailHash element = new RecalculateAndFixEmailHash();
  CmdLineParser parser = new CmdLineParser(element);
  try {
    parser.parseArgument(args);
    if(element.customOffset == null) {
      element.customOffset = 0;
    }
    
    // If it is null or too big
    if (element.batchSize == null || element.batchSize > 1000000) {
      element.batchSize = 50000;
    }
    
    if(element.fixErrors == null) {
      element.fixErrors = false;
    }
    
    if(element.testMode == null) {
      element.testMode = false;
    }
  } catch (CmdLineException e) {
    LOG.error(e.getMessage(), e);
    e.printStackTrace();
    System.exit(1);
  }
  element.migrate();
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

parser.parseArgument(args);
} catch (CmdLineException e) {
 e.printStackTrace();
 System.exit(-1);

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

parser.parseArgument(args);
} catch (CmdLineException e) {
 e.printStackTrace();
 System.exit(-1);

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

protected synchronized void loadOptions(Reducer<Text, BytesWritable, Text, BytesWritable>.Context context)
    throws IOException
{
  try {
    options = new HadoopTwitterTokenToolOptions(context.getConfiguration().getStrings(ARGS_KEY));
    options.prepare();
    final Path outpath = HadoopToolsUtil.getOutputPath(options);
    timeIndex = CountTweetsInTimeperiod.readTimeIndex(CountTweetsInTimeperiod.constructIndexPath(outpath));
    final Path timecountOut = new Path(outpath, CountTweetsInTimeperiod.TIMECOUNT_DIR);
    final Path statsout = new Path(timecountOut, CountTweetsInTimeperiod.GLOBAL_STATS_FILE);
    final FileSystem fs = HadoopToolsUtil.getFileSystem(statsout);
    final WritableEnumCounter<TextEntryType> et = new WritableEnumCounter<TextEntryType>() {
      @Override
      public TextEntryType valueOf(String str) {
        return TextEntryType.valueOf(str);
      }
    };
    tgs = IOUtils.read(fs.open(statsout), et);
  } catch (final CmdLineException e) {
    e.printStackTrace();
    throw new IOException(e);
  } catch (final Exception e) {
    e.printStackTrace();
    throw new IOException(e);
  }
}

代码示例来源:origin: org.openimaj.hadoop.tools/HadoopTwitterTokenTool

protected synchronized void loadOptions(Reducer<Text, BytesWritable, Text, BytesWritable>.Context context)
    throws IOException
{
  try {
    options = new HadoopTwitterTokenToolOptions(context.getConfiguration().getStrings(ARGS_KEY));
    options.prepare();
    final Path outpath = HadoopToolsUtil.getOutputPath(options);
    timeIndex = CountTweetsInTimeperiod.readTimeIndex(CountTweetsInTimeperiod.constructIndexPath(outpath));
    final Path timecountOut = new Path(outpath, CountTweetsInTimeperiod.TIMECOUNT_DIR);
    final Path statsout = new Path(timecountOut, CountTweetsInTimeperiod.GLOBAL_STATS_FILE);
    final FileSystem fs = HadoopToolsUtil.getFileSystem(statsout);
    final WritableEnumCounter<TextEntryType> et = new WritableEnumCounter<TextEntryType>() {
      @Override
      public TextEntryType valueOf(String str) {
        return TextEntryType.valueOf(str);
      }
    };
    tgs = IOUtils.read(fs.open(statsout), et);
  } catch (final CmdLineException e) {
    e.printStackTrace();
    throw new IOException(e);
  } catch (final Exception e) {
    e.printStackTrace();
    throw new IOException(e);
  }
}

相关文章