This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 9ebcddc0b15c39f18c26b330acd3bfd921ef9bff
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Mar 7 15:27:28 2022 -0500

    Use try-with-resources.
---
 .../org/apache/commons/lang3/event/EventListenerSupportTest.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java 
b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
index facff22..9371339 100644
--- a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
+++ b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
@@ -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")

Reply via email to