private void execFindbugs ( ) throws BuildException { System . out . println ( "Executing SpotBugs " + this . getClass ( ) . getSimpleName ( ) + " from ant task" ) ; createFindbugsEngine ( ) ; configureFindbugsEngine ( ) ; beforeExecuteJavaProcess ( ) ; if ( getDebug ( ) ) { log ( getFindbugsEngine ( ) . getCommandLine ( ) . describeCommand ( ) ) ; } /* * set property containing return code of child process using a task * identifier and a UUID to ensure exit code corresponds to this * execution (the base Ant Task won't overwrite return code once it's * been set, so unique identifiers must be used for each execution if we * want to get the exit code) */ String execReturnCodeIdentifier = execResultProperty + "." + UUID . randomUUID ( ) . toString ( ) ; getFindbugsEngine ( ) . setResultProperty ( execReturnCodeIdentifier ) ; /* * if the execution fails, we'll report it ourself -- prevent the * underlying Ant Java object from throwing an exception */ getFindbugsEngine ( ) . setFailonerror ( false ) ; try { getFindbugsEngine ( ) . execute ( ) ; } catch ( BuildException be ) { // setFailonerror(false) should ensure that this doesn't happen, // but... log ( be . toString ( ) ) ; } String returnProperty = getFindbugsEngine ( ) . getProject ( ) . getProperty ( execReturnCodeIdentifier ) ; int rc = returnProperty == null ? 0 : Integer . parseInt ( returnProperty ) ; afterExecuteJavaProcess ( rc ) ; }
Create a new JVM to do the work .