private static boolean addCausalChain ( Set < Throwable > seen , Throwable t ) { for ( ; t != null ; t = t . getCause ( ) ) { boolean firstTimeSeen = seen . add ( t ) ; if ( ! firstTimeSeen ) { /* * We've seen this, so we've seen its causes, too. No need to re-add them. (There's one case * where this isn't true, but we ignore it: If we record an exception, then someone calls * initCause() on it, and then we examine it again, we'll conclude that we've seen the whole * chain before when it fact we haven't. But this should be rare.) */ return false ; } } return true ; }
Adds the chain to the seen set and returns whether all the chain was new to us .