cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claude Warren <cla...@histio.org>
Subject XInclude Problem? -w- Patch
Date Wed, 08 Nov 2000 20:19:07 GMT
I am using Red Hat Linux 6.2, IBM jdk 1.1.8, and jserv.

I recently sent Robin a patch for the
org.apache.cocoon.Utils.getRootpath() to work with this configuration.
I hope that patch made its way to this list, if not I will post it.

I now beleive that there is a problem in
org.apache.cocoon.processor.XIncludeProcessor$XincludeProcessorWorker.processXIncludeElement()
in the block that reads:

   } else if (xinclude.href.charAt(0) == '/') {
    /** local absolute URI, e.g. /foo.xml **/
    local = new File(Utils.getRootpath(request,context),xinclude.href);
    system_id = ((File)local).getAbsolutePath();
    content = new FileReader((File)local);

Utils.getRootPath() returns a string of the form "/dir1/dir2"
include.href is a string of the form "/dir3/dir4/file.xml"

The File constructor attempts to put these together (as per the
documentation) "/dir1/dir2"+"/"+"/dir3/dir4/file.xml"  resulting in the
incorrect string "/dir1/dir2//dir3/dir4/file.xml".  At least that is
what happens on my system.

My question is:  "Has anybody else encounterd this problem?"

I believe the correct code should be:

   } else if (xinclude.href.charAt(0) == '/') {
    /** local absolute URI, e.g. /foo.xml **/
    local = new File( Utils.getRootpath(request,context)+xinclude.href
);
    system_id = ((File)local).getAbsolutePath();
    content = new FileReader((File)local);

Note the "+" in the File constructor rather than the "," in the original
implementation.

Claude



Mime
View raw message