Musachy Barroso wrote:
I think "file".equalsIgnoreCase(uri.getScheme()) already covers that,
doesn't it?

No. All that checks is that it has a scheme (and is thus not relative), and that scheme is "file".

Here's the values returned by that iterator for my app running under glassfish on XP:

file:/C:/Sun/SDK/
file:/C:/Sun/SDK/domains/domain1/lib/classes/
file:/C:/Sun/SDK/domains/domain1/applications/j2ee-modules/myApp/WEB-INF/classes/
file:C:/Sun/SDK/domains/domain1/generated/ejb/j2ee-modules/myApp/

They are all file: urls, but since the last one is missing a slash before "C:", the File constructor fails complaining "URI is not hierarchical". According to the URI javadoc: "A hierarchical URI is either an absolute URI whose scheme-specific part begins with a slash character, or a relative URI, that is, a URI that does not specify a scheme." Since it also says that "An opaque URI is an absolute URI whose scheme-specific part does not begin with a slash character ('/').", then ensuring that it is also not opaque will ensure that it is hierarchical, and thus that File won't barf on it.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to