xml-commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Girish Kumar Balachandran <Girish.Balachand...@Sun.COM>
Subject opaque URI on windows...
Date Tue, 22 Nov 2005 18:57:29 GMT
Hello Experts,

While using the resolver, I came across this following observation which 
I wanted to clarify with you.

For the following Catalog file (*/public_cat.xml/*)

/*<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" 

resolver resolves uri/ 
*"http://www.example.relative.com/existing/namespace"*/ to  /*"<URI to 
absolute parent dir of  public_cat.xml>/xsdcollection/existingxsd.xsd" 
*/which is as expected. So, the result on Unix is 
/"*file:/home/gb133050/temp/xsdcollection/existingxsd.xsd*//"/ where/* 
public_cat.xml*/ exists @ /*"file:/home/gb133050/temp/public_cat.xml"*/. 
Note the hierarchical path to "existingxsd.xsd" in the result.

Issue arises when I run the same thing on Windows platform. The result 
on windows is /*"file:D:/workdloads/xsdcollection/existingxsd.xsd"*/ 
where /*public_cat.xml*/ exists @ 
/*"file:D:/workdloads/public_cat.xml"*/. Note the missing /*"/"*/ @ the 
starting of the result string /*"file:*///*D:/work..."*/. Though for 
human eyes this is very much valid, JAVA treats this path as relative 
path (an opaque URI). So, if I construct a new File object (/*File 
newFile = new File(new URI(result));*/) I will get the following exception:

/Exception in thread "main" java.lang.IllegalArgumentException: URI is 
not hierarchical
        at java.io.File.<init>(File.java:335)
        at javaapplication1.Main.main(Main.java:37)/

This exception occurs because of the missing /*"/"*/ @ the front.

So, I observe a difference in behavior between Windows and Unix. Is this 
observation intended behavior or is it a bug?

Any light on this would be really helpful.

Please reply to me directly.

Thanks much,

View raw message