Details
Description
The following binding
<?xml version='1.0' encoding='UTF-8'?>
<binding>
<include path="contact/Contact.jibx.xml"/>
<mapping name="customer" class="Customer">
<structure field="contact"/>
</mapping>
</binding>
Produces the following error:
Using bindings:
config/Customer.jibx.xml
Running binding compiler version jibx-rc0
java.net.UnknownHostException: C
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
at java.net.Socket.connect(Socket.java:452)
...
at java.net.URL.openStream(URL.java:913)
...
at org.jibx.binding.Utility.loadFileBinding(Utility.java:389)
at org.jibx.binding.Compile.compile(Compile.java:294)
at org.jibx.binding.Compile.main(Compile.java:382)
The problem seems to be the way the base url is constructed, in
Utility.java:389
return loadBinding(fname, sname, new FileInputStream(file), new
URL("file://" + file.getAbsolutePath()), valid);
the resulting url “file://C:/xxx” appears to be
badly escaped, resulting in incorrect URL.
The following change seems to work
return loadBinding(fname, sname, new FileInputStream(file),
file.toURL(), valid);
Should be good now. Note, though, that to use a full Windows path (including the funky leading "A:" format) you need to have a leading "/" or "file:/". I'll add this to the documentation.