tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/users MemoryUserDatabase.java
Date Mon, 05 Jan 2004 15:04:14 GMT
remm        2004/01/05 07:04:14

  Modified:    catalina/src/share/org/apache/catalina/users
                        MemoryUserDatabase.java
  Log:
  - Bug 25822: Only save the user database if it's modified.
  - Submitted by Xavier Poinsard.
  
  Revision  Changes    Path
  1.3       +22 -4     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/users/MemoryUserDatabase.java
  
  Index: MemoryUserDatabase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/users/MemoryUserDatabase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MemoryUserDatabase.java	14 Aug 2002 19:36:17 -0000	1.2
  +++ MemoryUserDatabase.java	5 Jan 2004 15:04:14 -0000	1.3
  @@ -138,6 +138,12 @@
   
   
       /**
  +     * Was the database modified ?
  +     */
  +    private boolean modified = false;
  +
  +
  +    /**
        * The relative (to <code>catalina.base</code>) or absolute pathname to
        * the XML file in which we will save our persistent information.
        */
  @@ -287,6 +293,7 @@
           synchronized (groups) {
               groups.put(group.getGroupname(), group);
           }
  +        modified = true;
           return (group);
   
       }
  @@ -304,6 +311,7 @@
           synchronized (roles) {
               roles.put(role.getRolename(), role);
           }
  +        modified = true;
           return (role);
   
       }
  @@ -323,6 +331,7 @@
           synchronized (users) {
               users.put(user.getUsername(), user);
           }
  +        modified = true;
           return (user);
   
       }
  @@ -426,6 +435,7 @@
   
               }
           }
  +        modified = false;
   
       }
   
  @@ -445,6 +455,7 @@
               }
               groups.remove(group.getGroupname());
           }
  +        modified = true;
   
       }
   
  @@ -469,6 +480,7 @@
               }
               roles.remove(role.getRolename());
           }
  +        modified = true;
   
       }
   
  @@ -483,6 +495,7 @@
           synchronized (users) {
               users.remove(user.getUsername());
           }
  +        modified = true;
   
       }
   
  @@ -494,6 +507,11 @@
        * @exception Exception if any exception is thrown during saving
        */
       public void save() throws Exception {
  +
  +        if (!modified) {
  +            return;
  +        }
  +        modified = false;
   
           // Write out contents to a temporary file
           File fileNew = new File(pathnameNew);
  
  
  

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


Mime
View raw message