From 892c3465132b1f9460ab6dfc1a23989c7e65b037 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 6 May 2009 10:26:44 +0000 Subject: [PATCH] Remove some unnecessary code git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@772133 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/catalina/realm/DataSourceRealm.java | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/java/org/apache/catalina/realm/DataSourceRealm.java b/java/org/apache/catalina/realm/DataSourceRealm.java index 243fec93e..a3228d255 100644 --- a/java/org/apache/catalina/realm/DataSourceRealm.java +++ b/java/org/apache/catalina/realm/DataSourceRealm.java @@ -277,29 +277,19 @@ public class DataSourceRealm Connection dbConnection = null; - try { - - // Ensure that we have an open database connection - dbConnection = open(); - if (dbConnection == null) { - // If the db connection open fails, return "not authenticated" - return null; - } - - // Acquire a Principal object for this user - return authenticate(dbConnection, username, credentials); - - } catch (SQLException e) { - // Log the problem for posterity - containerLog.error(sm.getString("dataSourceRealm.exception"), e); - - // Return "not authenticated" for this request - return (null); - - } finally { - close(dbConnection); + // Ensure that we have an open database connection + dbConnection = open(); + if (dbConnection == null) { + // If the db connection open fails, return "not authenticated" + return null; } + + // Acquire a Principal object for this user + Principal principal = authenticate(dbConnection, username, credentials); + + close(dbConnection); + return principal; } @@ -320,7 +310,7 @@ public class DataSourceRealm */ protected Principal authenticate(Connection dbConnection, String username, - String credentials) throws SQLException{ + String credentials) { String dbCredentials = getPassword(dbConnection, username); -- 2.11.0