Skip to content

Commit

Permalink
Fixes #5521 ResourceCollection list NPE
Browse files Browse the repository at this point in the history
Ensure that dirs passed to addPath end with / so they can be detected as dirs even if they do not exist.
  • Loading branch information
gregw committed Oct 28, 2020
1 parent 6698a31 commit 19596b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -206,13 +206,13 @@ else if (LOG.isDebugEnabled())
if (target.isDirectory())
{
//TODO think how to handle an unpacked jar file (eg for osgi)
resourcesDir = target.addPath("/META-INF/resources");
resourcesDir = target.addPath("/META-INF/resources/");
}
else
{
//Resource represents a packed jar
URI uri = target.getURI();
resourcesDir = Resource.newResource(uriJarPrefix(uri, "!/META-INF/resources"));
resourcesDir = Resource.newResource(uriJarPrefix(uri, "!/META-INF/resources/"));
}

if (!resourcesDir.exists() || !resourcesDir.isDirectory())
Expand All @@ -227,7 +227,7 @@ else if (LOG.isDebugEnabled())
if (old != null)
resourcesDir = old;
else if (LOG.isDebugEnabled())
LOG.debug(target + " META-INF/resources cache updated");
LOG.debug(target + " META-INF/resources/ cache updated");
}

if (resourcesDir == EmptyResource.INSTANCE)
Expand Down
Expand Up @@ -907,7 +907,7 @@ protected List<Resource> findWebInfLibJars(WebAppContext context)
return null;

List<Resource> jarResources = new ArrayList<>();
Resource webInfLib = webInf.addPath("/lib");
Resource webInfLib = webInf.addPath("lib/");
if (webInfLib.exists() && webInfLib.isDirectory())
{
String[] files = webInfLib.list();
Expand Down

0 comments on commit 19596b2

Please sign in to comment.