/** * {@inheritDoc} */ public final void printPartialStackTrace(PrintWriter out) { super.printStackTrace(out); }
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; }
/** * 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); } } }
/** * 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); }
@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); } } }
@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); } } }
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(); } }
@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); } } }
@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); } } }
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(); } } }
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(); } } }
public void caught() { try { throw new RuntimeException("ho-hey"); } catch (RuntimeException e) { e.printStackTrace(); } } }
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(); } } } }
/** * 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); }
/** 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(); }
@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(); } }
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(); }
public Class<?> loadit(String name, byte[] bytes) { try { return ((TestClassLoader) binLoader).defineTheClass(name, bytes); } catch (RuntimeException t) { ClassPrinter.print(bytes); t.printStackTrace(); throw t; } }
@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(); } }