Bug report #523 has just been filed.

You can view the report at the following URL:

   <http://znutar.cortexity.com/BugRatViewer/ShowReport/523>

REPORT #523 Details.

Project: Jasper
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: medium
Severity: serious
Confidence: public
Environment: 
   Release: tomcat3.2
   JVM Release: jdk1.2.2
   Operating System: winnt
   OS Release: 4
   Platform: intel

Synopsis: 
Platform Portability Issue

Description:
I have tracked down the cause to bug 418 (sorry I haven't updated bug 418 with this 
explaination/fix but the bug system wouldn't let me update the bug).

org.apache.jasper.CommandLineContext has the following function.

    /** 
     * Gets the actual path of a URI relative to the context of
     * the compilation.
     */
    public String getRealPath(String path) {
        path = resolveRelativeUri(path);
        if (path.startsWith("/")) {
            path = path.substring(1);
        }
        File f = new File(uriRoot, path.replace('/', File.separatorChar));
        return f.getAbsolutePath();
    }

As you can see, path.startsWith("/") assumes unix style slashes. I have found that in 
some situations this assumption is wrong (see bug 418 for an explaination of when this 
occurs).

So a quick hacky fix that I have found works is to replace this function with 

    /** 
     * Gets the actual path of a URI relative to the context of
     * the compilation.
     */
    public String getRealPath(String path) {
        path = resolveRelativeUri(path);
        if (path.startsWith("/") || path.startsWith("\\")) {
            path = path.substring(1);
        }
        File f = new File(uriRoot, path.replace('/', File.separatorChar));
        return f.getAbsolutePath();
    }


- Chris.
Title: BugRat Report # 523

BugRat Report # 523

Project: Jasper Release: tomcat3.2
Category: Bug Report SubCategory: New Bug Report
Class: swbug State: received
Priority: medium Severity: serious
Confidence: public

Submitter: Christopher Kirk ( [EMAIL PROTECTED] )
Date Submitted: Dec 5 2000, 03:31:02 CST
Responsible: Z_Tomcat Alias ( [EMAIL PROTECTED] )

Synopsis:
Platform Portability Issue
Environment: (jvm, os, osrel, platform)
jdk1.2.2, winnt, 4, intel

Additional Environment Description:

Report Description:
I have tracked down the cause to bug 418 (sorry I haven't updated bug 418 with this explaination/fix but the bug system wouldn't let me update the bug). org.apache.jasper.CommandLineContext has the following function. /** * Gets the actual path of a URI relative to the context of * the compilation. */ public String getRealPath(String path) { path = resolveRelativeUri(path); if (path.startsWith("/")) { path = path.substring(1); } File f = new File(uriRoot, path.replace('/', File.separatorChar)); return f.getAbsolutePath(); } As you can see, path.startsWith("/") assumes unix style slashes. I have found that in some situations this assumption is wrong (see bug 418 for an explaination of when this occurs). So a quick hacky fix that I have found works is to replace this function with /** * Gets the actual path of a URI relative to the context of * the compilation. */ public String getRealPath(String path) { path = resolveRelativeUri(path); if (path.startsWith("/") || path.startsWith("\\")) { path = path.substring(1); } File f = new File(uriRoot, path.replace('/', File.separatorChar)); return f.getAbsolutePath(); } - Chris.

View this report online...

Reply via email to