public static StackTraceElement [ ] [ ] getStackTraceChain ( Throwable t , final String [ ] allow , final String [ ] deny ) { ArrayList < StackTraceElement [ ] > result = new ArrayList <> ( ) ; while ( t != null ) { StackTraceElement [ ] stack = getStackTrace ( t , allow , deny ) ; result . add ( stack ) ; t = t . getCause ( ) ; } StackTraceElement [ ] [ ] allStacks = new StackTraceElement [ result . size ( ) ] [ ] ; for ( int i = 0 ; i < allStacks . length ; i ++ ) { allStacks [ i ] = result . get ( i ) ; } return allStacks ; }
Returns stack trace chain filtered by class names .