SortedBugCollection result = newCollection.duplicate(); result.clearBugInstances(); result.addAll(origCollection.getCollection(), false);  origCollection.writeXML(outputFileName, currentProject);
updater.getResultCollection().writeXML(outputFileName, currentProject);
	public static void main(String[] args) throws IOException, DocumentException {				UpdateBugCollectionCommandLine commandLine = new UpdateBugCollectionCommandLine();		int argCount = commandLine.parse(args);		if (args.length - argCount != 3) {			System.err.println("Usage: " + UpdateBugCollection.class.getName() + " [options] " +					" <bug collection to update> <new bug colllection> <output bug collection>");			System.err.println("Options:");			commandLine.printUsage(System.err);			System.exit(1);		}				String origFileName = args[argCount++];		String newFileName = args[argCount++];		String outputFileName = args[argCount++];				SortedBugCollection origCollection = new SortedBugCollection();		origCollection.readXML(origFileName, new Project());				Project currentProject = new Project();		SortedBugCollection newCollection = new SortedBugCollection();		newCollection.readXML(newFileName, currentProject);				UpdateBugCollection updater = new UpdateBugCollection(origCollection, newCollection);		Comparator<BugInstance> comparator;		switch (commandLine.getComparatorType()) {		case VERSION_INSENSITIVE_COMPARATOR:			comparator = VersionInsensitiveBugComparator.instance();			break;		case FUZZY_COMPARATOR:			FuzzyBugComparator fuzzy = new FuzzyBugComparator();			fuzzy.registerBugCollection(origCollection);			fuzzy.registerBugCollection(newCollection);			comparator = fuzzy;			break;		case SLOPPY_COMPARATOR:			comparator = new SloppyBugComparator();			break;		default:			throw new IllegalStateException();		}		updater.setComparator(comparator);				updater.execute();				// Transfer analysis errors, missing classes, and other metadata from new collection,		// but get actual BugInstances from original collection.		SortedBugCollection result = newCollection.duplicate();		result.clearBugInstances();		result.addAll(origCollection.getCollection(), false);				origCollection.writeXML(outputFileName, currentProject);	}