Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002094 [Quercus] minor always 10-19-07 14:02 10-19-07 16:20
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.4 Product Version 3.1.3
  Product Build
Summary 0002094: Null pointer exception in Env.getConnection()
Description Since I can't reopen a bug:

The patch I provided in bug 2093 was actually for the section of code below the one that was updated in svn revision 3265. That revision doesn't solve the NPE I was seeing.

Updated patch that is more consistent with the code style of rev 3265:

--- a/modules/quercus/src/com/caucho/quercus/env/Env.java
+++ b/modules/quercus/src/com/caucho/quercus/env/Env.java
@@ -695,9 +695,9 @@ public class Env {
 
     Connection conn;
     
- if (oldEntry != null && ! oldEntry.getConnection().isClosed())
- conn = oldEntry.getConnection();
- else {
+ if (oldEntry == null
+ || (conn = oldEntry.getConnection()) == null
+ || conn.isClosed()) {
       if (userName == null || userName.equals(""))
        conn = database.getConnection();
       else


Also, it seems to me that the "_connMap.put()" call should be inside the "else" (in the pre-patched version of the code) rather than unconditional like it is now; the current code is adding a map entry for a ConnectionEntry that has no connection assigned to it whenever the oldEntry connection is used. But it's possible that's as intended.
Steps To Reproduce
Additional Information
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
10-19-07 14:02 koreth New Issue
10-19-07 16:20 ferg Assigned To  => ferg
10-19-07 16:20 ferg Status new => closed
10-19-07 16:20 ferg Resolution open => fixed
10-19-07 16:20 ferg Fixed in Version  => 3.1.4


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
27 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker