Mantis - Quercus
Viewing Issue Advanced Details
2093 minor always 10-19-07 10:26 10-19-07 11:32
koreth  
ferg  
normal  
closed 3.1.3  
fixed  
none    
none 3.1.4  
0002093: Null pointer exception in Env.getConnection()
When the remote side closed a MySQL connection, the latest code was trying to recover (this is with "ping" specified in the <database-default> section of the web app's resin-web.xml). But it ended up getting a NullPointerException the next time the PHP code called mysql_connect(). The connect call then fails.

This is probably a sign of a deeper bug but the following patch fixes the immediate problem and seems like a good sanity check in any case:

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

There are no notes attached to this issue.