existList[i] = componentFiles[i].exists();
if (i < 2 && !existList[i]) {
// First 2 files are REQUIRED
throw new FileNotFoundException(
RB.file_missing.getString(
componentFiles[i].getAbsolutePath()));
}
}
if (abortUponModify) {
Properties p = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(propertiesFile);
p.load(fis);
} finally {
try {
if (fis != null) {
fis.close();
}
} finally {
fis = null; // Encourage buffer GC
}
}
String modifiedString = p.getProperty("modified");
if (modifiedString != null
&& (modifiedString.equalsIgnoreCase("yes")
|| modifiedString.equalsIgnoreCase("true"))) {
throw new IllegalStateException(
RB.modified_property.getString(modifiedString));
}
}
TarGenerator generator = new TarGenerator(archiveFile, overWrite,
new Integer(DbBackup.generateBufferBlockValue(componentFiles)));
for (File componentFile : componentFiles) {
if (!componentFile.exists()) {
continue;
// We've already verified that required files exist, therefore
// there is no error condition here.
}
generator.queueEntry(componentFile.getName(), componentFile);
}
generator.write();
if (abortUponModify) {
try {
for (int i = 0; i < componentFiles.length; i++) {
if (componentFiles[i].exists()) {
if (!existList[i]) {
throw new FileNotFoundException(
RB.file_disappeared.getString(
componentFiles[i].getAbsolutePath()));
}
if (componentFiles[i].lastModified() > startTime) {
throw new FileNotFoundException(
RB.file_changed.getString(
componentFiles[i].getAbsolutePath()));
}
} else if (existList[i]) {
throw new FileNotFoundException(
RB.file_appeared.getString(
componentFiles[i].getAbsolutePath()));
}
}
} catch (IllegalStateException ise) {