Skip to content

Commit 52c792b

Browse files
committed
Fix repeated logging when file cannot be found
1 parent ecdb83c commit 52c792b

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

java/org/apache/catalina/users/MemoryUserDatabase.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.apache.catalina.users;
1818

1919
import java.io.File;
20-
import java.io.FileNotFoundException;
2120
import java.io.FileOutputStream;
2221
import java.io.IOException;
2322
import java.io.OutputStreamWriter;
@@ -392,6 +391,9 @@ public void open() throws Exception {
392391
// Parse the XML input to load this database
393392
digester.parse(resource.getInputStream());
394393
} catch (IOException ioe) {
394+
// The file doesn't exist / isn't accessible
395+
// Set the last modified time to avoid repeated log messages
396+
this.lastModified = 0;
395397
log.error(sm.getString("memoryUserDatabase.fileNotFound", pathName));
396398
} catch (Exception e) {
397399
// Fail safe on error
@@ -644,11 +646,6 @@ public void backgroundProcess() {
644646
writeLock.unlock();
645647
}
646648
}
647-
} catch (FileNotFoundException fnfe) {
648-
// The file doesn't exist.
649-
// This has been logged above. No need to log again.
650-
// Set the last modified time to avoid repeated log messages
651-
this.lastModified = 0;
652649
} catch (IOException ioe) {
653650
log.warn(sm.getString("memoryUserDatabase.fileClose", pathname), ioe);
654651
}

0 commit comments

Comments
 (0)