org.jruby.Ruby.getErrorStream()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(99)

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

Ruby.getErrorStream介绍

暂无

代码示例

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public PrintStream getErrorStream() {
   return runtime.getErrorStream();
}

代码示例来源:origin: org.jruby/jruby-complete

public void printError(Throwable t) {
  if (t instanceof RaiseException) {
    printError(((RaiseException) t).getException());
  }
  PrintStream errorStream = getErrorStream();
  try {
    t.printStackTrace(errorStream);
  } catch (Exception e) {
    t.printStackTrace(System.err);
  }
}

代码示例来源:origin: org.jruby/jruby-core

public void printError(Throwable t) {
  if (t instanceof RaiseException) {
    printError(((RaiseException) t).getException());
  }
  PrintStream errorStream = getErrorStream();
  try {
    t.printStackTrace(errorStream);
  } catch (Exception e) {
    t.printStackTrace(System.err);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

protected void printReportExceptionWarning() {
  Ruby runtime = getRuntime();
  String name = threadImpl.getReportName();
  runtime.getErrorStream().println("warning: thread \"" + name + "\" terminated with exception (report_on_exception is true):");
}

代码示例来源:origin: org.jruby/jruby-core

protected void printReportExceptionWarning() {
  Ruby runtime = getRuntime();
  String name = threadImpl.getReportName();
  runtime.getErrorStream().println("warning: thread \"" + name + "\" terminated with exception (report_on_exception is true):");
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/** Prints an error with backtrace to the error stream.
 *
 * MRI: eval.c - error_print()
 *
 */
public void printError(RubyException excp) {
  if (excp == null || excp.isNil()) {
    return;
  }
  PrintStream errorStream = getErrorStream();
  errorStream.print(config.getTraceType().printBacktrace(excp, errorStream == System.err && getPosix().isatty(FileDescriptor.err)));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** Prints an error with backtrace to the error stream.
 *
 * MRI: eval.c - error_print()
 *
 */
public void printError(RubyException excp) {
  if (excp == null || excp.isNil()) {
    return;
  }
  PrintStream errorStream = getErrorStream();
  errorStream.print(config.getTraceType().printBacktrace(excp, errorStream == System.err && getPosix().isatty(FileDescriptor.err)));
}

代码示例来源:origin: org.jruby/jruby-complete

private static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
  OutputStream error = runtime.getErrorStream();
  try {
    Process aProcess = run(runtime, rawArgs, true);
    handleStreamsNonblocking(runtime, aProcess, output, error);
    return getPidFromProcess(aProcess);
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private static void printExceptionSummary(Ruby runtime, RubyException rEx) {
  RubyStackTraceElement[] elements = rEx.getBacktraceElements();
  RubyStackTraceElement firstElement = elements.length > 0 ? elements[0] :
      new RubyStackTraceElement("", "", "(empty)", 0, false);
  String msg = String.format("Exception `%s' at %s:%s - %s\n",
      rEx.getMetaClass(),
      firstElement.getFileName(), firstElement.getLineNumber(),
      TypeConverter.convertToType(rEx, runtime.getString(), "to_s"));
  runtime.getErrorStream().print(msg);
}

代码示例来源:origin: org.jruby/jruby-core

private static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
  OutputStream error = runtime.getErrorStream();
  try {
    Process aProcess = run(runtime, rawArgs, true);
    handleStreamsNonblocking(runtime, aProcess, output, error);
    return getPidFromProcess(aProcess);
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static long runExternalWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
  OutputStream error = runtime.getErrorStream();
  try {
    Process aProcess = run(runtime, rawArgs, true, true);
    handleStreamsNonblocking(runtime, aProcess, output, error);
    return getPidFromProcess(aProcess);
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: org.jruby/jruby-core

private static void printExceptionSummary(Ruby runtime, RubyException rEx) {
  RubyStackTraceElement[] elements = rEx.getBacktraceElements();
  RubyStackTraceElement firstElement = elements.length > 0 ? elements[0] :
      new RubyStackTraceElement("", "", "(empty)", 0, false);
  String msg = String.format("Exception `%s' at %s:%s - %s\n",
      rEx.getMetaClass(),
      firstElement.getFileName(), firstElement.getLineNumber(),
      TypeConverter.convertToType(rEx, runtime.getString(), "to_s"));
  runtime.getErrorStream().print(msg);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
  OutputStream error = runtime.getErrorStream();
  try {
    Process aProcess = run(runtime, rawArgs, true);
    handleStreamsNonblocking(runtime, aProcess, output, error);
    return getPidFromProcess(aProcess);
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
  OutputStream error = runtime.getErrorStream();
  try {
    Process aProcess = run(runtime, rawArgs, true);
    handleStreamsNonblocking(runtime, aProcess, output, error);
    return getPidFromProcess(aProcess);
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static long runExternalWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
  OutputStream error = runtime.getErrorStream();
  try {
    Process aProcess = run(runtime, rawArgs, true, true);
    handleStreamsNonblocking(runtime, aProcess, output, error);
    return getPidFromProcess(aProcess);
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public static long[] runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs, OutputStream output, boolean doExecutableSearch) {
  OutputStream error = runtime.getErrorStream();
  InputStream input = runtime.getInputStream();
  try {
    Process aProcess = run(runtime, rawArgs, doExecutableSearch);
    handleStreams(runtime, aProcess, input, output, error);
    return new long[] {aProcess.waitFor(), getPidFromProcess(aProcess)};
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  } catch (InterruptedException e) {
    throw runtime.newThreadError("unexpected interrupt");
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static long[] runAndWaitPid(Ruby runtime, IRubyObject[] rawArgs, OutputStream output, boolean doExecutableSearch) {
  OutputStream error = runtime.getErrorStream();
  InputStream input = runtime.getInputStream();
  try {
    Process aProcess = run(runtime, rawArgs, doExecutableSearch);
    handleStreams(runtime, aProcess, input, output, error);
    return new long[] {aProcess.waitFor(), getPidFromProcess(aProcess)};
  } catch (IOException e) {
    throw runtime.newIOErrorFromException(e);
  } catch (InterruptedException e) {
    throw runtime.newThreadError("unexpected interrupt");
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void printExceptionSummary(ThreadContext context, Ruby runtime, RubyException rEx) {
  RubyStackTraceElement[] elements = rEx.getBacktraceElements();
  RubyStackTraceElement firstElement = elements.length > 0 ? elements[0] : new RubyStackTraceElement("", "", "(empty)", 0, false);
  String msg = String.format("Exception `%s' at %s:%s - %s\n",
      rEx.getMetaClass(),
      firstElement.getFileName(), firstElement.getLineNumber(),
      runtime.is1_9() ? TypeConverter.convertToType(rEx, runtime.getString(), "to_s") : rEx.convertToString().toString());
  runtime.getErrorStream().print(msg);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static void printExceptionSummary(ThreadContext context, Ruby runtime, RubyException rEx) {
  RubyStackTraceElement[] elements = rEx.getBacktraceElements();
  RubyStackTraceElement firstElement = elements.length > 0 ? elements[0] : new RubyStackTraceElement("", "", "(empty)", 0, false);
  String msg = String.format("Exception `%s' at %s:%s - %s\n",
      rEx.getMetaClass(),
      firstElement.getFileName(), firstElement.getLineNumber(),
      runtime.is1_9() ? TypeConverter.convertToType(rEx, runtime.getString(), "to_s") : rEx.convertToString().toString());
  runtime.getErrorStream().print(msg);
}

代码示例来源:origin: org.jruby/jruby-complete

public Class loadJavaClassVerbose(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException ex) {
    throw initCause(runtime.newNameError("cannot load Java class " + className, className, ex), ex);
  } catch (ExceptionInInitializerError ex) {
    throw initCause(runtime.newNameError("cannot initialize Java class " + className, className, ex), ex);
  } catch (LinkageError ex) {
    throw initCause(runtime.newNameError("cannot link Java class " + className + ", probable missing dependency: " + ex.getLocalizedMessage(), className, ex), ex);
  } catch (SecurityException ex) {
    if (runtime.isVerbose()) ex.printStackTrace(runtime.getErrorStream());
    throw initCause(runtime.newSecurityError(ex.getLocalizedMessage()), ex);
  }
}

相关文章

微信公众号

最新文章

更多

Ruby类方法