commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 18905] - Couldn't get connection (Jdbc2PoolDataSource)
Date Fri, 06 Jun 2003 09:49:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18905

Couldn't get connection (Jdbc2PoolDataSource)





------- Additional Comments From tagunov@motor.ru  2003-06-06 09:49 -------
Just a quick glance examination:

Jdbc2PoolDataSource.java

    private UserPassKey 
getUserPassKey(String username, String password)
    {
        UserPassKey key = 
(UserPassKey)userKeys.get(username);
        if (key == null) 
        {
            key = new 
UserPassKey(username, password);
            userKeys.put(username, key);
        }
        return key;
    }
        

It's here that you loose password.
The first time

    getUserPassKey( 'user', 'bad-pass' 
)
    
is invoked for 'user' new UserPassKey( 'user', 'bad-pass' ) is created.

The next 
time

    getUserPassKey( 'user', 'good-pass' )
    
is invoked userKeys.get( 'user' ) returns 
the same object,
UserPassKey( 'user', 'bad-pass' );

That's how a stale password popps 
up.
So either 
1) a new UserPassKey should be created here, or
2) setPassword() method 
should be added to UserPassKey.
   However I do not, probably some thread synchronization
   
issues require UserPassKey being the key in a 
   GenericKeyedObjectPool to be immutable, then 
only 1)
   suits
   
WBR, Anton

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message