本文整理了Java中java.lang.RuntimeException.printStackTrace()
方法的一些代码示例,展示了RuntimeException.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeException.printStackTrace()
方法的具体详情如下:
包路径:java.lang.RuntimeException
类名称:RuntimeException
方法名:printStackTrace
暂无
代码示例来源:origin: commons-lang/commons-lang
/**
* {@inheritDoc}
*/
public final void printPartialStackTrace(PrintWriter out) {
super.printStackTrace(out);
}
代码示例来源:origin: objectbox/objectbox-java
private void handleObserverException(Class objectClass) {
RuntimeException newEx = new RuntimeException(
"Observer failed while processing data for " + objectClass +
". Consider using an ErrorObserver");
// So it won't be swallowed by thread pool
newEx.printStackTrace();
throw newEx;
}
代码示例来源:origin: commons-collections/commons-collections
/**
* Prints the stack trace of this exception to the specified writer.
*
* @param out the <code>PrintWriter</code> to use for output
*/
public void printStackTrace(PrintWriter out) {
synchronized (out) {
super.printStackTrace(out);
if (rootCause != null && JDK_SUPPORTS_NESTED == false) {
out.print("Caused by: ");
rootCause.printStackTrace(out);
}
}
}
代码示例来源:origin: javax.xml.bind/jaxb-api
/**
* Prints this TypeConstraintException and its stack trace (including the stack trace
* of the linkedException if it is non-null) to the PrintStream.
*
* @param s PrintStream to use for output
*/
public void printStackTrace( java.io.PrintStream s ) {
if( linkedException != null ) {
linkedException.printStackTrace(s);
s.println("--------------- linked to ------------------");
}
super.printStackTrace(s);
}
代码示例来源:origin: redisson/redisson
@Override
public void printStackTrace(PrintStream ps) {
synchronized (ps) {
super.printStackTrace(ps);
if ((cause != null) && showCauseDetails) {
Throwable rootCause = ExceptionUtil.getRootCause(cause);
ps.println(CAUSE_DIV);
rootCause.printStackTrace(ps);
}
}
}
代码示例来源:origin: redisson/redisson
@Override
public void printStackTrace(PrintWriter pw) {
synchronized (pw) {
super.printStackTrace(pw);
if ((cause != null) && showCauseDetails) {
Throwable rootCause = ExceptionUtil.getRootCause(cause);
pw.println(CAUSE_DIV);
rootCause.printStackTrace(pw);
}
}
}
代码示例来源:origin: log4j/log4j
public
HUPNode(Socket socket, ExternallyRolledFileAppender er) {
this.socket = socket;
this.er = er;
try {
dis = new DataInputStream(socket.getInputStream());
dos = new DataOutputStream(socket.getOutputStream());
} catch(InterruptedIOException e) {
Thread.currentThread().interrupt();
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
} catch(RuntimeException e) {
e.printStackTrace();
}
}
代码示例来源:origin: oblac/jodd
@Override
public void printStackTrace(final PrintStream ps) {
synchronized (ps) {
super.printStackTrace(ps);
if ((cause != null) && showCauseDetails) {
Throwable rootCause = ExceptionUtil.getRootCause(cause);
ps.println(CAUSE_DIV);
rootCause.printStackTrace(ps);
}
}
}
代码示例来源:origin: oblac/jodd
@Override
public void printStackTrace(final PrintWriter pw) {
synchronized (pw) {
super.printStackTrace(pw);
if ((cause != null) && showCauseDetails) {
Throwable rootCause = ExceptionUtil.getRootCause(cause);
pw.println(CAUSE_DIV);
rootCause.printStackTrace(pw);
}
}
}
代码示例来源:origin: ReactiveX/RxJava
protected void captureMaxThreads() {
int concurrentThreads = threadsRunning.get();
int maxThreads = maxConcurrentThreads.get();
if (concurrentThreads > maxThreads) {
maxConcurrentThreads.compareAndSet(maxThreads, concurrentThreads);
if (concurrentThreads > 1) {
new RuntimeException("should not be greater than 1").printStackTrace();
}
}
}
代码示例来源:origin: ReactiveX/RxJava
protected void captureMaxThreads() {
int concurrentThreads = threadsRunning.get();
int maxThreads = maxConcurrentThreads.get();
if (concurrentThreads > maxThreads) {
maxConcurrentThreads.compareAndSet(maxThreads, concurrentThreads);
if (concurrentThreads > 1) {
new RuntimeException("should not be greater than 1").printStackTrace();
}
}
}
代码示例来源:origin: btraceio/btrace
public void caught() {
try {
throw new RuntimeException("ho-hey");
} catch (RuntimeException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: log4j/log4j
public
void run() {
while(!isInterrupted()) {
try {
ServerSocket serverSocket = new ServerSocket(port);
while(true) {
Socket socket = serverSocket.accept();
LogLog.debug("Connected to client at " + socket.getInetAddress());
new Thread(new HUPNode(socket, er), "ExternallyRolledFileAppender-HUP").start();
}
} catch(InterruptedIOException e) {
Thread.currentThread().interrupt();
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
} catch(RuntimeException e) {
e.printStackTrace();
}
}
}
}
代码示例来源:origin: log4j/log4j
/**
* Enables the to get the values of several attributes of the Dynamic MBean.
*/
public
AttributeList getAttributes(String[] attributeNames) {
// Check attributeNames is not null to avoid NullPointerException later on
if (attributeNames == null) {
throw new RuntimeOperationsException(
new IllegalArgumentException("attributeNames[] cannot be null"),
"Cannot invoke a getter of " + dClassName);
}
AttributeList resultList = new AttributeList();
// if attributeNames is empty, return an empty result list
if (attributeNames.length == 0)
return resultList;
// build the result attribute list
for (int i=0 ; i<attributeNames.length ; i++){
try {
Object value = getAttribute((String) attributeNames[i]);
resultList.add(new Attribute(attributeNames[i],value));
} catch (JMException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}
}
return(resultList);
}
代码示例来源:origin: log4j/log4j
/** all of the options have been set, create the socket handler and
wait for connections. */
public void activateOptions() {
try {
sh = new SocketHandler(port);
sh.start();
}
catch(InterruptedIOException e) {
Thread.currentThread().interrupt();
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
} catch(RuntimeException e) {
e.printStackTrace();
}
super.activateOptions();
}
代码示例来源:origin: spring-projects/spring-framework
ex.printStackTrace();
代码示例来源:origin: ReactiveX/RxJava
@Test(timeout = 5000)
public void fromFutureThrows() {
ExecutorService exec = Executors.newSingleThreadExecutor();
Completable c = Completable.fromFuture(exec.submit(new Runnable() {
@Override
public void run() {
throw new TestException();
}
}));
try {
c.blockingAwait();
Assert.fail("Failed to throw Exception");
} catch (RuntimeException ex) {
if (!((ex.getCause() instanceof ExecutionException) && (ex.getCause().getCause() instanceof TestException))) {
ex.printStackTrace();
Assert.fail("Wrong exception received");
}
} finally {
exec.shutdown();
}
}
代码示例来源:origin: prestodb/presto
public void renderFailure(PrintStream out)
{
QueryStatusInfo results = client.finalStatusInfo();
QueryError error = results.getError();
checkState(error != null);
out.printf("Query %s failed: %s%n", results.getId(), error.getMessage());
if (debug && (error.getFailureInfo() != null)) {
error.getFailureInfo().toException().printStackTrace(out);
}
if (error.getErrorLocation() != null) {
renderErrorLocation(client.getQuery(), error.getErrorLocation(), out);
}
out.println();
}
代码示例来源:origin: spring-projects/spring-loaded
public Class<?> loadit(String name, byte[] bytes) {
try {
return ((TestClassLoader) binLoader).defineTheClass(name, bytes);
}
catch (RuntimeException t) {
ClassPrinter.print(bytes);
t.printStackTrace();
throw t;
}
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testFailedUnixCommand() throws Exception {
// Initialize the Props
this.props.put(ProcessJob.COMMAND, "xls -al");
try {
this.job.run();
} catch (final RuntimeException e) {
Assert.assertTrue(true);
e.printStackTrace();
}
}
内容来源于网络,如有侵权,请联系作者删除!