Use try-with-resources statements
- instead of finally blocks - in cases of missing try-finally Change-Id: I94f481a33d8e6a3180c436245d6e95e4d525280c
This commit is contained in:
@@ -307,8 +307,7 @@ public class LdapRealm extends AbstractRealm {
|
||||
|
||||
@Override
|
||||
public Optional<Account.Id> load(String username) throws Exception {
|
||||
final ReviewDb db = schema.open();
|
||||
try {
|
||||
try (ReviewDb db = schema.open()) {
|
||||
final AccountExternalId extId =
|
||||
db.accountExternalIds().get(
|
||||
new AccountExternalId.Key(SCHEME_GERRIT, username));
|
||||
@@ -316,8 +315,6 @@ public class LdapRealm extends AbstractRealm {
|
||||
return Optional.of(extId.getAccountId());
|
||||
}
|
||||
return Optional.absent();
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user