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:02:17 UTC

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

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


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

Posted by "Shash Chatterjee (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=history ]
     
Shash Chatterjee resolved EXLBR-19:
-----------------------------------

    Resolution: Fixed

Date: Sat Apr 16 07:50:44 2005
New Revision: 161574

URL: http://svn.apache.org/viewcvs?view=rev&rev=161574
Log:
New test case from http://issues.apache.org/jira/browse/EXLBR-19

Added:
    excalibur/trunk/components/sourceresolve/src/test/org/apache/excalibur/source/test/URLSourceTestCase.java

Date: Sat Apr 16 07:51:43 2005
New Revision: 161575

URL: http://svn.apache.org/viewcvs?view=rev&rev=161575
Log:
Patch from: http://issues.apache.org/jira/browse/EXLBR-19
Fixes:  The URLSource exists() method incorrectly returns "true" even if the provided URL (via the init method) does not exist.

Modified:
    excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java



> 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
>     Assignee: Shash Chatterjee
>  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


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

Posted by "Paul Christmann (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=history ]

Paul Christmann updated EXLBR-19:
---------------------------------

    Attachment: URLSourceTestCase.java

A Test case with 4 tests: two http protocol and two file protocol, one of each that exists and one that doesn't.

> 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


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

Posted by "Shash Chatterjee (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=history ]
     
Shash Chatterjee closed EXLBR-19:
---------------------------------


Will be released with version 2.1

> 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
>     Assignee: Shash Chatterjee
>  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


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

Posted by "Leo Simons (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=all ]
     
Leo Simons reopened EXLBR-19:
-----------------------------

     Assign To: Carsten Ziegeler  (was: Shash Chatterjee)

It's clear from EXLBR-24 this is still a problem. Carsten, could you or one of the other people that know this code take a closer look at it all?

> 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
>     Assignee: Carsten Ziegeler
>  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
-
For more information on JIRA, 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


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

Posted by "Paul Christmann (JIRA)" <de...@excalibur.apache.org>.
     [ 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


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

Posted by "Shash Chatterjee (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=history ]

Shash Chatterjee reassigned EXLBR-19:
-------------------------------------

    Assign To: Shash Chatterjee

> 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
>     Assignee: Shash Chatterjee
>  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


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

Posted by "Carsten Ziegeler (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=all ]
     
Carsten Ziegeler resolved EXLBR-19:
-----------------------------------

    Resolution: Fixed

I fixed this now for http urls. Can you please verify and then close this bug?

> 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
>     Assignee: Carsten Ziegeler
>  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
-
For more information on JIRA, 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


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

Posted by "Paul Christmann (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=all ]
     
Paul Christmann closed EXLBR-19:
--------------------------------


Thanks!

> 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
>     Assignee: Carsten Ziegeler
>  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
-
For more information on JIRA, 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


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

Posted by "Paul Christmann (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=history ]

Paul Christmann updated EXLBR-19:
---------------------------------

    Attachment: patchfile.txt

Patch to URLSource that sets m_exists based on the contentLength retrieved from the URL.

> 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


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

Posted by "Leo Simons (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/EXLBR-19?page=comments#action_63617 ]
     
Leo Simons commented on EXLBR-19:
---------------------------------

I just took a look at this code for the first time. It's kinda wrong in some key areas.

In this case HTTP existence is indicated using response codes. See

http://www.javacoffeebreak.com/faq/faq0079.html

for how to get at them. A check for a 200 or 303 or 304 (depending on what "exists" is supposed to mean) makes sense for HTTP. For stuff like FTP, getting content length may not be a good idea as it might mean fetching the file. "exists" is not something that "in general" can be associated with URLs, so it might have made sense to have some kind of "featureset" detection with supportExistsCheck() returning false for URL types where existence is unknown, rather than "hacking on" functionality like this. Using commons-httpclient might also make sense.

I believe the source resolver is an important part of cocoon so someone might want to investigate fixing this "properly".


> 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
>     Assignee: Shash Chatterjee
>  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
-
For more information on JIRA, 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