本文整理了Java中java.lang.Throwable.printStackTrace()
方法的一些代码示例,展示了Throwable.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Throwable.printStackTrace()
方法的具体详情如下:
包路径:java.lang.Throwable
类名称:Throwable
方法名:printStackTrace
[英]Writes a printable representation of this Throwable's stack trace to the System.err stream.
[中]将此可丢弃堆栈跟踪的可打印表示形式写入系统。错误流。
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(Throwable t1) {
t1.printStackTrace();
}
},
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(Throwable t1) {
t1.printStackTrace();
}
},
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
e.printStackTrace();
latch.countDown();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
e.printStackTrace();
latch.countDown();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
e.printStackTrace();
latch.countDown();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
count.decrementAndGet();
e.printStackTrace();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
e.printStackTrace();
latch.countDown();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
System.out.println("error: " + e.getMessage());
e.printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
error.set(e);
System.out.println("error");
e.printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
error.set(e);
System.out.println("error");
e.printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
private static void waitOnThreads(Future<?>... futures) {
for (Future<?> f : futures) {
try {
f.get(20, TimeUnit.SECONDS);
} catch (Throwable e) {
System.err.println("Failed while waiting on future.");
e.printStackTrace();
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
error.set(e);
System.out.println("error");
e.printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
private static void waitOnThreads(Future<?>... futures) {
for (Future<?> f : futures) {
try {
f.get(20, TimeUnit.SECONDS);
} catch (Throwable e) {
System.err.println("Failed while waiting on future.");
e.printStackTrace();
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
error.set(e);
System.out.println("error");
e.printStackTrace();
latch.countDown();
}
代码示例来源:origin: ReactiveX/RxJava
public static String stackTraceAsString(Throwable e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
return sw.toString();
}
代码示例来源:origin: ReactiveX/RxJava
/**
* This hijacks the Throwable.printStackTrace() output and puts it in a string, where we can look for
* "CIRCULAR REFERENCE" (a String added by Throwable.printEnclosedStackTrace)
*/
private static void assertNoCircularReferences(Throwable ex) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(baos);
ex.printStackTrace(printStream);
assertFalse(baos.toString().contains("CIRCULAR REFERENCE"));
}
代码示例来源:origin: ReactiveX/RxJava
@Test(timeout = 1000)
public void testCompositeExceptionFromParentThenChild() {
CompositeException cex = new CompositeException(ex1, ex2);
System.err.println("----------------------------- print composite stacktrace");
cex.printStackTrace();
assertEquals(2, cex.getExceptions().size());
assertNoCircularReferences(cex);
assertNotNull(getRootCause(cex));
System.err.println("----------------------------- print cause stacktrace");
cex.getCause().printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(timeout = 1000)
public void testCompositeExceptionFromChildThenParent() {
CompositeException cex = new CompositeException(ex2, ex1);
System.err.println("----------------------------- print composite stacktrace");
cex.printStackTrace();
assertEquals(2, cex.getExceptions().size());
assertNoCircularReferences(cex);
assertNotNull(getRootCause(cex));
System.err.println("----------------------------- print cause stacktrace");
cex.getCause().printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(timeout = 1000)
public void testCompositeExceptionFromChildAndComposite() {
CompositeException cex = new CompositeException(ex1, getNewCompositeExceptionWithEx123());
System.err.println("----------------------------- print composite stacktrace");
cex.printStackTrace();
assertEquals(3, cex.getExceptions().size());
assertNoCircularReferences(cex);
assertNotNull(getRootCause(cex));
System.err.println("----------------------------- print cause stacktrace");
cex.getCause().printStackTrace();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(timeout = 1000)
public void testCompositeExceptionFromCompositeAndChild() {
CompositeException cex = new CompositeException(getNewCompositeExceptionWithEx123(), ex1);
System.err.println("----------------------------- print composite stacktrace");
cex.printStackTrace();
assertEquals(3, cex.getExceptions().size());
assertNoCircularReferences(cex);
assertNotNull(getRootCause(cex));
System.err.println("----------------------------- print cause stacktrace");
cex.getCause().printStackTrace();
}
内容来源于网络,如有侵权,请联系作者删除!