tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ValveBase.java
Date Wed, 23 Feb 2005 19:27:56 GMT
luehe       2005/02/23 11:27:56

  Modified:    catalina/src/share/org/apache/catalina/authenticator
                        FormAuthenticator.java NonLoginAuthenticator.java
                        SSLAuthenticator.java SingleSignOn.java
               catalina/src/share/org/apache/catalina/realm
                        DataSourceRealm.java JDBCRealm.java JNDIRealm.java
                        RealmBase.java UserDatabaseRealm.java
               catalina/src/share/org/apache/catalina/valves ValveBase.java
  Log:
  No change in functionality.
  
  Added new "containerLog" instance var to RealmBase and ValveBase, which is
  initialized as "container.getLogger()" inside setContainer().
  
  This will make it easier to do something like
  
    containerLog = LogFactory.getLog(container.logName()+".RealmBase");
  
  in the future, as suggested by Bill Barker.
  
  Revision  Changes    Path
  1.18      +3 -3      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java
  
  Index: FormAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- FormAuthenticator.java	18 Feb 2005 23:35:18 -0000	1.17
  +++ FormAuthenticator.java	23 Feb 2005 19:27:56 -0000	1.18
  @@ -272,8 +272,8 @@
           if (session == null)
               session = request.getSessionInternal(false);
           if (session == null) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug("User took so long to log on the session expired");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug("User took so long to log on the session expired");
               response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT,
                                  sm.getString("authenticator.sessionExpired"));
               return (false);
  
  
  
  1.10      +3 -3      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/NonLoginAuthenticator.java
  
  Index: NonLoginAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/NonLoginAuthenticator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NonLoginAuthenticator.java	18 Feb 2005 23:35:18 -0000	1.9
  +++ NonLoginAuthenticator.java	23 Feb 2005 19:27:56 -0000	1.10
  @@ -91,8 +91,8 @@
               associate(ssoId, getSession(request, true));
           */
           
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("User authentication is not required");
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("User authentication is not required");
           return (true);
   
   
  
  
  
  1.21      +9 -9      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SSLAuthenticator.java
  
  Index: SSLAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SSLAuthenticator.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SSLAuthenticator.java	18 Feb 2005 23:35:18 -0000	1.20
  +++ SSLAuthenticator.java	23 Feb 2005 19:27:56 -0000	1.21
  @@ -89,8 +89,8 @@
           Principal principal = request.getUserPrincipal();
           //String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
           if (principal != null) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug("Already authenticated '" + principal.getName()
+ "'");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug("Already authenticated '" + principal.getName() + "'");
               // Associate the session with any existing SSO session in order
               // to get coordinated session invalidation at logout
               String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
  @@ -125,8 +125,8 @@
           */
   
           // Retrieve the certificate chain for this client
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug(" Looking up certificates");
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug(" Looking up certificates");
   
           X509Certificate certs[] = (X509Certificate[])
               request.getAttribute(Globals.CERTIFICATES_ATTR);
  @@ -137,8 +137,8 @@
                   request.getAttribute(Globals.CERTIFICATES_ATTR);
           }
           if ((certs == null) || (certs.length < 1)) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug("  No certificates included with this request");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug("  No certificates included with this request");
               response.sendError(HttpServletResponse.SC_BAD_REQUEST,
                                  sm.getString("authenticator.certificates"));
               return (false);
  @@ -147,8 +147,8 @@
           // Authenticate the specified certificate chain
           principal = context.getRealm().authenticate(certs);
           if (principal == null) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug("  Realm.authenticate() returned false");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug("  Realm.authenticate() returned false");
               response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
                                  sm.getString("authenticator.unauthorized"));
               return (false);
  
  
  
  1.22      +29 -29    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java
  
  Index: SingleSignOn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SingleSignOn.java	18 Feb 2005 23:35:18 -0000	1.21
  +++ SingleSignOn.java	23 Feb 2005 19:27:56 -0000	1.22
  @@ -280,8 +280,8 @@
   
           // Look up the single session id associated with this session (if any)
           Session session = event.getSession();
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("Process session destroyed on " + session);
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("Process session destroyed on " + session);
   
           String ssoId = null;
           synchronized (reverse) {
  @@ -336,19 +336,19 @@
           request.removeNote(Constants.REQ_SSOID_NOTE);
   
           // Has a valid user already been authenticated?
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("Process request for '" + request.getRequestURI()
+ "'");
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("Process request for '" + request.getRequestURI() + "'");
           if (request.getUserPrincipal() != null) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug(" Principal '" + request.getUserPrincipal().getName()
+
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug(" Principal '" + request.getUserPrincipal().getName()
+
                       "' has already been authenticated");
               getNext().invoke(request, response);
               return;
           }
   
           // Check for the single sign on cookie
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug(" Checking for SSO cookie");
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug(" Checking for SSO cookie");
           Cookie cookie = null;
           Cookie cookies[] = request.getCookies();
           if (cookies == null)
  @@ -360,19 +360,19 @@
               }
           }
           if (cookie == null) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug(" SSO cookie is not present");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug(" SSO cookie is not present");
               getNext().invoke(request, response);
               return;
           }
   
           // Look up the cached Principal associated with this cookie value
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug(" Checking for cached principal for " + cookie.getValue());
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug(" Checking for cached principal for " + cookie.getValue());
           SingleSignOnEntry entry = lookup(cookie.getValue());
           if (entry != null) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug(" Found cached principal '" +
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug(" Found cached principal '" +
                       entry.getPrincipal().getName() + "' with auth type '" +
                       entry.getAuthType() + "'");
               request.setNote(Constants.REQ_SSOID_NOTE, cookie.getValue());
  @@ -382,8 +382,8 @@
                   request.setUserPrincipal(entry.getPrincipal());
               }
           } else {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug(" No cached principal found, erasing SSO cookie");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug(" No cached principal found, erasing SSO cookie");
               cookie.setMaxAge(0);
               response.addCookie(cookie);
           }
  @@ -425,8 +425,8 @@
        */
       protected void associate(String ssoId, Session session) {
   
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("Associate sso id " + ssoId + " with session "
+ session);
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("Associate sso id " + ssoId + " with session " + session);
   
           SingleSignOnEntry sso = lookup(ssoId);
           if (sso != null)
  @@ -475,8 +475,8 @@
        */
       protected void deregister(String ssoId) {
   
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("Deregistering sso id '" + ssoId + "'");
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("Deregistering sso id '" + ssoId + "'");
   
           // Look up and remove the corresponding SingleSignOnEntry
           SingleSignOnEntry sso = null;
  @@ -490,8 +490,8 @@
           // Expire any associated sessions
           Session sessions[] = sso.findSessions();
           for (int i = 0; i < sessions.length; i++) {
  -            if (container.getLogger().isTraceEnabled())
  -                container.getLogger().trace(" Invalidating session " + sessions[i]);
  +            if (containerLog.isTraceEnabled())
  +                containerLog.trace(" Invalidating session " + sessions[i]);
               // Remove from reverse cache first to avoid recursion
               synchronized (reverse) {
                   reverse.remove(sessions[i]);
  @@ -570,8 +570,8 @@
       protected void register(String ssoId, Principal principal, String authType,
                     String username, String password) {
   
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("Registering sso id '" + ssoId + "' for user '"
+
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("Registering sso id '" + ssoId + "' for user '" +
                   principal.getName() + "' with auth type '" + authType + "'");
   
           synchronized (cache) {
  @@ -612,8 +612,8 @@
   
           SingleSignOnEntry sso = lookup(ssoId);
           if (sso != null && !sso.getCanReauthenticate()) {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug("Update sso id " + ssoId + " to auth type "
+ authType);
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug("Update sso id " + ssoId + " to auth type " + authType);
   
               synchronized(sso) {
                   sso.updateCredentials(principal, authType, username, password);
  @@ -647,8 +647,8 @@
        */
       protected void removeSession(String ssoId, Session session) {
   
  -        if (container.getLogger().isDebugEnabled())
  -            container.getLogger().debug("Removing session " + session.toString() + " from
sso id " + 
  +        if (containerLog.isDebugEnabled())
  +            containerLog.debug("Removing session " + session.toString() + " from sso id
" + 
                   ssoId );
   
           // Get a reference to the SingleSignOn
  
  
  
  1.15      +21 -21    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java
  
  Index: DataSourceRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DataSourceRealm.java	18 Feb 2005 23:43:20 -0000	1.14
  +++ DataSourceRealm.java	23 Feb 2005 19:27:56 -0000	1.15
  @@ -290,7 +290,7 @@
               
           } catch (SQLException e) {
               // Log the problem for posterity
  -            container.getLogger().error(sm.getString("dataSourceRealm.exception"), e);
  +            containerLog.error(sm.getString("dataSourceRealm.exception"), e);
   
               // Return "not authenticated" for this request
               return (null);
  @@ -332,12 +332,14 @@
               validated = (digest(credentials).equals(dbCredentials));
   
           if (validated) {
  -            if (container.getLogger().isTraceEnabled())
  -                container.getLogger().trace(sm.getString("dataSourceRealm.authenticateSuccess",
  +            if (containerLog.isTraceEnabled())
  +                containerLog.trace(
  +                    sm.getString("dataSourceRealm.authenticateSuccess",
                                    username));
           } else {
  -            if (container.getLogger().isTraceEnabled())
  -                container.getLogger().trace(sm.getString("dataSourceRealm.authenticateFailure",
  +            if (containerLog.isTraceEnabled())
  +                containerLog.trace(
  +                    sm.getString("dataSourceRealm.authenticateFailure",
                                    username));
               return (null);
           }
  @@ -368,7 +370,7 @@
           	}
               dbConnection.close();
           } catch (SQLException e) {
  -            container.getLogger().error(sm.getString("dataSourceRealm.close"), e); // Just
log it here
  +            containerLog.error(sm.getString("dataSourceRealm.close"), e); // Just log it
here
           }
   
       }
  @@ -394,7 +396,7 @@
   	    return dataSource.getConnection();
           } catch (Exception e) {
               // Log the problem for posterity
  -            container.getLogger().error(sm.getString("dataSourceRealm.exception"), e);
  +            containerLog.error(sm.getString("dataSourceRealm.exception"), e);
           }  
           return null;
       }
  @@ -450,9 +452,9 @@
               return (dbCredentials != null) ? dbCredentials.trim() : null;
               
           } catch(SQLException e) {
  -        	container.getLogger().error(sm
  -	                .getString("dataSourceRealm.getPassword.exception",
  -	        		           username));
  +            containerLog.error(
  +                    sm.getString("dataSourceRealm.getPassword.exception",
  +                                 username));
           } finally {
           	try {
   	            if (rs != null) {
  @@ -462,9 +464,9 @@
   	                stmt.close();
   	            }
           	} catch (SQLException e) {
  -            	container.getLogger().error(sm
  -                        .getString("dataSourceRealm.getPassword.exception",
  -        		                   username));
  +                    containerLog.error(
  +                        sm.getString("dataSourceRealm.getPassword.exception",
  +        		             username));
           		
           	}
           }
  @@ -538,9 +540,8 @@
       		}
       		return list;
       	} catch(SQLException e) {
  -        	container.getLogger().error(sm
  -	                .getString("dataSourceRealm.getRoles.exception",
  -	        		           username));
  +            containerLog.error(
  +                sm.getString("dataSourceRealm.getRoles.exception", username));
           }
       	finally {
           	try {
  @@ -551,10 +552,9 @@
   	                stmt.close();
   	            }
           	} catch (SQLException e) {
  -            	container.getLogger().error(sm
  -                        .getString("dataSourceRealm.getRoles.exception",
  -        		                   username));
  -        		
  +                    containerLog.error(
  +                        sm.getString("dataSourceRealm.getRoles.exception",
  +                                     username));
           	}
           }
       	
  
  
  
  1.13      +21 -24    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/JDBCRealm.java
  
  Index: JDBCRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/JDBCRealm.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JDBCRealm.java	18 Feb 2005 23:43:20 -0000	1.12
  +++ JDBCRealm.java	23 Feb 2005 19:27:56 -0000	1.13
  @@ -354,7 +354,7 @@
               } catch (SQLException e) {
   
                   // Log the problem for posterity
  -                container.getLogger().error(sm.getString("jdbcRealm.exception"), e);
  +                containerLog.error(sm.getString("jdbcRealm.exception"), e);
   
                   // Close the connection so that it gets reopened next time
                   if (dbConnection != null)
  @@ -408,13 +408,13 @@
           }
   
           if (validated) {
  -            if (container.getLogger().isTraceEnabled())
  -                container.getLogger().trace(sm.getString("jdbcRealm.authenticateSuccess",
  -                                 username));
  +            if (containerLog.isTraceEnabled())
  +                containerLog.trace(sm.getString("jdbcRealm.authenticateSuccess",
  +                                                username));
           } else {
  -            if (container.getLogger().isTraceEnabled())
  -                container.getLogger().trace(sm.getString("jdbcRealm.authenticateFailure",
  -                                 username));
  +            if (containerLog.isTraceEnabled())
  +                containerLog.trace(sm.getString("jdbcRealm.authenticateFailure",
  +                                                username));
               return (null);
           }
   
  @@ -458,7 +458,7 @@
           try {
               dbConnection.close();
           } catch (SQLException e) {
  -            container.getLogger().warn(sm.getString("jdbcRealm.close"), e); // Just log
it here
  +            containerLog.warn(sm.getString("jdbcRealm.close"), e); // Just log it here
           } finally {
              this.dbConnection = null;
           }
  @@ -538,23 +538,22 @@
               return dbCredentials;
               
           } catch(SQLException e){
  -            container.getLogger().
  -                    error(sm.getString("jdbcRealm.getPassword.exception",
  -                                       username), e);
  +            containerLog.error(sm.getString("jdbcRealm.getPassword.exception",
  +                                            username),
  +                               e);
           } finally {
               if (rs!=null) {
                   try {
                       rs.close();
                   } catch(SQLException e) {
  -                    container.getLogger().warn(sm.getString("jdbcRealm.abnormalCloseResultSet"));
  +                    containerLog.warn(sm.getString("jdbcRealm.abnormalCloseResultSet"));
                   }
               }
               try {
                   dbConnection.commit();
               } catch (SQLException e) {
  -                container.getLogger().
  -                        warn(sm.getString("jdbcRealm.getPassword.exception",
  -                                          username));
  +                containerLog.warn(sm.getString("jdbcRealm.getPassword.exception",
  +                                               username));
               }
           }
           
  @@ -600,23 +599,21 @@
               return (roleList);
               
           } catch(SQLException e){
  -            container.getLogger().
  -                    error(sm.getString("jdbcRealm.getRoles.exception",
  -                                       username));
  +            containerLog.error(sm.getString("jdbcRealm.getRoles.exception",
  +                                            username));
           } finally {
               if (rs!=null) {
                   try {
                       rs.close();
                   } catch(SQLException e) {
  -                    container.getLogger().warn(sm.getString("jdbcRealm.abnormalCloseResultSet"));
  +                    containerLog.warn(sm.getString("jdbcRealm.abnormalCloseResultSet"));
                   }
               }
               try {
                   dbConnection.commit();
               } catch (SQLException e) {
  -                container.getLogger().
  -                        warn(sm.getString("jdbcRealm.getRoles.exception",
  -                                          username));
  +                containerLog.warn(sm.getString("jdbcRealm.getRoles.exception",
  +                                               username));
               }
           }
   
  @@ -719,7 +716,7 @@
           try {
               open();
           } catch (SQLException e) {
  -            container.getLogger().error(sm.getString("jdbcRealm.open"), e);
  +            containerLog.error(sm.getString("jdbcRealm.open"), e);
           }
   
           // Perform normal superclass initialization
  
  
  
  1.20      +36 -41    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java
  
  Index: JNDIRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JNDIRealm.java	18 Feb 2005 23:43:20 -0000	1.19
  +++ JNDIRealm.java	23 Feb 2005 19:27:56 -0000	1.20
  @@ -14,12 +14,8 @@
    * limitations under the License.
    */
   
  -
  -
  -
   package org.apache.catalina.realm;
   
  -
   import java.security.Principal;
   import java.text.MessageFormat;
   import java.util.ArrayList;
  @@ -45,7 +41,6 @@
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.util.Base64;
   
  -
   /**
    * <p>Implementation of <strong>Realm</strong> that works with a directory
    * server accessed via the Java Naming and Directory Interface (JNDI) APIs.
  @@ -819,7 +814,7 @@
                       throw(e);
   
                   // log the exception so we know it's there.
  -                container.getLogger().error(sm.getString("jndiRealm.exception"), e);
  +                containerLog.error(sm.getString("jndiRealm.exception"), e);
   
                   // close the connection so we know it will be reopened.
                   if (context != null)
  @@ -843,7 +838,7 @@
           } catch (NamingException e) {
   
               // Log the problem for posterity
  -            container.getLogger().error(sm.getString("jndiRealm.exception"), e);
  +            containerLog.error(sm.getString("jndiRealm.exception"), e);
   
               // Close the connection so that it gets reopened next time
               if (context != null)
  @@ -902,7 +897,7 @@
                           }
                       } catch (InvalidNameException ine) {
                           // Log the problem for posterity
  -                        container.getLogger().warn(sm.getString("jndiRealm.exception"),
ine);
  +                        containerLog.warn(sm.getString("jndiRealm.exception"), ine);
                           // ignore; this is probably due to a name not fitting
                           // the search path format exactly, as in a fully-
                           // qualified name being munged into a search path
  @@ -1074,7 +1069,7 @@
   
           // Check no further entries were found
           if (results.hasMore()) {
  -            container.getLogger().info("username " + username + " has multiple entries");
  +            containerLog.info("username " + username + " has multiple entries");
               return (null);
           }
   
  @@ -1090,8 +1085,8 @@
           name = name.addAll(entryName);
           String dn = name.toString();
   
  -        if (container.getLogger().isTraceEnabled())
  -            container.getLogger().trace("  entry found for " + username + " with dn " +
dn);
  +        if (containerLog.isTraceEnabled())
  +            containerLog.trace("  entry found for " + username + " with dn " + dn);
   
           // Get the entry's attributes
           Attributes attrs = result.getAttributes();
  @@ -1140,12 +1135,12 @@
                validated = compareCredentials(context, user, credentials);
            }
   
  -         if (container.getLogger().isTraceEnabled()) {
  +         if (containerLog.isTraceEnabled()) {
                if (validated) {
  -                 container.getLogger().trace(sm.getString("jndiRealm.authenticateSuccess",
  +                 containerLog.trace(sm.getString("jndiRealm.authenticateSuccess",
                                     user.username));
                } else {
  -                 container.getLogger().trace(sm.getString("jndiRealm.authenticateFailure",
  +                 containerLog.trace(sm.getString("jndiRealm.authenticateFailure",
                                     user.username));
                }
            }
  @@ -1177,8 +1172,8 @@
               return (false);
   
           // Validate the credentials specified by the user
  -        if (container.getLogger().isTraceEnabled())
  -            container.getLogger().trace("  validating credentials");
  +        if (containerLog.isTraceEnabled())
  +            containerLog.trace("  validating credentials");
   
           boolean validated = false;
           if (hasMessageDigest()) {
  @@ -1230,8 +1225,8 @@
                return (false);
   
            // Validate the credentials specified by the user
  -         if (container.getLogger().isTraceEnabled()) {
  -             container.getLogger().trace("  validating credentials by binding as the user");
  +         if (containerLog.isTraceEnabled()) {
  +             containerLog.trace("  validating credentials by binding as the user");
           }
   
           // Set up security environment to bind as the user
  @@ -1241,15 +1236,15 @@
           // Elicit an LDAP bind operation
           boolean validated = false;
           try {
  -            if (container.getLogger().isTraceEnabled()) {
  -                container.getLogger().trace("  binding as "  + dn);
  +            if (containerLog.isTraceEnabled()) {
  +                containerLog.trace("  binding as "  + dn);
               }
               attr = context.getAttributes("", null);
               validated = true;
           }
           catch (AuthenticationException e) {
  -            if (container.getLogger().isTraceEnabled()) {
  -                container.getLogger().trace("  bind attempt failed");
  +            if (containerLog.isTraceEnabled()) {
  +                containerLog.trace("  bind attempt failed");
               }
           }
   
  @@ -1296,8 +1291,8 @@
           if (dn == null || username == null)
               return (null);
   
  -        if (container.getLogger().isTraceEnabled())
  -            container.getLogger().trace("  getRoles(" + dn + ")");
  +        if (containerLog.isTraceEnabled())
  +            containerLog.trace("  getRoles(" + dn + ")");
   
           // Start with roles retrieved from the user entry
           ArrayList list = user.roles;
  @@ -1332,13 +1327,13 @@
           }
   
   
  -        if (container.getLogger().isTraceEnabled()) {
  +        if (containerLog.isTraceEnabled()) {
               if (list != null) {
  -                container.getLogger().trace("  Returning " + list.size() + " roles");
  +                containerLog.trace("  Returning " + list.size() + " roles");
                   for (int i=0; i<list.size(); i++)
  -                    container.getLogger().trace(  "  Found role " + list.get(i));
  +                    containerLog.trace(  "  Found role " + list.get(i));
               } else {
  -                container.getLogger().trace("  getRoles about to return null ");
  +                containerLog.trace("  getRoles about to return null ");
               }
           }
   
  @@ -1357,8 +1352,8 @@
       private String getAttributeValue(String attrId, Attributes attrs)
           throws NamingException {
   
  -        if (container.getLogger().isTraceEnabled())
  -            container.getLogger().trace("  retrieving attribute " + attrId);
  +        if (containerLog.isTraceEnabled())
  +            containerLog.trace("  retrieving attribute " + attrId);
   
           if (attrId == null || attrs == null)
               return null;
  @@ -1394,8 +1389,8 @@
                                            ArrayList values)
           throws NamingException{
   
  -        if (container.getLogger().isTraceEnabled())
  -            container.getLogger().trace("  retrieving values for attribute " + attrId);
  +        if (containerLog.isTraceEnabled())
  +            containerLog.trace("  retrieving values for attribute " + attrId);
           if (attrId == null || attrs == null)
               return values;
           if (values == null)
  @@ -1425,11 +1420,11 @@
   
           // Close our opened connection
           try {
  -            if (container.getLogger().isDebugEnabled())
  -                container.getLogger().debug("Closing directory context");
  +            if (containerLog.isDebugEnabled())
  +                containerLog.debug("Closing directory context");
               context.close();
           } catch (NamingException e) {
  -            container.getLogger().error(sm.getString("jndiRealm.close"), e);
  +            containerLog.error(sm.getString("jndiRealm.close"), e);
           }
           this.context = null;
   
  @@ -1489,7 +1484,7 @@
               connectionAttempt = 1;
   
               // log the first exception.
  -            container.getLogger().warn(sm.getString("jndiRealm.exception"), e);
  +            containerLog.warn(sm.getString("jndiRealm.exception"), e);
   
               // Try connecting to the alternate url.
               context = new InitialDirContext(getDirectoryContextEnvironment());
  @@ -1516,10 +1511,10 @@
           Hashtable env = new Hashtable();
   
           // Configure our directory context environment.
  -        if (container.getLogger().isDebugEnabled() && connectionAttempt == 0)
  -            container.getLogger().debug("Connecting to URL " + connectionURL);
  -        else if (container.getLogger().isDebugEnabled() && connectionAttempt >
0)
  -            container.getLogger().debug("Connecting to URL " + alternateURL);
  +        if (containerLog.isDebugEnabled() && connectionAttempt == 0)
  +            containerLog.debug("Connecting to URL " + connectionURL);
  +        else if (containerLog.isDebugEnabled() && connectionAttempt > 0)
  +            containerLog.debug("Connecting to URL " + alternateURL);
           env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
           if (connectionName != null)
               env.put(Context.SECURITY_PRINCIPAL, connectionName);
  
  
  
  1.48      +14 -9     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java
  
  Index: RealmBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- RealmBase.java	18 Feb 2005 23:43:20 -0000	1.47
  +++ RealmBase.java	23 Feb 2005 19:27:56 -0000	1.48
  @@ -78,6 +78,12 @@
   
   
       /**
  +     * Container log
  +     */
  +    protected Log containerLog = null;
  +
  +
  +    /**
        * Digest algorithm used in storing passwords in a non-plaintext format.
        * Valid values are those accepted for the algorithm name by the
        * MessageDigest class, or <code>null</code> if no digesting should
  @@ -169,6 +175,7 @@
   
           Container oldContainer = this.container;
           this.container = container;
  +        this.containerLog = container.getLogger();
           support.firePropertyChange("container", oldContainer, this.container);
   
       }
  @@ -283,17 +290,15 @@
               validated = serverCredentials.equals(credentials);
           }
           if(! validated ) {
  -            if (container.getLogger().isTraceEnabled()) {
  -                container.getLogger().
  -                    trace(sm.getString("realmBase.authenticateFailure",
  -                                 username));
  +            if (containerLog.isTraceEnabled()) {
  +                containerLog.trace(sm.getString("realmBase.authenticateFailure",
  +                                                username));
               }
               return null;
           }
  -        if (container.getLogger().isTraceEnabled()) {
  -            container.getLogger().
  -                trace(sm.getString("realmBase.authenticateSuccess",
  -                             username));
  +        if (containerLog.isTraceEnabled()) {
  +            containerLog.trace(sm.getString("realmBase.authenticateSuccess",
  +                                            username));
           }
   
           return getPrincipal(username);
  
  
  
  1.12      +4 -2      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/UserDatabaseRealm.java
  
  Index: UserDatabaseRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/UserDatabaseRealm.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- UserDatabaseRealm.java	18 Feb 2005 23:43:20 -0000	1.11
  +++ UserDatabaseRealm.java	23 Feb 2005 19:27:56 -0000	1.12
  @@ -221,7 +221,9 @@
               Context context = server.getGlobalNamingContext();
               database = (UserDatabase) context.lookup(resourceName);
           } catch (Throwable e) {
  -            container.getLogger().error(sm.getString("userDatabaseRealm.lookup", resourceName),
e);
  +            containerLog.error(sm.getString("userDatabaseRealm.lookup",
  +                                            resourceName),
  +                               e);
               database = null;
           }
           if (database == null) {
  
  
  
  1.17      +8 -2      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ValveBase.java
  
  Index: ValveBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ValveBase.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ValveBase.java	5 Oct 2004 17:12:49 -0000	1.16
  +++ ValveBase.java	23 Feb 2005 19:27:56 -0000	1.17
  @@ -67,6 +67,12 @@
   
   
       /**
  +     * Container log
  +     */
  +    protected Log containerLog = null;
  +
  +
  +    /**
        * Descriptive information about this Valve implementation.  This value
        * should be overridden by subclasses.
        */
  @@ -108,7 +114,7 @@
       public void setContainer(Container container) {
   
           this.container = container;
  -
  +        this.containerLog = container.getLogger();
       }
   
   
  
  
  

---------------------------------------------------------------------
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