private ExceptionCollection handleAnalysisExceptions ( ExceptionCollection currentEx , ExceptionCollection newEx ) throws MojoExecutionException { ExceptionCollection returnEx = currentEx ; if ( returnEx == null ) { returnEx = newEx ; } else { returnEx . getExceptions ( ) . addAll ( newEx . getExceptions ( ) ) ; if ( newEx . isFatal ( ) ) { returnEx . setFatal ( true ) ; } } if ( returnEx . isFatal ( ) ) { final String msg = String . format ( "Fatal exception(s) analyzing %s" , getProject ( ) . getName ( ) ) ; if ( this . isFailOnError ( ) ) { throw new MojoExecutionException ( msg , returnEx ) ; } getLog ( ) . error ( msg ) ; if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( returnEx ) ; } } else { final String msg = String . format ( "Exception(s) analyzing %s" , getProject ( ) . getName ( ) ) ; if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( msg , returnEx ) ; } } return returnEx ; }
Combines the two exception collections and if either are fatal throw an MojoExecutionException