Found HUGE Bug in MySQLPooledConnection

Found HUGE Bug in MySQLPooledConnection

am 27.02.2003 21:34:55 von DM

I have found a HUGE bug in your code to MysqlPooledConnection, but it is
easily fixed.

How-To-Repeat:

Take a look at the code for the close() method:

public synchronized void close() throws SQLException {
physicalConn.close();
physicalConn = null;
callListener(2, null);
}

You'll notice it sends the number 2 to the method callListener(). However, 2
means an error occurred, 1 means close! Take a look at callListener():

protected synchronized void callListener(int i, SQLException sqlException) {
if(eventListeners == null) {
return;
}
Enumeration enumeration = eventListeners.keys();
ConnectionEvent connectionevent = new ConnectionEvent(this,
sqlException);
while(enumeration.hasMoreElements()) {
ConnectionEventListener connectioneventlistener =
(ConnectionEventListener)enumeration.nextElement();
ConnectionEventListener connectioneventlistener1 =
(ConnectionEventListener)eventListeners.get(connectioneventl istener);
if(i == 1) {
connectioneventlistener1.connectionClosed(connectionevent);
} else if(i == 2) {

connectioneventlistener1.connectionErrorOccurred(connectione vent);
}
}
}

Every time someone tries to close the physical connection, it instead throws
an exception. This was in fact in your release code and when I fixed it and
added the new class to the jar file the exceptions on close() disappeared.
What do I need to do to add this fix to your release code?

I hope this helps.

David Musicant



------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13855@lists.mysql.com
To unsubscribe, e-mail