1
0

[LOGGING-163] BufferedReader is not closed properly.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1765341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory
2016-10-17 16:56:41 +00:00
parent 249e8f4b88
commit 47ae3e15c3
3 changed files with 18 additions and 5 deletions

View File

@@ -539,8 +539,12 @@ public abstract class LogFactory {
rd = new BufferedReader(new InputStreamReader(is));
}
String factoryClassName = rd.readLine();
rd.close();
String factoryClassName;
try {
factoryClassName = rd.readLine();
} finally {
rd.close();
}
if (factoryClassName != null && ! "".equals(factoryClassName)) {
if (isDiagnosticsEnabled()) {

View File

@@ -17,6 +17,7 @@
package org.apache.commons.logging.impl;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
@@ -158,12 +159,17 @@ public class SimpleLog implements Log, Serializable {
static {
// Add props from the resource simplelog.properties
InputStream in = getResourceAsStream("simplelog.properties");
if(null != in) {
if (null != in) {
try {
simpleLogProps.load(in);
in.close();
} catch(java.io.IOException e) {
} catch (java.io.IOException e) {
// ignored
} finally {
try {
in.close();
} catch (IOException e) {
// ignored
}
}
}