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) { ; }
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?
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.