Skip to content

Commit

Permalink
Merge pull request #1182 from baranowb/UNDERTOW-1906_2.0.x
Browse files Browse the repository at this point in the history
[UNDERTOW-1906] Guard against null resource path
  • Loading branch information
fl4via committed Jul 20, 2021
2 parents 2deb0e1 + bd8587b commit 377111d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Expand Up @@ -77,6 +77,9 @@ public void handleChanges(Collection<ResourceChangeEvent> changes) {

@Override
public CachedResource getResource(final String p) throws IOException {
if( p == null ) {
return null;
}
final String path;
//base always ends with a /
if (p.startsWith("/")) {
Expand Down
Expand Up @@ -58,6 +58,9 @@ public ClassPathResourceManager(final ClassLoader classLoader) {

@Override
public Resource getResource(final String path) throws IOException {
if( path == null ) {
return null;
}
String modPath = path;
if(modPath.startsWith("/")) {
modPath = path.substring(1);
Expand Down
Expand Up @@ -186,6 +186,9 @@ public PathResourceManager setBase(final File base) {
}

public Resource getResource(final String p) {
if( p == null ) {
return null;
}
String path;
//base always ends with a /
if (p.startsWith("/")) {
Expand Down
Expand Up @@ -296,7 +296,7 @@ public Set<String> getResourcePaths(final String path) {

@Override
public URL getResource(final String path) throws MalformedURLException {
if (!path.startsWith("/")) {
if (path == null || !path.startsWith("/")) {
throw UndertowServletMessages.MESSAGES.pathMustStartWithSlash(path);
}
Resource resource = null;
Expand Down

0 comments on commit 377111d

Please sign in to comment.