james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgoldst...@apache.org
Subject cvs commit: jakarta-james/src/java/org/apache/james/userrepository AbstractUsersRepository.java DefaultUser.java JamesUsersJdbcRepository.java UsersFileRepository.java
Date Wed, 07 Aug 2002 23:24:27 GMT
pgoldstein    2002/08/07 16:24:27

  Modified:    src/java/org/apache/james/userrepository
                        AbstractUsersRepository.java DefaultUser.java
                        JamesUsersJdbcRepository.java
                        UsersFileRepository.java
  Log:
  Part of the String=>StringBuffer changes.  Includes some additional
  commenting, formatting fixes, and wrapping of logging calls in log
  level checks.  Also converted equalsIgnoreCase paradigm as discussed on
  mailing list.  Locale issue for both toUpperCase() and toLowerCase() was
  addressed as well.
  
  Revision  Changes    Path
  1.6       +1 -1      jakarta-james/src/java/org/apache/james/userrepository/AbstractUsersRepository.java
  
  Index: AbstractUsersRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/userrepository/AbstractUsersRepository.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractUsersRepository.java	30 Jul 2002 10:38:35 -0000	1.5
  +++ AbstractUsersRepository.java	7 Aug 2002 23:24:27 -0000	1.6
  @@ -78,7 +78,7 @@
       /**
        * Gets a user by name, ignoring case if specified.
        * This implementation gets the entire set of users,
  -     *  and scrolls through searching for one matching <code>name</code>.
  +     * and scrolls through searching for one matching <code>name</code>.
        */
       protected User getUserByName(String name, boolean ignoreCase)
       {
  
  
  
  1.4       +13 -13    jakarta-james/src/java/org/apache/james/userrepository/DefaultUser.java
  
  Index: DefaultUser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/userrepository/DefaultUser.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultUser.java	30 Jul 2002 10:38:35 -0000	1.3
  +++ DefaultUser.java	7 Aug 2002 23:24:27 -0000	1.4
  @@ -36,7 +36,7 @@
        */
       public DefaultUser(String name, String hashAlg) {
           userName = name;
  -	algorithm = hashAlg;
  +        algorithm = hashAlg;
       }
   
       /**
  @@ -49,8 +49,8 @@
        * password
        */
       public DefaultUser(String name, String passwordHash, String hashAlg) {
  -	userName = name;
  -	hashedPassword = passwordHash;
  +        userName = name;
  +        hashedPassword = passwordHash;
           algorithm = hashAlg;
       }
   
  @@ -60,7 +60,7 @@
        * @return the String of this users name
        */
       public String getUserName() {
  -	return userName;
  +        return userName;
       }
   
       /**
  @@ -72,11 +72,11 @@
        */
       public boolean verifyPassword(String pass) {
           try {
  - 	    String hashGuess = DigestUtil.digestString(pass, algorithm);
  -	    return hashedPassword.equals(hashGuess);
  +            String hashGuess = DigestUtil.digestString(pass, algorithm);
  +            return hashedPassword.equals(hashGuess);
           } catch (NoSuchAlgorithmException nsae) {
  -	    throw new RuntimeException("Security error: " + nsae);
  -	}
  +        throw new RuntimeException("Security error: " + nsae);
  +    }
       }
   
       /**
  @@ -91,8 +91,8 @@
               hashedPassword = DigestUtil.digestString(newPass, algorithm);
               return true;
           } catch (NoSuchAlgorithmException nsae) {
  -	    throw new RuntimeException("Security error: " + nsae);
  -	}
  +            throw new RuntimeException("Security error: " + nsae);
  +        }
       }
   
       /**
  @@ -101,7 +101,7 @@
        * @return the String of the hashed Password
        */
       protected String getHashedPassword() {
  -	return hashedPassword;
  +        return hashedPassword;
       }
   
       /**
  
  
  
  1.3       +8 -3      jakarta-james/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java
  
  Index: JamesUsersJdbcRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JamesUsersJdbcRepository.java	18 Jan 2002 02:48:39 -0000	1.2
  +++ JamesUsersJdbcRepository.java	7 Aug 2002 23:24:27 -0000	1.3
  @@ -39,9 +39,14 @@
                   forwardAddress = new MailAddress(forwardingDestination);
               }
               catch (javax.mail.internet.ParseException pe) {
  -                throw new RuntimeException(
  -                    "Invalid mail address in database: " + forwardingDestination + 
  -                    ", for user " + username + ".");
  +                StringBuffer exceptionBuffer =
  +                    new StringBuffer(256)
  +                        .append("Invalid mail address in database: ")
  +                        .append(forwardingDestination)
  +                        .append(", for user ")
  +                        .append(username)
  +                        .append(".");
  +                throw new RuntimeException(exceptionBuffer.toString());
               }
           }
   
  
  
  
  1.6       +13 -7     jakarta-james/src/java/org/apache/james/userrepository/UsersFileRepository.java
  
  Index: UsersFileRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/userrepository/UsersFileRepository.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UsersFileRepository.java	18 Jan 2002 02:48:39 -0000	1.5
  +++ UsersFileRepository.java	7 Aug 2002 23:24:27 -0000	1.6
  @@ -9,7 +9,6 @@
   
   import org.apache.avalon.cornerstone.services.store.ObjectRepository;
   import org.apache.avalon.cornerstone.services.store.Store;
  -import org.apache.avalon.excalibur.concurrent.Lock;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -54,7 +53,6 @@
       private Store store;
       private ObjectRepository or;
       private String destination;
  -    private Lock lock  = new Lock();
   
       public void configure( final Configuration configuration )
           throws ConfigurationException {
  @@ -72,7 +70,6 @@
   	try {
               store = (Store)componentManager.
                   lookup( "org.apache.avalon.cornerstone.services.store.Store" );
  -            lock = new Lock();
   
           } catch (Exception e) {
               final String message = "Failed to retrieve Store component:" + e.getMessage();
  @@ -95,9 +92,18 @@
               objectConfiguration.setAttribute( "model", "SYNCHRONOUS" );
   
               or = (ObjectRepository)store.select( objectConfiguration );
  -	    getLogger().debug(this.getClass().getName() + " created in " + destination);
  +            if (getLogger().isDebugEnabled()) {
  +                StringBuffer logBuffer =
  +                    new StringBuffer(192)
  +                            .append(this.getClass().getName())
  +                            .append(" created in ")
  +                            .append(destination);
  +                getLogger().debug(logBuffer.toString());
  +            }
           } catch (Exception e) {
  -            getLogger().error("Failed to initialize repository:" + e.getMessage(), e );
  +            if (getLogger().isErrorEnabled()) {
  +                getLogger().error("Failed to initialize repository:" + e.getMessage(),
e );
  +            }
               throw e;
           }
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message