mirror of https://github.com/apache/kafka.git
KAFKA-3235: Unclosed stream in AppInfoParser static block
Always close the stream Author: Kim Christensen <kich@mvno.dk> Reviewers: Ismael Juma, Grant Henke Closes #914 from kichristensen/KAFKA-3235
This commit is contained in:
parent
6ebb2363ba
commit
49fd0ceb09
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.kafka.common.utils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -32,9 +33,9 @@ public class AppInfoParser {
|
|||
private static String commitId = "unknown";
|
||||
|
||||
static {
|
||||
try {
|
||||
try (InputStream resourceStream = AppInfoParser.class.getResourceAsStream("/kafka/kafka-version.properties")) {
|
||||
Properties props = new Properties();
|
||||
props.load(AppInfoParser.class.getResourceAsStream("/kafka/kafka-version.properties"));
|
||||
props.load(resourceStream);
|
||||
version = props.getProperty("version", version).trim();
|
||||
commitId = props.getProperty("commitId", commitId).trim();
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue