Remove some unnecessary code
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 6 May 2009 10:26:44 +0000 (10:26 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 6 May 2009 10:26:44 +0000 (10:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@772133 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/realm/DataSourceRealm.java

index 243fec9..a3228d2 100644 (file)
@@ -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);