Missing tlds are not handled properly in TldConfig.tldScanTld(). Instead of throwing an exception for the missing resource, an empty InputStream is created and so an exception is generated by the xml parser there is a bad catch around line 536: try { inputSource = new InputSource( context.getServletContext().getResourceAsStream(resourcePath)); if (inputSource == null) { throw new IllegalArgumentException (sm.getString("contextConfig.tldResourcePath", resourcePath)); } tldScanStream(inputSource); ==== as you can see "if (inputSource == null)" can't never be executed because of the previous new InputSource(...) line. Should be fixed with: InputStream stream = context.getServletContext().getResourceAsStream(resourcePath); if (stream == null) { throw new IllegalArgumentException (sm.getString("contextConfig.tldResourcePath", resourcePath)); } inputSource = new InputSource(stream ); tldScanStream(inputSource);
Good suggestion. I've applied a slightly modified version of the patch which does what you suggest but also checks for a null input source afterwards as the current behavior does, just in case there's a regression possibility I'm not aware of. Better safe than sorry ;) Thanks for contributing this.