|Anonymous | Login | Signup for a new account||06-03-2023 06:39 PDT|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0002182||[Quercus]||tweak||always||11-17-07 02:36||11-20-07 09:51|
|Summary||0002182: Minor logic bug in Env.getConnection()|
I think I'm right about this, but if not, apologies for the noise.
ConnectionEntry entry = new ConnectionEntry();
entry.init(database, userName, password);
ConnectionEntry oldEntry = _connMap.get(entry);
So at this point oldEntry is the existing entry in the connection map and entry is a brand-new one. Then the code tests to see if oldEntry is valid -- is it null, is its connection closed, etc. If oldEntry doesn't have a valid connection, it establishes a new connection and updates "entry" to have a reference to the new connection.
Then, whether or not oldEntry was invalid (and thus whether or not a new connection was installed into "entry") the code does
This looks like it can replace a perfectly valid oldEntry (one that has a working connection) with a new "entry" that has no connection at all (which will be the case if oldEntry doesn't test as broken).
My fix is to move that "put" up by one line, inside the "if oldEntry is bad" block. That means the existing oldEntry is left in the connection map if it's in good shape.
I'm not sure how this would actually manifest itself as a problem at runtime but it looked wrong to me when I was examining this code.
|There are no notes attached to this issue.|
|11-17-07 02:36||koreth||New Issue|
|11-20-07 09:50||nam||Status||new => assigned|
|11-20-07 09:50||nam||Assigned To||=> nam|
|11-20-07 09:51||nam||Status||assigned => closed|
|11-20-07 09:51||nam||Resolution||open => fixed|
|11-20-07 09:51||nam||Fixed in Version||=> 3.1.4|
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
27 total queries executed.|
25 unique queries executed.