Exemple #1
0
  /**
   * Runs the command without permission, data and concurrency checks.
   *
   * @param ctx database context
   * @param os output stream
   * @return result of check
   */
  public boolean run(final Context ctx, final OutputStream os) {
    perf = new Performance();
    context = ctx;
    prop = ctx.prop;
    mprop = ctx.mprop;
    out = PrintOutput.get(os);

    try {
      return run();
    } catch (final ProgressException ex) {
      // process was interrupted by the user or server
      abort();
      return error(INTERRUPTED);
    } catch (final Throwable ex) {
      // unexpected error
      Performance.gc(2);
      abort();
      if (ex instanceof OutOfMemoryError) {
        Util.debug(ex);
        return error(OUT_OF_MEM + (createWrite() ? H_OUT_OF_MEM : ""));
      }
      return error(Util.bug(ex) + NL + info.toString());
    } finally {
      // flushes the output
      try {
        if (out != null) out.flush();
      } catch (final IOException ignored) {
      }
    }
  }
Exemple #2
0
 /**
  * Adds the error message to the message buffer {@link #info}.
  *
  * @param msg error message
  * @param ext error extension
  * @return {@code false}
  */
 protected final boolean error(final String msg, final Object... ext) {
   info.reset();
   info.addExt(msg == null ? "" : msg, ext);
   return false;
 }
Exemple #3
0
 /**
  * Adds information on command execution.
  *
  * @param str information to be added
  * @param ext extended info
  * @return {@code true}
  */
 protected final boolean info(final String str, final Object... ext) {
   info.addExt(str, ext).add(NL);
   return true;
 }
Exemple #4
0
 /**
  * Returns command information.
  *
  * @return info string
  */
 public final String info() {
   return info.toString();
 }