cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerard van Enk" <gerard.van....@eo.nl>
Subject Problem StyleBook and Linux solved?????
Date Tue, 04 Jan 2000 09:43:03 GMT
Hello,

I think I discovered what caused the problem with stylebook on a Linux box.
The problem was that it didn't work 8-( . When I tried the examples in de
doc-directory I got the following errormessage:

<skip/>
[XalanProcessor] Applying XSL sheet
"sbk:/style/stylesheets/book2project.xsl"
org.apache.stylebook.CreationException: sbk:/style/resources/
(/home/gerard/xml/xml-stylebook/home/gerard/xml/xml-stylebook/styles/apachex
ml/resources)
is not a Directory
<skip/>

The problem is caused by this part of the Directory producer
(DirectoryProducer.java):

if (source.getProtocol().equals("file")) {
    // Trim the file name and open the directory
    String src=source.getFile();
    for(int x=0;x<src.length();x++) if (src.charAt(x)!='/') {
        src=src.substring(x);
        break;
    }

On a linuxbox 'src' becomes something like:
'/home/apache/xml/xml-stylebook/styles/apachexml/resources/' after the
'String src=source.getFile()'-statement. If you trim the file name it
becomes a relative path (because the '/' is removed) and you get the
errormessage when it tries to open this directory.

On a winbox src becomes somtheing like:
'/D:/apache/xml/xml-stylebook/styles/apachexml/resources/' after the 'String
src=source.getFile()'-statement. If you trim the filename everything works
just fine.

I removed the following lines from directory-producer:

    for(int x=0;x<src.length();x++) if (src.charAt(x)!='/') {
        src=src.substring(x);
        break;
    }

And......everything works, on a linux box, on a Win98 box and on a Winnt
box. I think 'File file=new File(src).getCanonicalFile();' ignores the '/'
before d:/ because after this statement file.toString() gives:
'D:\apache\xml\xml-stylebook\styles\apachexml\resources' on a Win98 box.

Is this a right solution or are there new problems introduced by this???
Maybe someone can test it, Pier???

Gerard


Mime
View raw message