From b1d5f908a6e7ecb06ab8a441c9fe5bbfbc62b502 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Wed, 27 Jul 2022 10:49:47 +0200 Subject: [PATCH] fix mounting/unmounting lifecycle of TLD resources Signed-off-by: Ludovic Orban --- .../eclipse/jetty/ee10/webapp/MetaInfConfiguration.java | 7 +++++-- .../org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java b/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java index 920decebf12..86eb52a5d56 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java +++ b/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java @@ -720,8 +720,11 @@ public class MetaInfConfiguration extends AbstractConfiguration public Collection getTlds(URI uri) throws IOException { HashSet tlds = new HashSet<>(); - try (Resource.Mount mount = Resource.mount(uriJarPrefix(uri, "!/")); - Stream stream = Files.walk(mount.root().getPath())) + Resource.Mount mount = Resource.mount(uriJarPrefix(uri, "!/")); + if (_mountedResources == null) + _mountedResources = new ArrayList<>(); + _mountedResources.add(mount); + try (Stream stream = Files.walk(mount.root().getPath())) { Iterator it = stream .filter(MetaInfConfiguration::isTldFile) diff --git a/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java b/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java index 504e4aa1e10..771df0abe4b 100644 --- a/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java +++ b/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java @@ -713,8 +713,11 @@ public class MetaInfConfiguration extends AbstractConfiguration public Collection getTlds(URI uri) throws IOException { HashSet tlds = new HashSet<>(); - try (Resource.Mount mount = Resource.mount(uriJarPrefix(uri, "!/")); - Stream stream = Files.walk(mount.root().getPath())) + Resource.Mount mount = Resource.mount(uriJarPrefix(uri, "!/")); + if (_mountedResources == null) + _mountedResources = new ArrayList<>(); + _mountedResources.add(mount); + try (Stream stream = Files.walk(mount.root().getPath())) { Iterator it = stream .filter(MetaInfConfiguration::isTldFile)