@@ -205,9 +205,7 @@ private void printStackTrace(PrintStreamOrWriter s) {
205205 appendStackTrace (b , ex , "\t " );
206206 i ++;
207207 }
208- synchronized (s .lock ()) {
209- s .println (b .toString ());
210- }
208+ s .println (b .toString ());
211209 }
212210
213211 private void appendStackTrace (StringBuilder b , Throwable ex , String prefix ) {
@@ -222,9 +220,6 @@ private void appendStackTrace(StringBuilder b, Throwable ex, String prefix) {
222220 }
223221
224222 abstract static class PrintStreamOrWriter {
225- /** Returns the object to be locked when using this StreamOrWriter */
226- abstract Object lock ();
227-
228223 /** Prints the specified string as a line on this StreamOrWriter */
229224 abstract void println (Object o );
230225 }
@@ -239,11 +234,6 @@ static final class WrappedPrintStream extends PrintStreamOrWriter {
239234 this .printStream = printStream ;
240235 }
241236
242- @ Override
243- Object lock () {
244- return printStream ;
245- }
246-
247237 @ Override
248238 void println (Object o ) {
249239 printStream .println (o );
@@ -257,11 +247,6 @@ static final class WrappedPrintWriter extends PrintStreamOrWriter {
257247 this .printWriter = printWriter ;
258248 }
259249
260- @ Override
261- Object lock () {
262- return printWriter ;
263- }
264-
265250 @ Override
266251 void println (Object o ) {
267252 printWriter .println (o );
@@ -310,7 +295,7 @@ public int size() {
310295 * any suppressed exceptions.
311296 */
312297 public boolean isEmpty () {
313- return exceptions .isEmpty () && getCause () == null ;
298+ return exceptions .isEmpty ();
314299 }
315300
316301 /**
@@ -321,16 +306,15 @@ public boolean isEmpty() {
321306 */
322307 private Throwable getRootCause (Throwable e ) {
323308 Throwable root = e .getCause ();
324- if (root == null || root == e ) {
309+ if (root == null /* || cause == root */ ) { // case might not be possible
325310 return e ;
326- } else {
327- while (true ) {
328- Throwable cause = root .getCause ();
329- if (cause == null || cause == root ) {
330- return root ;
331- }
332- root = root .getCause ();
311+ }
312+ while (true ) {
313+ Throwable cause = root .getCause ();
314+ if (cause == null /* || cause == root */ ) { // case might not be possible
315+ return root ;
333316 }
317+ root = root .getCause ();
334318 }
335319 }
336320}
0 commit comments