diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2007-01-30 03:19:58 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2007-01-30 03:19:58 +0000 |
commit | f1d68efbd516ea37ed12a0d2da430b59b8e418f9 (patch) | |
tree | 01bfd180cc3f1366e0abb5c31702d902450cb5e1 /src/main/java/com/amazon/carbonado/repo/sleepycat | |
parent | 48d34d65928010cf022913bf0126629604a6398d (diff) |
More cursor closing paranoia.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java index 7792536..6fc7cdd 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java @@ -245,16 +245,20 @@ abstract class BDBRepository<Txn> metaRepo.storageFor(StoredDatabaseInfo.class)
.query().orderBy("databaseName").fetch();
- ArrayList<String> names = new ArrayList<String>();
- while (cursor.hasNext()) {
- StoredDatabaseInfo info = cursor.next();
- // Ordinary user types support evolution.
- if (info.getEvolutionStrategy() != StoredDatabaseInfo.EVOLUTION_NONE) {
- names.add(info.getDatabaseName());
+ try {
+ ArrayList<String> names = new ArrayList<String>();
+ while (cursor.hasNext()) {
+ StoredDatabaseInfo info = cursor.next();
+ // Ordinary user types support evolution.
+ if (info.getEvolutionStrategy() != StoredDatabaseInfo.EVOLUTION_NONE) {
+ names.add(info.getDatabaseName());
+ }
}
- }
- return names.toArray(new String[names.size()]);
+ return names.toArray(new String[names.size()]);
+ } finally {
+ cursor.close();
+ }
}
public boolean isSupported(Class<Storable> type) {
|