* LogWriter: Prevent NPE after permissions fail

This commit is contained in:
zzz
2011-03-12 16:09:57 +00:00
parent cfc17d59b4
commit 8e672ea548

View File

@ -77,7 +77,8 @@ class LogWriter implements Runnable {
writeRecord(rec);
}
try {
_currentOut.flush();
if (_currentOut != null)
_currentOut.flush();
} catch (IOException ioe) {
if (++_diskFullMessageCount < MAX_DISKFULL_MESSAGES)
System.err.println("Error writing the router log - disk full? " + ioe);
@ -180,7 +181,8 @@ class LogWriter implements Runnable {
try {
_currentOut = new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(f), "UTF-8"));
} catch (IOException ioe) {
System.err.println("Error rotating into [" + f.getAbsolutePath() + "]" + ioe);
if (++_diskFullMessageCount < MAX_DISKFULL_MESSAGES)
System.err.println("Error creating log file [" + f.getAbsolutePath() + "]" + ioe);
}
}