Use try-with-resources.
This commit is contained in:
parent
e3e020fe2f
commit
9ebcddc0b1
|
@ -142,10 +142,9 @@ public class EventListenerSupportTest {
|
|||
|
||||
//serialize:
|
||||
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
final ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
|
||||
|
||||
objectOutputStream.writeObject(listenerSupport);
|
||||
objectOutputStream.close();
|
||||
try (final ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream)) {
|
||||
objectOutputStream.writeObject(listenerSupport);
|
||||
}
|
||||
|
||||
//deserialize:
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
Loading…
Reference in New Issue