Skip to content

Commit 66db01d

Browse files
lor6pivovarit
authored andcommitted
add try with resources (eugenp#2725)
1 parent 815c66c commit 66db01d

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

libraries-data/src/test/java/com/baeldung/ormlite/ORMLiteTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ public void givenIterator_whenLoop_thenOk() throws SQLException, IOException {
7676
library2.setName("My Other Library");
7777
libraryDao.create(library2);
7878

79-
CloseableWrappedIterable<Library> wrappedIterable = libraryDao.getWrappedIterable();
80-
try {
79+
try (CloseableWrappedIterable<Library> wrappedIterable = libraryDao.getWrappedIterable()) {
8180
wrappedIterable.forEach(lib -> {
8281
System.out.println(lib.getName());
8382
});
84-
} finally {
85-
wrappedIterable.close();
8683
}
8784

8885
}

0 commit comments

Comments
 (0)