diff options
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) {
|