Repository: logging-log4j2
Updated Branches:
  refs/heads/master 1663bf58d -> 863e61d83


Use Java 7 try-with-resources.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/863e61d8
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/863e61d8
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/863e61d8

Branch: refs/heads/master
Commit: 863e61d836e8a92887e792f4800e478f0d29aaed
Parents: 1663bf5
Author: Gary Gregory <[email protected]>
Authored: Sat Jun 13 15:07:35 2015 -0700
Committer: Gary Gregory <[email protected]>
Committed: Sat Jun 13 15:07:35 2015 -0700

----------------------------------------------------------------------
 .../org/apache/log4j/util/SerializationTestHelper.java  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/863e61d8/log4j-1.2-api/src/test/java/org/apache/log4j/util/SerializationTestHelper.java
----------------------------------------------------------------------
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/util/SerializationTestHelper.java
 
b/log4j-1.2-api/src/test/java/org/apache/log4j/util/SerializationTestHelper.java
index 7d82a05..4cbb53e 100644
--- 
a/log4j-1.2-api/src/test/java/org/apache/log4j/util/SerializationTestHelper.java
+++ 
b/log4j-1.2-api/src/test/java/org/apache/log4j/util/SerializationTestHelper.java
@@ -53,9 +53,9 @@ public class SerializationTestHelper {
     public static Object serializeClone(final Object obj)
         throws IOException, ClassNotFoundException {
         final ByteArrayOutputStream memOut = new ByteArrayOutputStream();
-        final ObjectOutputStream objOut = new ObjectOutputStream(memOut);
-        objOut.writeObject(obj);
-        objOut.close();
+        try (final ObjectOutputStream objOut = new ObjectOutputStream(memOut)) 
{
+            objOut.writeObject(obj);
+        }
 
         final ByteArrayInputStream src = new 
ByteArrayInputStream(memOut.toByteArray());
         final ObjectInputStream objIs = new ObjectInputStream(src);
@@ -90,9 +90,9 @@ public class SerializationTestHelper {
         final String witness, final Object obj, final int[] skip,
         final int endCompare) throws Exception {
         final ByteArrayOutputStream memOut = new ByteArrayOutputStream();
-        final ObjectOutputStream objOut = new ObjectOutputStream(memOut);
-        objOut.writeObject(obj);
-        objOut.close();
+        try (final ObjectOutputStream objOut = new ObjectOutputStream(memOut)) 
{
+            objOut.writeObject(obj);
+        }
 
         assertStreamEquals(witness, memOut.toByteArray(), skip, endCompare);
     }

Reply via email to