本文整理了Java中org.jruby.Ruby.getErrorStream
方法的一些代码示例,展示了Ruby.getErrorStream
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getErrorStream
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!