DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23479>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23479

Filenames with spaces in versions later than 2.0.2 (incl).





------- Additional Comments From [EMAIL PROTECTED]  2003-09-29 15:28 -------
I'm afraid examples are not that informative... The code, cutting away some 
extraneous declarations and comments, originally read:  

        // this is org.apache.xerces.parsers.DOMParser
        DOMParser parser = new DOMParser(); 
        // implementation of org.xml.sax.ErrorHandler
        ParserErrorHandler peh = new ParserErrorHandler(f);
        parser.setErrorHandler(peh);
        String fn;
        try {
            fn = f.toURL().toString();
        }
        catch (MalformedURLException e) {
            [snipped exception handlers]
        }
        // --- parse ---
        try {
            parser.parse(fn);
        }
        [snipped exception handlers]

I later modified this crudely to escape spaces, by adding after the URL 
conversion: (Sadly no regex with JDK 1.3...)

            StringBuffer sb = new StringBuffer();
            char c;
            for (int fi = 0; fi < fn.length(); fi++) {
                c = fn.charAt(fi);
                if (c == ' ') {
                    sb.append("%20");
                } else {
                    sb.append(c);
                }
            }
            fn = sb.toString();

and I also tried using f.getAbsolutePath() for fn instead of converting it to 
an URL. Both the URL call (at least without %20 instead of the spaces) and the 
last approach work with 2.0.0, but not 2.0.2, 2.1.0 or 2.5.0. So I doubt that 
it is related to escaping of literals. 

Filenames are of the form 'Genesis 20030903 160537.xml' and the directory names 
have the normal UNIX form '/users/robotdata/xml/input/' etc. The XML files are 
correctly processed if the spaces are replaced by dashes, so this seems to be 
the only problem. The error thrown by parse() is 
java.io.FileNotFoundException... Although the files exist, and do return true 
on a call of exists(). (I don't yet have a stack trace that extends into the 
Xerces code.)

Is it possible that the problem is related to the JDK version? I always have to 
recompile the more recent Xerces2-J versions with the older JDKs, because 
Oracle rejects some of the opcodes in the binaries. (Incidentally, the 
apache.org download site ought to indicate which JDK the binaries are compiled 
against.)

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

Reply via email to