private void addLineScreenCaptureForErrorEachStackLine ( List < LineScreenCapture > lineScreenCaptures , RunFailure runFailure ) { if ( runFailure == null ) { return ; // do nothing } List < StackLine > failureLines = runFailure . getStackLines ( ) ; int failureCaptureIndex = matchedLineScreenCaptureIndex ( lineScreenCaptures , failureLines ) ; if ( failureCaptureIndex == - 1 ) { return ; // no failure capture } LineScreenCapture failureCapture = lineScreenCaptures . get ( failureCaptureIndex ) ; for ( int i = 1 ; i < failureLines . size ( ) ; i ++ ) { List < StackLine > errorEachStackLine = new ArrayList <> ( failureLines . size ( ) - i ) ; for ( int j = i ; j < failureLines . size ( ) ; j ++ ) { errorEachStackLine . add ( failureLines . get ( j ) ) ; } LineScreenCapture newCapture = new LineScreenCapture ( ) ; newCapture . setPath ( failureCapture . getPath ( ) ) ; newCapture . addAllStackLines ( errorEachStackLine ) ; int errEachStackLineCaptureIndex = matchedLineScreenCaptureIndex ( lineScreenCaptures , errorEachStackLine ) ; if ( errEachStackLineCaptureIndex == - 1 ) { lineScreenCaptures . add ( newCapture ) ; } else { lineScreenCaptures . set ( errEachStackLineCaptureIndex , newCapture ) ; } } }
The same capture is used for the all StackLines .