From f1d68efbd516ea37ed12a0d2da430b59b8e418f9 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 30 Jan 2007 03:19:58 +0000 Subject: More cursor closing paranoia. --- .../carbonado/repo/sleepycat/BDBRepository.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat') 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 metaRepo.storageFor(StoredDatabaseInfo.class) .query().orderBy("databaseName").fetch(); - ArrayList names = new ArrayList(); - while (cursor.hasNext()) { - StoredDatabaseInfo info = cursor.next(); - // Ordinary user types support evolution. - if (info.getEvolutionStrategy() != StoredDatabaseInfo.EVOLUTION_NONE) { - names.add(info.getDatabaseName()); + try { + ArrayList names = new ArrayList(); + 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 type) { -- cgit v1.2.3