logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1405291 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java
Date Sat, 03 Nov 2012 06:36:39 GMT
Author: ggregory
Date: Sat Nov  3 06:36:39 2012
New Revision: 1405291

URL: http://svn.apache.org/viewvc?rev=1405291&view=rev
Log:
Fix warning: close ObjectOutputStream.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java?rev=1405291&r1=1405290&r2=1405291&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java
Sat Nov  3 06:36:39 2012
@@ -57,7 +57,11 @@ public final class SerializedLayout exte
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try {
             ObjectOutputStream oos = new PrivateObjectOutputStream(baos);
-            oos.writeObject(event);
+            try {
+                oos.writeObject(event);
+            } finally {
+                oos.close();
+            }
         } catch (IOException ioe) {
             LOGGER.error("Serialization of LogEvent failed.", ioe);
         }



Mime
View raw message