Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UNDERTOW-1906] Guard against null resource path #1181

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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