This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new c2cf5a3  BZ 61484. Repeated log messages with missing tomcat-users.xml
c2cf5a3 is described below

commit c2cf5a33df93c33f812a12bb29acabeea0e974d1
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Mar 3 10:29:19 2020 +0000

    BZ 61484. Repeated log messages with missing tomcat-users.xml
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=64184
---
 java/org/apache/catalina/users/MemoryUserDatabase.java | 6 ++++++
 webapps/docs/changelog.xml                             | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java 
b/java/org/apache/catalina/users/MemoryUserDatabase.java
index 778a1a2..7c81f11 100644
--- a/java/org/apache/catalina/users/MemoryUserDatabase.java
+++ b/java/org/apache/catalina/users/MemoryUserDatabase.java
@@ -17,6 +17,7 @@
 package org.apache.catalina.users;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
@@ -683,6 +684,11 @@ public class MemoryUserDatabase implements UserDatabase {
                 try {
                     // Can't close a uConn directly. Have to do it like this.
                     uConn.getInputStream().close();
+                } catch (FileNotFoundException fnfe) {
+                    // The file doesn't exist.
+                    // This has been logged above. No need to log again.
+                    // Set the last modified time to avoid repeated log 
messages
+                    this.lastModified = 0;
                 } catch (IOException ioe) {
                     log.warn(sm.getString("memoryUserDatabase.fileClose", 
pathname), ioe);
                 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 38c436d..98b2072 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -85,6 +85,11 @@
         support authentication persistence. Patch provided by Carsten Klein.
         (markt)
       </add>
+      <fix>
+        <bug>64184</bug>: Avoid repeated log messages if a
+        <code>MemoryUserDatabase</code> is configured but the specified
+        configuration file is missing. (markt)
+      </fix>
       <add>
         <bug>64189</bug>: Expose the web application version String as a
         <code>ServletContext</code> attribute named


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to