当前位置: 首页>>代码示例>>Java>>正文


Java JSAPResult.getErrorMessageIterator方法代码示例

本文整理汇总了Java中com.martiansoftware.jsap.JSAPResult.getErrorMessageIterator方法的典型用法代码示例。如果您正苦于以下问题:Java JSAPResult.getErrorMessageIterator方法的具体用法?Java JSAPResult.getErrorMessageIterator怎么用?Java JSAPResult.getErrorMessageIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.martiansoftware.jsap.JSAPResult的用法示例。


在下文中一共展示了JSAPResult.getErrorMessageIterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseArguments

import com.martiansoftware.jsap.JSAPResult; //导入方法依赖的package包/类
private boolean parseArguments(String[] args) {
	JSAPResult jsapConfig = jsap.parse(args);
	if (!jsapConfig.success()) {
		System.err.println();
		for (Iterator<?> errs = jsapConfig.getErrorMessageIterator(); errs.hasNext(); ) {
			System.err.println("Error: " + errs.next());
		}
		showUsage();
		return false;
	}
	String[] sources = jsapConfig.getStringArray("source");
	final File[] sourceFiles = new File[sources.length];
	for (int i = 0; i < sources.length; i++) {
		String path = sources[i];
		File sourceFile = FileLibrary.openFrom(path);
		sourceFiles[i] = sourceFile;
	}

	final URL[] classpath = JavaLibrary.classpathFrom(jsapConfig.getString("classpath"));

	this.nopolContext = new NopolContext(sourceFiles, classpath, jsapConfig.getStringArray("test"));

	nopolContext.setType(strToStatementType(jsapConfig.getString("type")));
	nopolContext.setMode(strToMode(jsapConfig.getString("mode")));
	nopolContext.setSynthesis(strToSynthesis(jsapConfig.getString("synthesis")));
	nopolContext.setOracle(strToOracle(jsapConfig.getString("oracle")));
	nopolContext.setSolver(strToSolver(jsapConfig.getString("solver")));
	if (jsapConfig.getString("solverPath") != null) {
		nopolContext.setSolverPath(jsapConfig.getString("solverPath"));
		SolverFactory.setSolver(nopolContext.getSolver(), nopolContext.getSolverPath());
	}
	nopolContext.setComplianceLevel(jsapConfig.getInt("complianceLevel", 7)); nopolContext.setMaxTimeInMinutes(jsapConfig.getInt("maxTime", nopolContext.getMaxTimeInMinutes()));
	nopolContext.setMaxTimeEachTypeOfFixInMinutes(jsapConfig.getInt("maxTimeType",5));

	nopolContext.setLocalizer(strToLocalizer(jsapConfig.getString("faultLocalization")));
	nopolContext.setOutputFolder(jsapConfig.getString("outputFolder"));
	nopolContext.setJson(jsapConfig.getBoolean("outputJson", false));
	return true;
}
 
开发者ID:SpoonLabs,项目名称:nopol,代码行数:40,代码来源:Main.java

示例2: printUsageAndExit

import com.martiansoftware.jsap.JSAPResult; //导入方法依赖的package包/类
private static void printUsageAndExit(JSAP jsap, JSAPResult result) {
	@SuppressWarnings("rawtypes")
	Iterator it = result.getErrorMessageIterator();
	while (it.hasNext()) {
		System.err.println("Error: " + it.next());
	}

	System.err.println("Usage: " + Master.class.getName() + " "
			+ jsap.getUsage());
	System.err.println(jsap.getHelp());
	System.err
			.println("General Usage: \n1) Create a CC extractor JAR file (mvn install)\n2) Use 'deploy' command to upload the JAR to S3\n3) Use 'queue' command to fill the extraction queue with CC file names\n4) Use 'start' command to launch EC2 extraction instances\n5) Wait until everything is finished using the 'monitor' command\n6) Use 'shutdown' command to kill worker nodes\n7) Collect result data and statistics with the 'retrievedata' and 'retrievestats' commands");

	System.exit(1);
}
 
开发者ID:JulianEberius,项目名称:dwtc-extractor,代码行数:16,代码来源:Master.java

示例3: makeError

import com.martiansoftware.jsap.JSAPResult; //导入方法依赖的package包/类
public static String makeError(String command,
                               List params,
                               JSAPResult result) {
    StringBuffer buff = new StringBuffer();
    buff.append(Args.makeUsage(command, params));
    buff.append('\n');
    Iterator it = result.getErrorMessageIterator();
    while(it.hasNext()) {
        buff.append(it.next());
        buff.append('\n');
    }
    return buff.toString();
}
 
开发者ID:crotwell,项目名称:sod,代码行数:14,代码来源:Args.java

示例4: init

import com.martiansoftware.jsap.JSAPResult; //导入方法依赖的package包/类
public static void init(String[] args) throws Exception {
  // argument parser:
  JSAP jsap = new JSAP();

  jsap.registerParameter(new FlaggedOption("email").setStringParser(JSAP.STRING_PARSER).setRequired(false).setLongFlag("email"));

  jsap.registerParameter(new FlaggedOption("params").setStringParser(JSAP.STRING_PARSER).setRequired(true).setShortFlag('p'));

  jsap.registerParameter(new FlaggedOption("year").setStringParser(JSAP.INTEGER_PARSER).setRequired(false).setShortFlag('y'));

  jsap.registerParameter(new FlaggedOption("month").setStringParser(JSAP.INTEGER_PARSER).setRequired(false).setShortFlag('m'));

  jsap.registerParameter(
      new FlaggedOption("contract").setLongFlag("contract").setShortFlag('c').setStringParser(JSAP.INTEGER_PARSER).setRequired(false));

  jsap.registerParameter(new Switch("offline").setLongFlag("offline").setDefault("false"));

  jsap.registerParameter(new Switch("debug").setLongFlag("debug").setDefault("false"));

  jsap.registerParameter(new FlaggedOption("do").setStringParser(JSAP.STRING_PARSER).setRequired(false).setLongFlag("do"));

  JSAPResult config = jsap.parse(args);
  if (!config.success()) {
    for (@SuppressWarnings("rawtypes")
    java.util.Iterator errs = config.getErrorMessageIterator(); errs.hasNext();) {
      System.err.println("Error: " + errs.next());
    }
    System.out.println("Usage:\n\n\t" + jsap.getUsage() + "\n\n");

    System.exit(1);
  }

  File propFile = new File(config.getString("params"));
  if (!propFile.exists()) {
    String msg = "Cannot find property file: " + config.getString("params");
    System.out.println(msg);
    throw new Exception(msg);
  } else {}

  boolean connectToDB = !config.getBoolean("offline");

  FileInputStream in;
  Properties props = new Properties();
  ;
  try {
    in = new FileInputStream(propFile);
    props.load(in);
    in.close();
  } catch (Exception e) {
    logger.error(e);
    System.exit(0);
  }

  GlobalConstants.load(props);

  if (connectToDB) {
    DatabaseManager.initDatabaseManager(props.getProperty("host"), Integer.parseInt(props.getProperty("port")), props.getProperty("user"),
        props.getProperty("pass"), props.getProperty("db"), true);
  } else {
    System.out.println("WARNING: not connecting to DB");
  }

}
 
开发者ID:hugozaragoza,项目名称:SaaSMetrics4J,代码行数:64,代码来源:AgencyBilling.java


注:本文中的com.martiansoftware.jsap.JSAPResult.getErrorMessageIterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。