diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java index 94d07d27cac..293885fb87f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java @@ -24,9 +24,10 @@ public final class DomainSplitFunction { Map paramsMap = new HashMap<>(); Map exact = new HashMap<>(2048); - try { - InputStream resource = - DomainSplitFunction.class.getClassLoader().getResourceAsStream("org/elasticsearch/xpack/ml/transforms/exact.properties"); + + String exactResourceName = "org/elasticsearch/xpack/ml/transforms/exact.properties"; + + try (InputStream resource = DomainSplitFunction.class.getClassLoader().getResourceAsStream(exactResourceName)) { List lines = Streams.readAllLines(resource); for (String line : lines) { String[] split = line.split("=");