logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1390844 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/config/ flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/
Date Thu, 27 Sep 2012 05:20:12 GMT
Author: rgoers
Date: Thu Sep 27 05:20:11 2012
New Revision: 1390844

URL: http://svn.apache.org/viewvc?rev=1390844&view=rev
Log:
Close stream after reading configuration

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
    logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java?rev=1390844&r1=1390843&r2=1390844&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
Thu Sep 27 05:20:11 2012
@@ -67,7 +67,9 @@ public class JSONConfiguration extends B
         byte[] buffer;
 
         try {
-            buffer = toByteArray(source.getByteStream());
+            InputStream configStream = source.getByteStream();
+            buffer = toByteArray(configStream);
+            configStream.close();
             InputStream is = new ByteArrayInputStream(buffer);
             source = new InputSource(is);
             ObjectMapper mapper = new ObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS,
true);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java?rev=1390844&r1=1390843&r2=1390844&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
Thu Sep 27 05:20:11 2012
@@ -89,7 +89,9 @@ public class XMLConfiguration extends Ba
         byte[] buffer = null;
 
         try {
-            buffer = toByteArray(source.getByteStream());
+            InputStream configStream = source.getByteStream();
+            buffer = toByteArray(configStream);
+            configStream.close();
             source = new InputSource(new ByteArrayInputStream(buffer));
             DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
             Document document = builder.parse(source);

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java?rev=1390844&r1=1390843&r2=1390844&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
Thu Sep 27 05:20:11 2012
@@ -195,7 +195,7 @@ public class FlumeEmbeddedAgentTest {
             transaction.begin();
 
             Event event = primaryChannel.take();
-            Assert.assertNotNull(event);
+            Assert.assertNotNull("Missing event number " + i + 1, event);
             String body = getBody(event);
             String expected = "Test Multiple " + i;
             Assert.assertTrue("Channel contained event, but not expected message. Received:
" + body,



Mime
View raw message