cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject [Bugs] URLSource
Date Wed, 15 May 2002 17:37:37 GMT
Carsten,

I've recently switched to the new source-resolving excalibur code and I
found that you use the following

     File file = new File( this.systemId.substring( "file".length() ) );

to obtain the 'path' part of a 'file' URI. The above might work on UNIX,
but it clearly doesn't work on other operating systems, since URIs like
these

    file:///c:/path/to/file

are totally valid and your code is not able to handle them.

Now, my suggestion would be to use the standard java.net API because
they already handle all these issues (file: protocol handling is
expecially tricky on regards of the number of slashes).

NOTE: there is no official indication on how the file: URI should be
addressed, but all these

    file:/file
    file://file
    file:///file

are all valid URIs and should point to the same file (at least, this was
my understanding). It could be possible to add

    file:file

to indicate a relative location. This is normally achieved by avoiding
to indicate the protocol (such as in "file"), but since we need a
protocol to identify the handler, "file:file" might just be a way to
encode relativity in file positioning.

                                  - o -

I just found another bug: the docs say that if you call

   resolver.resolveURI()

and the resource doesn't exist, you get a SourceNotFoundException. If yo 
are accessing file resources, instead you get a FileNotFoundException, 
which is not even inherited.

Expect more bug report soon since I'm getting pretty heavy on sources :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                             able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------






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


Mime
View raw message