* NetDB: Fix cases where corrupt RouterInfo files were not deleted (ticket #1190)

This commit is contained in:
zzz
2014-01-31 18:32:22 +00:00
parent 5e16c42e4e
commit 887f953efb

View File

@@ -478,7 +478,7 @@ class PersistentDataStore extends TransientDataStore {
if (!shouldRead()) return;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Reading " + _routerFile);
try {
InputStream fis = null;
boolean corrupt = false;
try {
@@ -519,14 +519,14 @@ class PersistentDataStore extends TransientDataStore {
if (_log.shouldLog(Log.INFO))
_log.info("Error reading the routerInfo from " + _routerFile.getName(), dfe);
corrupt = true;
} catch (IOException ioe) {
if (_log.shouldLog(Log.INFO))
_log.info("Unable to read the router reference in " + _routerFile.getName(), ioe);
corrupt = true;
} finally {
if (fis != null) try { fis.close(); } catch (IOException ioe) {}
}
if (corrupt) _routerFile.delete();
} catch (IOException ioe) {
if (_log.shouldLog(Log.INFO))
_log.info("Unable to read the router reference in " + _routerFile.getName(), ioe);
}
}
}