You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@excalibur.apache.org by "Paul Christmann (JIRA)" <de...@excalibur.apache.org> on 2005/01/06 16:13:13 UTC

[jira] Commented: (EXLBR-19) URLSource reports non-existent URL exists

     [ http://issues.apache.org/jira/browse/EXLBR-19?page=comments#action_57352 ]
     
Paul Christmann commented on EXLBR-19:
--------------------------------------

Way more detail than you may want to know about this bug....

I have a cocoon web application that includes javascript files with lines like:

importClass(com.priorartisans.ticketing.reports.Domain)

Somehow (and I can't figure out where/why), the Cocoon javascript interpreter reads this line and ends up trying to locate these classes:

com.priorartisans
com.priorartisans.ticketing
com.priorartisans.ticketing.reports

Since it can't find those classes, it attempts to locate java sources to compile them using string manipulation to attempt to find:

com/priorartisans.java
com/priorartisans/ticketing.java
com/priorartisans/ticketing/reports.java

Eventually, this leads to a call to excalibur sourceresolver (leaving out lots of try/catch stuff):

    Source src = sourceResolver.resolveURI(uri);
    if (src.exists()) return src;

If I deploy my web application as an expanded folder (under TOMCAT_HOME/webapps), then the returned Source is a FileSource and it has a URI that looks like "file://tomcat-stuff/com/priorartisans.java".  Since that file doesn't exist, the src.exists() returns false and Cocoon happily ignores that file.

HOWEVER, if I deploy my web application as a WAR, then the returned source is a URLSource with a URI of "jndi:/localhost/reports/com/priorartisans.java".  In this case, the URLSource reports that it exists, so Cocoon's CompilingClassLoader attempts to compile that file, which of course - it can't.  But that failed compilation attempt ends up throwing exceptions that percolate up the stack.

So - the URLSource needs a patch to properly report when the input URL doesn't exist.

There's a bug entry in cocoon's bugzilla site for this: http://issues.apache.org/bugzilla/show_bug.cgi?id=27484

> URLSource reports non-existent URL exists
> -----------------------------------------
>
>          Key: EXLBR-19
>          URL: http://issues.apache.org/jira/browse/EXLBR-19
>      Project: Excalibur Components
>         Type: Bug
>   Components: SourceResolver
>     Versions: 1.1
>  Environment: Using Cocoon 2.1.X under Tomcat 5.0.30-beta and Jetty 5.1.0 on Windows XP and W2K servers
>     Reporter: Paul Christmann
>  Attachments: URLSourceTestCase.java, patchfile.txt
>
> The URLSource exists() method incorrectly returns "true" even if the provided URL (via the init method) does not exist.
>     URLSource source = new URLSource();
>     source.init("http://www.nosuchsite.com", Collections.EMPTY_MAP);
>     if ( source.exists() ) {
>         // It shouldn't, but exists returns true
>     }
>     

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org