com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl.writeToString(Node) has code like this:
try {
// ...
} catch (RuntimeException e) {
// ...
throw new LSException(LSException.SERIALIZE_ERR, e.toString());
} catch (IOException ioe) {
// ...
throw new DOMException(DOMException.DOMSTRING_SIZE_ERR, msg);
}
If there is a failure from some implementation-internal code, the stack trace will be lost.
Observed because prepareForSerialization can throw NPE in
next = node.getNextSibling();
which I will report separately if I can figure out under which conditions it occurs.
Observed in JDK 5 but JDK 7 seems to still have the same code.