cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject URL Bug
Date Wed, 11 Jul 2001 18:44:25 GMT
I found out while debugging the XIncludeTransformer that the construct

new URL(baseUrl, relative);

does not return the expected results--esp. when dealing with "file"
URLs.

if your baseUrl variable is set to "file:C:\pat\to\context\" (what happens
when you transform a "context" url through the factory first), when you
try to get a relative URL to that one you lose everything about the base
URL.

------------------- Example --------------------

URL baseUrl = new URL("file:C:\\path\\to\\context\\");
String relative = "index.xml";

URL newUrl = new URL(baseUrl, relative);

System.out.println(newUrl.toExternalForm());

------------------- Results --------------------

file:index.xml

--------------- Expected Results ---------------

file:C:\path\to\context\index.xml

--------------------- End ----------------------


I fixed the URLFactoryImpl class to work around this
with "file" protocol URLs.  This way the XIncludeTransformer
can work as expected.  I assume this is a bug in Sun's JVM,
but I am not the only one bitten by it.

Does anyone else have input on this?

IMPORTANT
Please note that the XIncludeTransformer's namespace has been
upgraded to the currently released spec as well.
Mime
View raw message