From: Wolfgang M. <wol...@ex...> - 2005-02-17 19:26:14
|
> I hate nagging, but I took the latest snapshot from the site (2/2/2005) > and it did not include the fix. > > For your reference, the fix was adding the try/catch in... > > public Item nextItem() { > try { > Node currentNode = (Node) nodes.peek(); > nodes.pop(); > if (currentNode.hasRightChild()) { > Node tempNode = currentNode.rightChild; > do { > nodes.push(tempNode); > tempNode = tempNode.leftChild; > } while (tempNode != null); > } > return currentNode.getData(); > } > catch (java.util.EmptyStackException e) { > return null; > } > } Yes, sorry. The correct fix would be to check nodes.isEmpty() at the start of the method. By mistake I only added this to the next(), not to the nextItem() method. Wolfgang |