Author: remm Date: Fri Apr 14 14:30:28 2006 New Revision: 394202 URL: http://svn.apache.org/viewcvs?rev=394202&view=rev Log: - Port patches. - Change to session: it doesn't make sense to me that getAttribute is a good place to synchronously make a check for session expiration (of course, with accessCount, this is not going to happen anyway, but still).
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Generator.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java?rev=394202&r1=394201&r2=394202&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java Fri Apr 14 14:30:28 2006 @@ -1,5 +1,5 @@ /* - * Copyright 1999,2004 The Apache Software Foundation. + * Copyright 1999,2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ * @author Craig R. McClanahan * @author Carson McDonald * @author Ignacio Ortega -* @version $Revision: 373023 $ +* @version $Revision: 394121 $ */ public class DataSourceRealm @@ -57,13 +57,13 @@ /** * The generated string for the roles PreparedStatement */ - private StringBuffer preparedRoles = null; + private String preparedRoles = null; /** * The generated string for the credentials PreparedStatement */ - private StringBuffer preparedCredentials = null; + private String preparedCredentials = null; /** @@ -581,7 +581,7 @@ throws SQLException { PreparedStatement credentials = - dbConnection.prepareStatement(preparedCredentials.toString()); + dbConnection.prepareStatement(preparedCredentials); credentials.setString(1, username); return (credentials); @@ -601,7 +601,7 @@ throws SQLException { PreparedStatement roles = - dbConnection.prepareStatement(preparedRoles.toString()); + dbConnection.prepareStatement(preparedRoles); roles.setString(1, username); return (roles); @@ -624,23 +624,24 @@ super.start(); // Create the roles PreparedStatement string - preparedRoles = new StringBuffer("SELECT "); - preparedRoles.append(roleNameCol); - preparedRoles.append(" FROM "); - preparedRoles.append(userRoleTable); - preparedRoles.append(" WHERE "); - preparedRoles.append(userNameCol); - preparedRoles.append(" = ?"); + StringBuffer temp = new StringBuffer("SELECT "); + temp.append(roleNameCol); + temp.append(" FROM "); + temp.append(userRoleTable); + temp.append(" WHERE "); + temp.append(userNameCol); + temp.append(" = ?"); + preparedRoles = temp.toString(); // Create the credentials PreparedStatement string - preparedCredentials = new StringBuffer("SELECT "); - preparedCredentials.append(userCredCol); - preparedCredentials.append(" FROM "); - preparedCredentials.append(userTable); - preparedCredentials.append(" WHERE "); - preparedCredentials.append(userNameCol); - preparedCredentials.append(" = ?"); - + temp = new StringBuffer("SELECT "); + temp.append(userCredCol); + temp.append(" FROM "); + temp.append(userTable); + temp.append(" WHERE "); + temp.append(userNameCol); + temp.append(" = ?"); + preparedCredentials = temp.toString(); } Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java?rev=394202&r1=394201&r2=394202&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java Fri Apr 14 14:30:28 2006 @@ -156,7 +156,7 @@ /** * Set of attribute names which are not allowed to be persisted. */ - private static final String[] excludedAttributes = { + protected static final String[] excludedAttributes = { Globals.SUBJECT_ATTR }; @@ -422,9 +422,9 @@ */ public long getLastAccessedTime() { - if ( !isValid() ) { + if (!isValidInternal()) { throw new IllegalStateException - (sm.getString("standardSession.getId.ise")); + (sm.getString("standardSession.getId.ise")); } return (this.lastAccessedTime); @@ -564,7 +564,7 @@ return true; } - if (!this.isValid ) { + if (!this.isValid) { return false; } @@ -948,7 +948,7 @@ */ public long getCreationTime() { - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.getCreationTime.ise")); @@ -1003,7 +1003,7 @@ */ public Object getAttribute(String name) { - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.getAttribute.ise")); @@ -1021,7 +1021,7 @@ */ public Enumeration getAttributeNames() { - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.getAttributeNames.ise")); @@ -1061,7 +1061,7 @@ */ public String[] getValueNames() { - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.getValueNames.ise")); @@ -1078,7 +1078,7 @@ */ public void invalidate() { - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.invalidate.ise")); @@ -1100,7 +1100,7 @@ */ public boolean isNew() { - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.isNew.ise")); @@ -1175,7 +1175,7 @@ public void removeAttribute(String name, boolean notify) { // Validate our current state - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.removeAttribute.ise")); @@ -1239,7 +1239,7 @@ } // Validate our current state - if (!isValid()) + if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.setAttribute.ise")); if ((manager != null) && manager.getDistributable() && @@ -1342,6 +1342,15 @@ /** + * Return the <code>isValid</code> flag for this session without any expiration + * check. + */ + protected boolean isValidInternal() { + return (this.isValid || this.expiring); + } + + + /** * Read a serialized version of this session object from the specified * object input stream. * <p> @@ -1353,7 +1362,7 @@ * @exception ClassNotFoundException if an unknown class is specified * @exception IOException if an input/output error occurs */ - private void readObject(ObjectInputStream stream) + protected void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException { // Deserialize the scalar instance variables (except Manager) @@ -1418,7 +1427,7 @@ * * @exception IOException if an input/output error occurs */ - private void writeObject(ObjectOutputStream stream) throws IOException { + protected void writeObject(ObjectOutputStream stream) throws IOException { // Write the scalar instance variables (except Manager) stream.writeObject(new Long(creationTime)); Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java?rev=394202&r1=394201&r2=394202&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java Fri Apr 14 14:30:28 2006 @@ -44,7 +44,7 @@ * To use, copy into the server/classes directory of the Tomcat installation * and configure in server.xml as: * <pre> - * <Valve className="AccessLogDBValve" + * <Valve className="org.apache.catalina.valves.JDBCAccessLogValve" * driverName="<i>your_jdbc_driver</i>" * connectionURL="<i>your_jdbc_url</i>" * pattern="combined" resolveHosts="false" @@ -76,7 +76,7 @@ * id INT UNSIGNED AUTO_INCREMENT NOT NULL, * ts TIMESTAMP NOT NULL, * remoteHost CHAR(15) NOT NULL, - * user CHAR(15), + * userName CHAR(15), * timestamp TIMESTAMP NOT NULL, * virtualHost VARCHAR(64) NOT NULL, * method VARCHAR(8) NOT NULL, @@ -124,7 +124,7 @@ * connectionURL = null; * tableName = "access"; * remoteHostField = "remoteHost"; - * userField = "user"; + * userField = "userName"; * timestampField = "timestamp"; * virtualHostField = "virtualHost"; * methodField = "method"; @@ -143,7 +143,7 @@ connectionURL = null; tableName = "access"; remoteHostField = "remoteHost"; - userField = "user"; + userField = "userName"; timestampField = "timestamp"; virtualHostField = "virtualHost"; methodField = "method"; @@ -208,7 +208,7 @@ * The descriptive information about this implementation. */ protected static String info = - "org.apache.catalina.valves.JDBCAccessLogValve/1.0"; + "org.apache.catalina.valves.JDBCAccessLogValve/1.1"; /** Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Generator.java URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Generator.java?rev=394202&r1=394201&r2=394202&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Generator.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Generator.java Fri Apr 14 14:30:28 2006 @@ -2255,7 +2255,7 @@ out.printin("if ("); out.print(tagEvalVar); out - .println(" != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)"); + .println(" != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {"); out.pushIndent(); out.printil("out = _jspx_page_context.popBody();"); if (n.implementsTryCatchFinally()) { @@ -2266,6 +2266,7 @@ out.println("[0]--;"); } out.popIndent(); + out.printil("}"); } out.popIndent(); // EVAL_BODY --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]