Bug 12286 - NullPointerException in JDBCStore (fix included)
Summary: NullPointerException in JDBCStore (fix included)
Status: CLOSED FIXED
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Catalina:Modules (show other bugs)
Version: 4.1.10
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2002-09-04 08:29 UTC by Ronald Klop
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald Klop 2002-09-04 08:29:00 UTC
I get a NullPointerException in the cleanup code of org.apache.catalina.session.JDBCStore 
using Tomcat 4.0.4.
This happens while reloading the context.
After the exception tomcat 
hangs until you reload the context again.

I think it can be solved with the following 
'patch'.

--- org/apache/catalina/session/JDBCStore-old.java  Wed Sep  4 02:13:53 2002
+++ 
org/apache/catalina/session/JDBCStore.java      Wed Sep  4 02:18:12 2002
@@ -759,37 +759,43 @@
             
}

             try {
-                preparedSizeSql.close();
+                if (preparedSizeSql != null)
+                    
preparedSizeSql.close();
             } catch (SQLException e) {
                 ;
             }

             try {
-                
preparedKeysSql.close();
+                if (preparedKeysSql != null)
+                    preparedKeysSql.close();
             } 
catch (SQLException e) {
                 ;
             }

             try {
-                preparedSaveSql.close();
+                if (preparedSaveSql 
!= null)
+                    preparedSaveSql.close();
             } catch (SQLException e) {
                 ;
             }

             try {
-                
preparedClearSql.close();
+                if (preparedClearSql != null)
+                    
preparedClearSql.close();
             } catch (SQLException e) {
                 ;
             }

             try {
-                
preparedRemoveSql.close();
+                if (preparedRemoveSql != null)
+                    
preparedRemoveSql.close();
             } catch (SQLException e) {
                 ;
             }

             try {
-                
preparedLoadSql.close();
+                if (preparedLoadSql != null)
+                    preparedLoadSql.close();
             } 
catch (SQLException e) {
                 ;
             }
Comment 1 Ronald Klop 2002-09-20 11:22:59 UTC
I've seen this bug in 4.0.4 and also in 4.1.10.
It's a trivial fix. Can it be included in 4.1.11?
Comment 2 Glenn Nielsen 2002-09-20 14:07:47 UTC
I have committed a patch for this to CVS. Tomcat 4.1.11 has already been
released but this bug fix will be available in the next nightly build.
Or you can wait for the Tomcat 4.1.12 release.