Anyone have a clue what went wrong with this commit? I committed the two files: TesterDriver.java and TestJdbc2PoolDataSource.java, with the following commit log:
Bugzilla number: 18905 - Jdbc2PoolDataSource fails on correct username and password if first getConnection call uses an incorrect password. This commit alters other test methods to allow reproduction of the bug. The bug is not fixed yet so the testIncorrectPassword method javadoc gives instructions on reproducing the bug. Modified Files: * src/test/org/apache/commons/dbcp/TesterDriver.java - added a set of valid users and passwords that are compared against if a request for a Connection includes user info. * src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java - switched to use valid u/p as declared by TesterDriver. Added documentation to testIncorrectPassword on reproducing 18905 I received the following messages during the commit and the log as reported in the email is messed up. However the commit appears to have succeeded and the log message is correctly stored within cvs. Checking in src/test/org/apache/commons/dbcp/TesterDriver.java; /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterDriver.java,v <-- TesterDriver.java new revision: 1.3; previous revision: 1.2 done cvs [status aborted]: no such directory `src/test/org/apache/commons/dbcp' cvs [status aborted]: no such directory `src/test/org/apache/commons/dbcp/jdbc2pool' cvs [status aborted]: no such directory `u' More commits to come... Checking in src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java; /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java,v <-- TestJdbc2PoolDataSource.java new revision: 1.8; previous revision: 1.7 done cvs [status aborted]: no such directory `src/test/org/apache/commons/dbcp' cvs [status aborted]: no such directory `src/test/org/apache/commons/dbcp/jdbc2pool' cvs [status aborted]: no such directory `u' Mailing the commit message... john mcnally On Sun, 2003-06-01 at 21:54, [EMAIL PROTECTED] wrote: > jmcnally 2003/06/01 21:54:13 > > Modified: dbcp/src/test/org/apache/commons/dbcp TesterDriver.java * > src/test/org/apache/commons/dbcp/TesterDriver.java > - added a set of valid users and passwords that are > compared against if a request for a Connection > includes user info. * > > src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java > - switched to use valid u/p as declared by > TesterDriver. Added documentation to > testIncorrectPassword on reproducing 18905 > dbcp/src/test/org/apache/commons/dbcp/jdbc2pool > TestJdbc2PoolDataSource.java * > src/test/org/apache/commons/dbcp/TesterDriver.java > - added a set of valid users and passwords that are > compared against if a request for a Connection > includes user info. * > > src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java > - switched to use valid u/p as declared by > TesterDriver. Added documentation to > testIncorrectPassword on reproducing 18905 > Log: > Bugzilla number: 18905 - Jdbc2PoolDataSource fails on correct username and password > if first getConnection call uses an incorrect password. This commit alters other > test methods to allow reproduction of the bug. The bug is not fixed yet so the > testIncorrectPassword method javadoc gives instructions on reproducing the bug. > > Revision Changes Path > 1.3 +52 -5 > jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterDriver.java > > Index: TesterDriver.java > =================================================================== > RCS file: > /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterDriver.java,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- TesterDriver.java 15 Apr 2003 23:34:34 -0000 1.2 > +++ TesterDriver.java 2 Jun 2003 04:54:11 -0000 1.3 > @@ -68,20 +68,67 @@ > import java.sql.SQLException; > import java.util.Properties; > > +/** > + * Mock object implementing the <code>java.sql.Driver</code> interface. > + * Returns <code>TestConnection</code>'s from getConnection methods. > + * Valid username, password combinations are: > + * > + * <table> > + * <tr><th>user</th><th>password</th></tr> > + * <tr><td>foo</td><td>bar</td></tr> > + * <tr><td>u1</td><td>p1</td></tr> > + * <tr><td>u2</td><td>p2</td></tr> > + * <tr><td>username</td><td>password</td></tr> > + * </table> > + */ > public class TesterDriver implements Driver { > + private static Properties validUserPasswords = new Properties(); > static { > try { > DriverManager.registerDriver(new TesterDriver()); > } catch(Exception e) { > } > + validUserPasswords.put("foo", "bar"); > + validUserPasswords.put("u1", "p1"); > + validUserPasswords.put("u2", "p2"); > + validUserPasswords.put("username", "password"); > } > > public boolean acceptsURL(String url) throws SQLException { > - return CONNECT_STRING.equals(url); > + return CONNECT_STRING.startsWith(url); > + } > + > + private void assertValidUserPassword(String user, String password) > + throws SQLException { > + String realPassword = validUserPasswords.getProperty(user); > + if (realPassword == null) > + { > + throw new SQLException(user + " is not a valid username."); > + } > + if (!realPassword.equals(password)) > + { > + throw new SQLException(password + > + " is not the correct password for " + > + user + ". The correct password is " + > + realPassword); > + } > } > > public Connection connect(String url, Properties info) throws SQLException { > - return (acceptsURL(url) ? new TesterConnection() : null); > + //return (acceptsURL(url) ? new TesterConnection() : null); > + Connection conn = null; > + if (acceptsURL(url)) > + { > + if (info != null) > + { > + assertValidUserPassword(info.getProperty("user"), > + info.getProperty("password")); > + } > + > + conn = new TesterConnection(); > + } > + > + return conn; > } > > public int getMajorVersion() { > > > > No revision > > > > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > 1.8 +45 -37 > jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java > > Index: TestJdbc2PoolDataSource.java > =================================================================== > RCS file: > /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java,v > retrieving revision 1.7 > retrieving revision 1.8 > diff -u -r1.7 -r1.8 > --- TestJdbc2PoolDataSource.java 15 Apr 2003 01:56:28 -0000 1.7 > +++ TestJdbc2PoolDataSource.java 2 Jun 2003 04:54:12 -0000 1.8 > @@ -110,6 +110,43 @@ > ds = tds; > } > > + /** > + * Switching 'u1 -> 'u2' and 'p1' -> 'p2' will > + * exhibit the bug detailed in > + * http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18905 > + */ > + public void testIncorrectPassword() throws Exception > + { > + try { > + // Use bad password > + ds.getConnection("u1", "zlsafjk").close(); > + fail("Able to retrieve connection with incorrect password"); > + } catch (SQLException e1) { > + // should fail > + > + } > + > + // Use good password > + ds.getConnection("u1", "p1").close(); > + try > + { > + ds.getConnection("u1", "x").close(); > + fail("Able to retrieve connection with incorrect password"); > + } > + catch (SQLException e) > + { > + if (!e.getMessage().startsWith("Given password did not match")) > + { > + throw e; > + } > + // else the exception was expected > + } > + > + // Make sure we can still use our good password. > + ds.getConnection("u1", "p1").close(); > + } > + > + > public void testSimple() throws Exception > { > Connection conn = ds.getConnection(); > @@ -126,7 +163,7 @@ > > public void testSimpleWithUsername() throws Exception > { > - Connection conn = ds.getConnection("u", "p"); > + Connection conn = ds.getConnection("u1", "p1"); > assertTrue(null != conn); > PreparedStatement stmt = conn.prepareStatement("select * from dual"); > assertTrue(null != stmt); > @@ -145,14 +182,14 @@ > // open the maximum connections > for (int i=0; i<c.length; i++) > { > - c[i] = ds.getConnection("u", "p"); > + c[i] = ds.getConnection("u1", "p1"); > } > > // close one of the connections > c[0].close(); > assertTrue(c[0].isClosed()); > // get a new connection > - c[0] = ds.getConnection("u", "p"); > + c[0] = ds.getConnection("u1", "p1"); > > for (int i=0; i<c.length; i++) > { > @@ -162,41 +199,12 @@ > // open the maximum connections > for (int i=0; i<c.length; i++) > { > - c[i] = ds.getConnection("u", "p"); > + c[i] = ds.getConnection("u1", "p1"); > } > for (int i=0; i<c.length; i++) > { > c[i].close(); > } > - } > - > - public void testIncorrectPassword() throws Exception > - { > - try { > - // Use bad password > - ds.getConnection("u", "zlsafjk").close(); > - } catch (SQLException e1) { > - // should fail > - } > - > - // Use good password > - ds.getConnection("u", "p").close(); > - try > - { > - ds.getConnection("u", "x").close(); > - fail("Able to retrieve connection with incorrect password"); > - } > - catch (SQLException e) > - { > - if (!e.getMessage().startsWith("Given password did not match")) > - { > - throw e; > - } > - // else the exception was expected > - } > - > - // Make sure we can still use our good password. > - ds.getConnection("u", "p").close(); > } > > public void testSimple2() > > > > No revision > > > > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > No revision > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]