svn merge -c 1572220 from trunk for HADOOP-10368. InputStream is not closed in VersionInfo ctor.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1572221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
abdb0ef402
commit
b1d64419ac
|
@ -72,6 +72,9 @@ Release 2.4.0 - UNRELEASED
|
||||||
HADOOP-10070. RPC client doesn't use per-connection conf to determine
|
HADOOP-10070. RPC client doesn't use per-connection conf to determine
|
||||||
server's expected Kerberos principal name. (atm)
|
server's expected Kerberos principal name. (atm)
|
||||||
|
|
||||||
|
HADOOP-10368. InputStream is not closed in VersionInfo ctor.
|
||||||
|
(Tsuyoshi OZAWA via szetszwo)
|
||||||
|
|
||||||
Release 2.3.1 - UNRELEASED
|
Release 2.3.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.hadoop.classification.InterfaceStability;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class returns build information about Hadoop components.
|
* This class returns build information about Hadoop components.
|
||||||
|
@ -45,8 +46,9 @@ public class VersionInfo {
|
||||||
protected VersionInfo(String component) {
|
protected VersionInfo(String component) {
|
||||||
info = new Properties();
|
info = new Properties();
|
||||||
String versionInfoFile = component + "-version-info.properties";
|
String versionInfoFile = component + "-version-info.properties";
|
||||||
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
InputStream is = Thread.currentThread().getContextClassLoader()
|
is = Thread.currentThread().getContextClassLoader()
|
||||||
.getResourceAsStream(versionInfoFile);
|
.getResourceAsStream(versionInfoFile);
|
||||||
if (is == null) {
|
if (is == null) {
|
||||||
throw new IOException("Resource not found");
|
throw new IOException("Resource not found");
|
||||||
|
@ -55,6 +57,8 @@ public class VersionInfo {
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
LogFactory.getLog(getClass()).warn("Could not read '" +
|
LogFactory.getLog(getClass()).warn("Could not read '" +
|
||||||
versionInfoFile + "', " + ex.toString(), ex);
|
versionInfoFile + "', " + ex.toString(), ex);
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeStream(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue