r10002 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Mon, 30 Nov 2009 15:47:56 +0100 (CET)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20091130144756.EA9093D0E2@mia>
Author: hannes
Date: 2009-11-30 15:47:56 +0100 (Mon, 30 Nov 2009)
New Revision: 10002

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/DbConnection.java
Log:
Add check for closed connections in DbConnection.isValid()

Details at http://dev.helma.org/trac/helma/changeset/10002

Modified: helma/helma/trunk/src/helma/objectmodel/db/DbConnection.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/DbConnection.java	2009-11-30 14:42:24 UTC (rev 10001)
+++ helma/helma/trunk/src/helma/objectmodel/db/DbConnection.java	2009-11-30 14:47:56 UTC (rev 10002)
@@ -40,11 +40,11 @@
     }
 
     public boolean isValid(int id) {
-        if (id != serialId) {
-            return false;
-        }
         // test if connection is still ok
         try {
+            if (id != serialId || connection.isClosed()) {
+                return false;
+            }
             Statement stmt = connection.createStatement();
             stmt.execute("SELECT 1");
             stmt.close();