Java findbugsEngine = (Java) project.createTask("java");
findbugsEngine = (Java) project.createTask("java");
	private void execFindbugs() throws BuildException {		Java findbugsEngine = (Java) project.createTask("java");		findbugsEngine.setTaskName( getTaskName() );		findbugsEngine.setFork( true );		findbugsEngine.setDir( new File(homeDir + File.separator + "lib"));		findbugsEngine.setJar( new File( homeDir + File.separator + "lib" +                                          File.separator + FINDBUGS_JAR ) );		findbugsEngine.setTimeout( new Long( TIMEOUT ) );		if ( debug )			jvmargs = jvmargs + " -Dfindbugs.debug=true";		findbugsEngine.createJvmarg().setLine( jvmargs ); 		if ( outputFileName != null) {			findbugsEngine.setOutput(new File(outputFileName));		}		StringBuffer sb = new StringBuffer( 1024 );		sb.append( "-home " + homeDir );		if ( sorted ) sb.append( " -sortByClass");		if ( outputFormat != null && 			 outputFormat.trim().equalsIgnoreCase("xml") ) {			sb.append( " -xml");		}		if ( quietErrors ) sb.append( " -quiet" );		if ( reportLevel != null ) sb.append( " -" + reportLevel.trim().toLowerCase() );		if ( projectFile != null ) sb.append( " -project " + projectFile );		if ( excludeFile != null) sb.append( " -exclude " + excludeFile );		if ( includeFile != null) sb.append( " -include " + includeFile );		if ( visitors != null) sb.append( " -visitors " + visitors );		if ( omitVisitors != null ) sb.append( " -omitvisitors " + omitVisitors );		if ( auxClasspath != null ) sb.append( " -auxclasspath " + auxClasspath );		if ( sourcePath != null) sb.append( " -sourcepath " + sourcePath );		sb.append( " -exitcode" );        Iterator itr = classLocations.iterator();        while ( itr.hasNext() ) {        	sb.append( " " + itr.next().toString() );      	} 		findbugsEngine.createArg().setLine( sb.toString() );		log("Running FindBugs...");		int rc = findbugsEngine.executeJava();		if ((rc & ExitCodes.ERROR_FLAG) != 0) {			throw new BuildException("Execution of findbugs failed.");		}		if ((rc & ExitCodes.BUGS_FOUND_FLAG) != 0) {			log("Bugs were found");		} else {			log("No bugs were found");		}		if ((rc & ExitCodes.MISSING_CLASS_FLAG) != 0) {			log("Classes needed for analysis were missing");		}		if (outputFileName != null) {			log("Output saved to " + outputFileName);		}    } 