Skip to content

Commit 13c0994

Browse files
committed
Use try-with-resources
1 parent 8ba3d34 commit 13c0994

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ public Object makeObject() {
100100

101101
private byte[] serialize(final Object object) throws IOException {
102102
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
103-
final ObjectOutputStream oos = new ObjectOutputStream(baos);
104-
105-
oos.writeObject(object);
106-
oos.close();
107-
103+
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
104+
oos.writeObject(object);
105+
}
108106
return baos.toByteArray();
109107
}
110108

0 commit comments

Comments
 (0)