GP-1384: No longer relying on File.lastModified() == 0 to check for file

existence
This commit is contained in:
Ryan Kurtz
2021-10-07 13:33:15 -04:00
parent 0e0b6c90b3
commit f8969b8192
2 changed files with 3 additions and 4 deletions

View File

@@ -556,10 +556,10 @@ public class PackedDatabase extends Database {
lock(packedDbLock, true, true);
}
try {
long modTime = packedDbFile.lastModified();
if (modTime == 0) {
if (!packedDbFile.isFile()) {
throw new FileNotFoundException("File not found: " + packedDbFile);
}
long modTime = packedDbFile.lastModified();
if (isCached) {
CachedDB entry = PackedDatabaseCache.getCache().getCachedDBEntry(packedDbFile);
if (entry != null && entry.getLastModified() == modTime) {

View File

@@ -216,8 +216,7 @@ public class PackedDatabaseCache {
ItemDeserializer itemDeserializer = null;
boolean success = false;
try {
long dbTime = packedDbFile.lastModified();
if (dbTime == 0 || !packedDbFile.isFile()) {
if (!packedDbFile.isFile()) {
throw new FileNotFoundException("File not found: " + packedDbFile);
}
itemDeserializer = new ItemDeserializer(packedDbFile);