Bug 52772

Summary: JspC : checking uriRoot option validness
Product: Tomcat 7 Reporter: Eugene Chung (TmaxSoft) <bluewolf.chung>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: trivial    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Eugene Chung (TmaxSoft) 2012-02-26 07:41:43 UTC
In org.apache.jasper.JspC#execute() method,
if uriRoot is not null,
it scans all jsp files under uriRoot,
and then checks if uriRoot is a directory.

It should be more desirable to check if uriRoot is a directory or not first and then scanning it.

Here are my suggestion.

            if (uriRoot == null) {
                throw new JasperException(

            File uriRootF = new File(uriRoot);
            if (!uriRootF.exists() || !uriRootF.isDirectory()) {
                throw new JasperException(

            if( context==null ) {

            // No explicit pages, we'll process all .jsp in the webapp
            if (pages.size() == 0) {
Comment 1 Eugene Chung (TmaxSoft) 2012-02-26 07:44:35 UTC
And !uriRootF.exists() || !uriRootF.isDirectory() is redundant. isDirectory() checks existence, too.
Comment 2 Mark Thomas 2012-03-07 15:11:45 UTC
Thanks for the report and the suggested fix.

This issue has been fixed in trunk and 7.0.x and will be included in 7.0.27 onwards.