Пример #1
0
  public static void start(Config conf, String[] args) {
    // this is redundant to jpf.report.<publisher>.start=..config..
    // but nobody can remember this (it's only used to produce complete reports)

    if (logger == null) {
      logger = initLogging(conf);
    }

    if (!checkArgs(args)) {
      return;
    }

    setNativeClassPath(conf); // in case we have to find a shell

    // check if there is a shell class specification, in which case we just delegate
    JPFShell shell = conf.getInstance("shell", JPFShell.class);
    if (shell != null) {
      shell.start(args); // responsible for exception handling itself

    } else {
      // no shell, we start JPF directly
      LogManager.printStatus(logger);
      conf.printStatus(logger);

      // this has to be done after we checked&consumed all "-.." arguments
      // this is NOT about checking properties!
      checkUnknownArgs(args);

      try {
        JPF jpf = new JPF(conf);
        jpf.run();

      } catch (ExitException x) {
        logger.severe("JPF terminated");

        // this is how we get most runtime config exceptions
        if (x.shouldReport()) {
          x.printStackTrace();
        }

        /**
         * Throwable cause = x.getCause(); if ((cause != null) && conf.getBoolean("pass_exceptions",
         * false)) { cause.fillInStackTrace(); throw cause; }
         */
      } catch (JPFException jx) {
        logger.severe("JPF exception, terminating: " + jx.getMessage());
        if (conf.getBoolean("jpf.print_exception_stack")) {

          Throwable cause = jx.getCause();
          if (cause != null && cause != jx) {
            cause.printStackTrace();
          } else {
            jx.printStackTrace();
          }
        }
        // pass this on, caller has to handle
        throw jx;
      }
    }
  }
Пример #2
0
 /**
  * use this one to get a Logger that is initialized via our Config mechanism. Note that our own
  * Loggers do NOT pass
  */
 public static JPFLogger getLogger(String name) {
   return LogManager.getLogger(name);
 }
Пример #3
0
 private static Logger initLogging(Config conf) {
   LogManager.init(conf);
   return getLogger("gov.nasa.jpf");
 }