From 06c57e0be885a163829039a17120fb28b581ee2c Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Sat, 16 May 2009 04:40:13 +0000 Subject: [PATCH] JETTY-1013 git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@220 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 1 + .../jetty/security/JDBCLoginService.java | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 8023bf0ba99..4e2dc380cc3 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -7,6 +7,7 @@ jetty-7.0.0.M2-SNAPSHOT + 273767 Update to use geronimo annotations spec 1.1.1 + JETTY-1003 java.lang.IllegalArgumentException: timeout can't be negative + JETTY-1004 CERT VU#402580 Canonical path handling includes ? in path segment + + JETTY-1013 MySql Error with JDBCUserRealm + JETTY-1014 Enable start-stop-daemon by default on jetty.sh (START_STOP_DAEMON=1) + JETTY-1015 Reduce BayeuxClient and HttpClient lock contention + JETTY-1020 ZipException in org.mortbay.jetty.webapp.TagLibConfiguration prevents all contexts from being loaded diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java index a994c45b5cb..ee2810fe736 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java @@ -153,7 +153,6 @@ public class JDBCLoginService extends MappedLoginService + _userRoleTableRoleKey; Loader.loadClass(this.getClass(), _jdbcDriver).newInstance(); - connectDatabase(); super.doStart(); } @@ -208,6 +207,7 @@ public class JDBCLoginService extends MappedLoginService { _users.clear(); _lastHashPurge = now; + closeConnection(); } return super.login(username,credentials); @@ -256,8 +256,22 @@ public class JDBCLoginService extends MappedLoginService catch (SQLException e) { Log.warn("UserRealm " + getName() + " could not load user information from database", e); - connectDatabase(); + closeConnection(); } return null; } + + /** + * Close an existing connection + */ + private void closeConnection () + { + if (_con != null) + { + if (Log.isDebugEnabled()) Log.debug("Closing db connection for JDBCUserRealm"); + try { _con.close(); }catch (Exception e) {Log.ignore(e);} + } + _con = null; + } + }