On network problems Freecol complains about an IllegalStateException in the receiving thread. See stack trace below. Apparently the Woodstox library does not support JDK 1.5. The Jdk14Impl class calls a method that fails on JDK 1.5 and the WstxIOException is converted into an IllegalStateException (loosing any
useful information in the process).
This is easy to fix. Simply catch the exception in Jdk14Impl.setInitCause:
public boolean setInitCause(Throwable newT, Throwable rootT) {
try {
newT.initCause(rootT);
} catch(IllegalStateException e) {
// This happens on JDK 1.5, ignore
}
return true;
}
An alternative is of course to add explicit support for JDK 1.5 and 1.6.
----------------
Exception in thread "ReceivingThread" java.lang.IllegalStateException:
Can't overwrite cause
at java.lang.Throwable.initCause(Throwable.java:320)
at com.ctc.wstx.compat.Jdk14Impl.setInitCause(Jdk14Impl.java:70)
at com.ctc.wstx.exc.WstxException.<init>(WstxException.java:46)
at com.ctc.wstx.exc.WstxIOException.<init>(WstxIOException.java:16)
at
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:589)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:604)
at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.j
ava:305)
at
net.sf.freecol.common.networking.ReceivingThread.listen(ReceivingThread.jav
a:193)
at
net.sf.freecol.common.networking.ReceivingThread.run(ReceivingThread.java:1
22)
As to JDK 1.5 support: actually, it is fully supported. 1.5 is the main development platform. But I have never seen this particular problem before. It should be easy to fix: but I'd prefer not trying to catch an exception, but rather prevent it from occuring. It's not quite clear where an already chained exception is being relinked, perhaps it's just a simple mixup with arguments.
Anyway, I'll definitely resolve this one way or another.