Am 6. Februar 2015 03:23:24 MEZ, schrieb Christopher Schultz 
<ch...@christopherschultz.net>:
>Felix,
>
>On 2/5/15 3:26 PM, fschumac...@apache.org wrote:
>> Author: fschumacher
>> Date: Thu Feb  5 20:26:19 2015
>> New Revision: 1657682
>> 
>> URL: http://svn.apache.org/r1657682
>> Log:
>> Don't use instance scoped variables in try-with block, since it will
>get
>> closed, but not nulled.
>> 
>> Modified:
>>     tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
>> 
>> Modified: tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
>> URL:
>http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java?rev=1657682&r1=1657681&r2=1657682&view=diff
>>
>==============================================================================
>> --- tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
>(original)
>> +++ tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java Thu
>Feb  5 20:26:19 2015
>> @@ -522,8 +522,8 @@ public class JDBCRealm
>>                  // Ensure that we have an open database connection
>>                  open();
>>  
>> -                try (PreparedStatement stmt =
>credentials(dbConnection, username);
>> -                        ResultSet rs = stmt.executeQuery()) {
>> +                PreparedStatement stmt = credentials(dbConnection,
>username);
>> +                try (ResultSet rs = stmt.executeQuery()) {
>>                      if (rs.next()) {
>>                          dbCredentials = rs.getString(1);
>>                      }
>
>
>What part of this was "instance-scoped"? Do I misunderstand your commit
>comment?

Have a look at credentials. I think I should add a comment in the code as well. 

Felix
>
>-chris
>
>> @@ -552,7 +552,6 @@ public class JDBCRealm
>>          return null;
>>      }
>>  
>> -
>>      /**
>>       * Return the Principal associated with the given user name.
>>       */
>> @@ -591,8 +590,8 @@ public class JDBCRealm
>>                  // Ensure that we have an open database connection
>>                  open();
>>  
>> -                try (PreparedStatement stmt = roles(dbConnection,
>username);
>> -                        ResultSet rs = stmt.executeQuery()) {
>> +                PreparedStatement stmt = roles(dbConnection,
>username);
>> +                try (ResultSet rs = stmt.executeQuery()) {
>>                      // Accumulate the user's roles
>>                      ArrayList<String> roleList = new ArrayList<>();
>>  
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to