Closing metricsconfigs.txt
This commit is contained in:
parent
ce1d6b8460
commit
75727840df
|
@ -139,13 +139,13 @@ public class JMXFetch {
|
|||
}
|
||||
|
||||
private static List<String> getInternalMetricFiles() {
|
||||
try {
|
||||
final InputStream metricConfigsStream =
|
||||
JMXFetch.class.getResourceAsStream("metricconfigs.txt");
|
||||
final InputStream metricConfigsStream = JMXFetch.class.getResourceAsStream("metricconfigs.txt");
|
||||
if (metricConfigsStream == null) {
|
||||
log.debug("metricconfigs not found. returning empty set");
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
}
|
||||
|
||||
try {
|
||||
final String configs = IOUtils.toString(metricConfigsStream, StandardCharsets.UTF_8);
|
||||
final String[] split = configs.split("\n");
|
||||
final List<String> result = new ArrayList<>(split.length);
|
||||
|
@ -167,10 +167,11 @@ public class JMXFetch {
|
|||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
log.debug("error reading metricconfigs. returning empty set", e);
|
||||
return Collections.emptyList();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(metricConfigsStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue