if (emitTrainingOutput) { if (!new File(trainingOutputDir).isDirectory()) throw new IOException("Training output directory " + trainingOutputDir + " does not exist"); AnalysisContext.currentAnalysisContext().setDatabaseOutputDir(trainingOutputDir);  System.setProperty("findbugs.checkreturn.savetraining", new File(trainingOutputDir, "checkReturn.db").getPath()); } if (useTrainingInput) { if (!new File(trainingInputDir).isDirectory()) throw new IOException("Training input directory " + trainingInputDir + " does not exist"); AnalysisContext.currentAnalysisContext().setDatabaseInputDir(trainingInputDir); AnalysisContext.currentAnalysisContext().loadInterproceduralDatabases();  System.setProperty("findbugs.checkreturn.loadtraining", new File(trainingInputDir, "checkReturn.db").getPath()); }
configureTrainingDatabases();
	public void execute() throws java.io.IOException, InterruptedException {		// Configure the analysis context		analysisContext = new AnalysisContext(bugReporter);		analysisContext.setSourcePath(project.getSourceDirList());				// Enable/disable relaxed reporting mode		FindBugsAnalysisFeatures.setRelaxedMode(relaxedReportingMode);				// Enable input/output of interprocedural property databases		if (emitTrainingOutput) {			if (!new File(trainingOutputDir).isDirectory())				throw new IOException("Training output directory " + trainingOutputDir + " does not exist");			AnalysisContext.currentAnalysisContext().setDatabaseOutputDir(trainingOutputDir);			// XXX: hack			System.setProperty("findbugs.checkreturn.savetraining", new File(trainingOutputDir, "checkReturn.db").getPath());		}		if (useTrainingInput) {			if (!new File(trainingInputDir).isDirectory())				throw new IOException("Training input directory " + trainingInputDir + " does not exist");			AnalysisContext.currentAnalysisContext().setDatabaseInputDir(trainingInputDir);			AnalysisContext.currentAnalysisContext().loadInterproceduralDatabases();			// XXX: hack			System.setProperty("findbugs.checkreturn.loadtraining", new File(trainingInputDir, "checkReturn.db").getPath());		}				configureAnalysisFeatures();				// Give the BugReporter a reference to this object,		// in case it wants to access information such		// as the AnalysisContext		bugReporter.setEngine(this);				// If we have a BugCollectionBugReporter, get a handle to it.		// We use this reference to add extra information to the BugCollection,		// such as hashes of methods and classes.		if (bugReporter.getRealBugReporter() instanceof BugCollectionBugReporter) {			bugCollectionBugReporter = (BugCollectionBugReporter) bugReporter.getRealBugReporter();		}		// Create execution plan		try {			createExecutionPlan();		} catch (OrderingConstraintException e) {			IOException ioe = new IOException("Invalid detector ordering constraints");			ioe.initCause(e);			throw ioe;		}		// Clear the repository of classes		analysisContext.clearRepository();				// Get list of files to analyze.		// Note that despite the name getJarFileArray(),		// they can also be zip files, directories,		// and single class files.		LinkedList<ArchiveWorkListItem> archiveWorkList = new LinkedList<ArchiveWorkListItem>();		for (Iterator<String> i = project.getFileList().iterator(); i.hasNext(); ) {			String fileName = i.next();			archiveWorkList.add(new ArchiveWorkListItem(fileName, true));		}		// Report how many archives/directories/files will be analyzed,		// for progress dialog in GUI		progressCallback.reportNumberOfArchives(archiveWorkList.size());		// Keep track of the names of all classes to be analyzed		List<String> repositoryClassList = new LinkedList<String>();		// set the initial repository classpath.		setRepositoryClassPath();				// Record additional entries that should be added to		// the aux classpath.  These occur when one or more classes		// in a directory or archive are skipped, to ensure that		// the skipped classes can still be referenced.		List<String> additionalAuxClasspathEntryList = new LinkedList<String>();		// Add all classes in analyzed archives/directories/files		while (!archiveWorkList.isEmpty()) {			ArchiveWorkListItem item = archiveWorkList.removeFirst();			scanArchiveOrDirectory(item, archiveWorkList, repositoryClassList,				additionalAuxClasspathEntryList);		}				// Add "extra" aux classpath entries needed to ensure that		// skipped classes can be referenced.		addCollectionToClasspath(additionalAuxClasspathEntryList);		// Examine all classes for bugs.		// Don't examine the same class more than once.		// (The user might specify two jar files that contain		// the same class.)				if (DEBUG)			detectorTimings = new HashMap<String,Long>();		// Execute each analysis pass in the execution plan		for (Iterator<AnalysisPass> i = executionPlan.passIterator(); i.hasNext();) {			AnalysisPass analysisPass = i.next();			analysisPass.createDetectors(bugReporter);			executeAnalysisPass(analysisPass, repositoryClassList);						// Clear the ClassContext cache.			// It may contain data that should be recomputed on the next pass.			analysisContext.clearClassContextCache();		}		// Flush any queued bug reports		bugReporter.finish();		// Flush any queued error reports		bugReporter.reportQueuedErrors();		// Free up memory for reports		analysisContext.clearRepository();	}