https://bz.apache.org/bugzilla/show_bug.cgi?id=63964
Bug ID: 63964 Summary: Null returned when opening resource URL stream Product: Tomcat 9 Version: 9.0.29 Hardware: PC Status: NEW Severity: major Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: jan.michal...@cloverdx.com Target Milestone: ----- Created attachment 36902 --> https://bz.apache.org/bugzilla/attachment.cgi?id=36902&action=edit Sample project to reproduce the issue When opening web app resource's URL for reading, null is returned if the URL was obtained in a specific way. See attached sample project: URL dir = servletContext.getResource("/WEB-INF/dir/"); URL file = new URL(dir, "file"); InputStream in = file.openStream(); // null returned even if the "/WEB-INF/dir/file" exists. The issue seems to be in CachedResourceURLStreamHandler, where opening the URLConnection ignores provided URL: @Override protected URLConnection openConnection(URL u) throws IOException { return new CachedResourceURLConnection(resourceURL, root, webAppPath, usesClassLoaderResources); } The "resourceUrl" points to the parent directory, so null is answered as the input stream. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org