Skip to content

Commit

Permalink
Script: Load Whitelists as Resource (#87539) (#87566)
Browse files Browse the repository at this point in the history
Changes PainlessPlugin.class.getResourceAsStream to
PainlessPlugin.class.getResource to avoid leaking unclosed
input streams
  • Loading branch information
stu-elastic committed Jun 9, 2022
1 parent 01076fa commit 83b528a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/changelog/87539.yaml
@@ -0,0 +1,5 @@
pr: 87539
summary: "Script: Load Whitelists as Resource"
area: Infra/Scripting
type: bug
issues: []
Expand Up @@ -90,7 +90,7 @@ public final class PainlessPlugin extends Plugin implements ScriptPlugin, Extens

for (ScriptContext<?> context : ScriptModule.CORE_CONTEXTS.values()) {
List<Whitelist> contextWhitelists = new ArrayList<>();
if (PainlessPlugin.class.getResourceAsStream("org.elasticsearch.script." + context.name.replace('-', '_') + ".txt") != null) {
if (PainlessPlugin.class.getResource("org.elasticsearch.script." + context.name.replace('-', '_') + ".txt") != null) {
contextWhitelists.add(
WhitelistLoader.loadFromResourceFiles(
PainlessPlugin.class,
Expand Down

0 comments on commit 83b528a

Please sign in to comment.