commonPrefix = Math.min(commonPrefix, lengthCommonPrefix(firstPathParts, getFilePathParts(args[i])));
}
String origFilename = args[argCount++];
BugCollection origCollection;
origCollection = new SortedBugCollection();
if (verbose) {
System.out.println("Starting with " + origFilename);
}
while (true) {
try {
while (true) {
File f = new File(origFilename);
if (f.length() > 0) {
break;
}
if (verbose) {
System.out.println("Empty input file: " + f);
}
origFilename = args[argCount++];
}
origCollection.readXML(origFilename);
break;
} catch (Exception e) {
if (verbose) {
System.out.println("Error reading " + origFilename);
e.printStackTrace(System.out);
}
origFilename = args[argCount++];
}
}
if (commandLine.overrideRevisionNames || origCollection.getReleaseName() == null
|| origCollection.getReleaseName().length() == 0) {
if (commonPrefix >= firstPathParts.length) {
// This should only happen if either
//
// (1) there is only one input file, or
// (2) all of the input files have the same name
//
// In either case, make the release name the same
// as the file part of the input file(s).
commonPrefix = firstPathParts.length - 1;
}
origCollection.setReleaseName(firstPathParts[commonPrefix]);
if (useAnalysisTimes) {
origCollection.setTimestamp(origCollection.getAnalysisTimestamp());
}
}
for (BugInstance bug : origCollection.getCollection()) {
if (bug.getLastVersion() >= 0 && bug.getFirstVersion() > bug.getLastVersion()) {
throw new IllegalStateException("Illegal Version range: " + bug.getFirstVersion() + ".." + bug.getLastVersion());
}
}
discardUnwantedBugs(origCollection);
while (argCount <= (args.length - 1)) {
BugCollection newCollection = new SortedBugCollection();
String newFilename = args[argCount++];
if (verbose) {
System.out.println("Merging " + newFilename);
}
try {
File f = new File(newFilename);
if (f.length() == 0) {
if (verbose) {
System.out.println("Empty input file: " + f);
}
continue;
}
newCollection.readXML(newFilename);
if (commandLine.overrideRevisionNames || newCollection.getReleaseName() == null
|| newCollection.getReleaseName().length() == 0) {
newCollection.setReleaseName(getFilePathParts(newFilename)[commonPrefix]);
}
if (useAnalysisTimes) {
newCollection.setTimestamp(newCollection.getAnalysisTimestamp());
}
discardUnwantedBugs(newCollection);
origCollection = mergeCollections(origCollection, newCollection, true, false);
} catch (IOException e) {