[ML] Use try-with-resources for InputStream (elastic/x-pack-elasticsearch#2182)
Original commit: elastic/x-pack-elasticsearch@88d5e73fec
This commit is contained in:
parent
36bad2079d
commit
87bc215b91
|
@ -24,9 +24,10 @@ public final class DomainSplitFunction {
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
Map<String, Object> paramsMap = new HashMap<>();
|
||||||
|
|
||||||
Map<String, String> exact = new HashMap<>(2048);
|
Map<String, String> exact = new HashMap<>(2048);
|
||||||
try {
|
|
||||||
InputStream resource =
|
String exactResourceName = "org/elasticsearch/xpack/ml/transforms/exact.properties";
|
||||||
DomainSplitFunction.class.getClassLoader().getResourceAsStream("org/elasticsearch/xpack/ml/transforms/exact.properties");
|
|
||||||
|
try (InputStream resource = DomainSplitFunction.class.getClassLoader().getResourceAsStream(exactResourceName)) {
|
||||||
List<String> lines = Streams.readAllLines(resource);
|
List<String> lines = Streams.readAllLines(resource);
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
String[] split = line.split("=");
|
String[] split = line.split("=");
|
||||||
|
|
Loading…
Reference in New Issue