DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=29428>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=29428 Digester does not keep "root" variable in sync... ------- Additional Comments From [EMAIL PROTECTED] 2004-06-08 10:14 ------- My implementation of the getRoot() method takes the empty stack into account. Here's the method... public Object getRoot() { return stack.isEmpty() ? null : stack.peek( stack.size() - 1 ); } Why would we deprecate the clear() method rather than make it work properly if we can? The intention of the getRoot() method is to return the first object on the stack or null if the stack is empty, right? That's what it does, now. I don't see the harm in removing the root variable and replacing the references with a call to getRoot() instead (which is what I did). I would strongly suggest you add this patch regardless of what you do to the clear() method. This implementation is far less prone for errors. Re-using a Digester is desirable because it can take quite some time to set up a Digester object for parsing. The desire to re-use a Digester object came from a post on the user list (http://www.mail-archive.com/commons- [EMAIL PROTECTED]/msg06397.html). BTW, your implementation of testGetRoot() causes an error because the ObjectCreateRule automatically calls pop() during the end() method, so there will be nothing on the stack. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]