glenn 2003/02/04 05:22:03 Modified: catalina/src/share/org/apache/catalina/realm DataSourceRealm.java Log: Fix Bug 16316, Realm start fails when DataSource not available yet. Revision Changes Path 1.2 +8 -29 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java Index: DataSourceRealm.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DataSourceRealm.java 7 Dec 2002 17:42:11 -0000 1.1 +++ DataSourceRealm.java 4 Feb 2003 13:22:03 -0000 1.2 @@ -313,6 +313,10 @@ // Ensure that we have an open database connection dbConnection = open(); + if (dbConnection == null) { + // If the db connection open fails, return "not authenticated" + return null; + } // Acquire a Principal object for this user Principal principal = authenticate(dbConnection, @@ -573,31 +577,6 @@ preparedCredentials.append(" WHERE "); preparedCredentials.append(userNameCol); preparedCredentials.append(" = ?"); - - // Validate that we can open our connection - Connection conn = null; - PreparedStatement roles = null; - PreparedStatement credentials = null; - try { - conn = open(); - if (conn != null) { - roles = roles(conn,""); - credentials = credentials(conn,""); - if( !conn.getAutoCommit() ) { - conn.commit(); - } - } - } catch (SQLException e) { - throw new LifecycleException(sm.getString("dataSourceRealm.open"), e); - } finally { - try { - if (conn != null) { - conn.close(); - } - } catch (SQLException e) { - throw new LifecycleException(sm.getString("dataSourceRealm.open"), e); - } - } // Perform normal superclass initialization super.start();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]