Bug 35571 - JspC misinterprets uriRoot when executed as ant task
JspC misinterprets uriRoot when executed as ant task
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Jasper
Nightly Build
Other Windows XP
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-07-01 06:06 UTC by Jason Pettiss
Modified: 2005-07-22 08:46 UTC (History)
0 users



Attachments
Patch (1.63 KB, patch)
2005-07-01 06:07 UTC, Jason Pettiss
Details | Diff
Resolution patch (2.95 KB, patch)
2005-07-01 21:50 UTC, Jason Pettiss
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Pettiss 2005-07-01 06:06:07 UTC
If JspC is called during an Ant build, relative values for uriRoot are resolved
incorrectly if Ant has not been launched from the same directory as the build
file.  This will also occur if the <ant> task is used to call a sub-project in
another directory.

This is because uriRoot is resolved against the current working directory rather
than the basedir for the Project.

Adding a setProject(Project) setter and if set, using project.getBaseDir() to
resolve the uriRoot fixes this.  Will submit patch.
Comment 1 Jason Pettiss 2005-07-01 06:07:47 UTC
Created attachment 15570 [details]
Patch
Comment 2 Jason Pettiss 2005-07-01 06:39:08 UTC
My apologies for not noticing this sooner, it also misinterprets outputDir
(scratchDir).  Similar thing on setOutputDir is needed:

    public void setOutputDir( String s ) {
        if( s!= null ) {
            if( null!=project ) {
                scratchDir = new File(project.getBaseDir(), s).getAbsoluteFile();
            } else {
                scratchDir = new File(s).getAbsoluteFile();
            }
        } else {
            scratchDir=null;
        }
    }

Sorry, I'm no longer set up to create a formal patch for this.
Comment 3 Jason Pettiss 2005-07-01 21:50:33 UTC
Created attachment 15578 [details]
Resolution patch
Comment 4 Jason Pettiss 2005-07-01 21:52:48 UTC
It's been brought to my attention that Ant already has a mechanism for resolving
file paths regardless of the os/filesystem/etc.  I've incorporated that and have
also made sure that the webXml and webxmlFragment paths are also correctly
interpreted.
Comment 5 Yoav Shapira 2005-07-21 23:04:43 UTC
Hmm, I like this patch and went to implement it, but FileUtils#getFileUtils
appears to be gone...
Comment 6 Jason Pettiss 2005-07-21 23:45:07 UTC
Yeah the old factory method was newFileUtils() which was deprecated in Ant 1.6.3
(pretty recently) by getFileUtils().
Comment 7 Yoav Shapira 2005-07-22 16:46:34 UTC
OK, done.  Thanks for submitting this.