Repository: tinkerpop Updated Branches: refs/heads/tp33 10dc80a1c -> 4d13ab188
close resources - CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/143a86bc Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/143a86bc Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/143a86bc Branch: refs/heads/tp33 Commit: 143a86bcce5010cff2e7bb162b4ce73cb161961b Parents: b524225 Author: Robert Dale <robd...@gmail.com> Authored: Tue Mar 20 12:30:30 2018 -0400 Committer: Robert Dale <robd...@gmail.com> Committed: Tue Mar 20 12:30:30 2018 -0400 ---------------------------------------------------------------------- .../tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/143a86bc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java index c996cae..89aa733 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java @@ -25,6 +25,7 @@ import java.nio.file.Files; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Default implementation of the {@link ScriptCustomizer} that can create the script list from a list of files or @@ -38,8 +39,8 @@ public class DefaultScriptCustomizer implements ScriptCustomizer { public DefaultScriptCustomizer(final List<File> files) { this(files.stream().map(f -> { - try { - return Files.lines(f.toPath(), StandardCharsets.UTF_8).collect(Collectors.toList()); + try (Stream<String> lines = Files.lines(f.toPath(), StandardCharsets.UTF_8)) { + return lines.collect(Collectors.toList()); } catch (IOException ioe) { throw new IllegalStateException(ioe); }