From c0ede89351958fba8c5112fd4c8fbf0fc17e8e12 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Sun, 12 Oct 2014 18:16:38 +0200 Subject: Check whether database connection is still open. Note, however, that a real check needs to use .isValid() which is only available starting from JDBC4. So, we need to move up to this. --- org/madore/damlengine/WeblogDatabaseConnection.java | 2 +- org/madore/damlengine/WeblogServlet.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org/madore/damlengine/WeblogDatabaseConnection.java b/org/madore/damlengine/WeblogDatabaseConnection.java index 16d0973..dfacebb 100644 --- a/org/madore/damlengine/WeblogDatabaseConnection.java +++ b/org/madore/damlengine/WeblogDatabaseConnection.java @@ -21,7 +21,7 @@ public final class WeblogDatabaseConnection { public static Connection getConnection() throws SQLException { Connection conn = pconn.get(); - if ( conn == null ) { + if ( conn == null || conn.isClosed() ) { String dbHost = null; if ( ! DamlEngine.runAsServlet ) dbHost = System.getenv("DAMLENGINE_PGHOST"); diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java index c5ace1f..0e0ebe4 100644 --- a/org/madore/damlengine/WeblogServlet.java +++ b/org/madore/damlengine/WeblogServlet.java @@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse; public class WeblogServlet extends HttpServlet { - private static final long serialVersionUID = 2014101201L; + private static final long serialVersionUID = 2014101202L; @Override public void init(ServletConfig cfg) -- cgit v1.2.3