#181 generate-id() stack overflow with DOM/JDOM wrapper

v7.8
closed
5
2014-08-11
2004-01-11
Michael Kay
No

When the generate-id() function is called on a node
that is part of a tree implemented over DOM or JDOM (as
distinct from a native Saxon tree), an infinite
recursion occurs, leading to a stack overflow.

Fix: change the routine getSequentialKey in
net.sf.saxon.om.Navigator to read:

public static String

getSequentialKey(SiblingCountingNode node) {
StringBuffer key = new StringBuffer();
while(!(node instanceof DocumentInfo)) {
key.insert(0,
alphaKey(node.getSiblingPosition()));
node = (SiblingCountingNode)node.getParent();
}
key.insert(0, "w" +
((DocumentInfo)node).getDocumentNumber());
return key.toString().intern();
}

Reported by Marek Koziol [marek@freerun.com]

Test cases added: axes-dom062, axes-jdom062

Discussion