Skip to content

Commit c2b14dc

Browse files
committed
Close in finally.
1 parent 0f01863 commit c2b14dc

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/main/java/com/github/dockerjava/jaxrs/BuildImageCmdExec.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ public Iterable<EventStreamItem> getItems() throws IOException {
7979
// and then do other configuration, if any, and read:
8080
Iterator<EventStreamItem> items = reader.readValues(proxy);
8181

82-
proxy.close();
83-
84-
return ImmutableList.copyOf(items);
82+
try {
83+
return ImmutableList.copyOf(items);
84+
} finally {
85+
proxy.close();
86+
}
8587
}
8688

8789
@Override

src/main/java/com/github/dockerjava/jaxrs/PushImageCmdExec.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ public Iterable<PushEventStreamItem> getItems() throws IOException {
7474
// and then do other configuration, if any, and read:
7575
Iterator<PushEventStreamItem> items = reader.readValues(proxy);
7676

77-
proxy.close();
78-
79-
return ImmutableList.copyOf(items);
77+
try {
78+
return ImmutableList.copyOf(items);
79+
} finally {
80+
proxy.close();
81+
}
8082
}
8183

8284
@Override

0 commit comments

Comments
 (0)