To all the baseX team,
First of all I would like to thank you for the great tool you made. We use it almost every day in our team. One member had actually developed a pluggin for xml validation some years ago.
To the bug trackers,
I would like to report a strange behaviour regarding the IOFile class, using baseX702 jar file, eclipse indigo, along with JDK 1.7.0_01
When trying to execute the CreateDB command to build a local baseX database from a distant file (say fileInputPath = “//filer/distant/file.xml”), when you proceed with the static method by doing:
BufferedInputStream bis = new
BufferedInputStream(new
FileInputStream( fileInputPath));
SAXSource saxSource = new
SAXSource(new InputSource(bis));
SAXWrapper saxWrapper = new
SAXWrapper(saxSource, context.prop);
CreateDB.create(dbName,
saxWrapper, context);
Everything works fine.
BUT, when you try to do the same using the non static method, by doing (which I need because I have to report the progress of the create command in a JProgressBar):
create = new
CreateDB(dbName, fileInputPath);
create.execute(context);
You get the following exception:
org.basex.core.BaseXException: "filer/distant/file.xml ": (here
the path where the command is run)/filer/distant/file.xml
(unknown path or something like that (in French it’s :”le
chemin d’accès spécifié est introuvable”)).
After some bug tracking, it appears that in the function create, in static class PathList, inside the IOFile class, there is a mistreatment of the path, here is the function:
static class PathList extends StringList {
/**
* Creates a path.
* @param path input path
* @return path
*/
String create(final String path) {
final TokenBuilder tb = new TokenBuilder();
final int l = path.length();
for(int i = 0; i < l; ++i) {
final char ch = path.charAt(i);
if(ch == '\\' || ch == '/') add(tb);
else tb.add(ch);
}
add(tb);
for(int s = 0; s < size; ++s) {
// if(s == 0 && (path.startsWith("\\\\") || path.startsWith("//"))) tb.add("//"); // this is my current “hack” to resolve the problem)
if(s != 0 || path.startsWith("/")) tb.add('/');
tb.add(list[s]);
}
return tb.toString();
}
If I don’t uncomment my line, I get the error described above, because the TokenBuilder remove the first two ‘/’ from the path it builds.
What I have done to solve the problem, is to make a local copy of IOFile + CreateDB, and I have added the line commented, to add the leading ‘//’ in front of remote file access. This workaround works well for my project, but it is not convenient for me,
as I would like to get the new versions of baseX.
Could you please find a way to resolve this problem, I don’t know if it is intentional, or even if I’m using it the right way.
Again thank you for your professional quality software. I’m waiting forward to have news from you.
Guilhem VORS
iSLM Business Solution Integration
AIRBUS CIMPA SAS
Phone : +33 (0) 5 61 53 50 28
Fax : +33 (0) 5 67 19 95 52
E-mail : guilhem.vors@airbus.com