Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
2182 | tweak | always | 11-17-07 02:36 | 11-20-07 09:51 | |
|
|||||
Reporter: | koreth | Platform: | |||
Assigned To: | nam | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.1.4 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.1.4 | ||
|
|||||
Summary: | 0002182: Minor logic bug in Env.getConnection() | ||||
Description: |
I think I'm right about this, but if not, apologies for the noise. Env.getConnection() does 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 _connMap.put(entry, entry); 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. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
There are no notes attached to this issue. |