commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject [digester] clear method
Date Tue, 08 Jun 2004 08:31:00 GMT
Hi,

I have just made this commit:

On Tue, 2004-06-08 at 20:26, skitching@apache.org wrote:
> skitching    2004/06/08 01:26:10
> 
>   Modified:    digester/src/java/org/apache/commons/digester Digester.java
>   Log:
>   Added javadoc to clear method about it being unsuitable for resetting
>   Digester for reuse.
>   
>   Revision  Changes    Path
>   1.104     +6 -1      jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java
>   
>   Index: Digester.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
>   retrieving revision 1.103
>   retrieving revision 1.104
>   diff -u -r1.103 -r1.104
>   --- Digester.java	10 May 2004 07:15:20 -0000	1.103
>   +++ Digester.java	8 Jun 2004 08:26:10 -0000	1.104
>   @@ -2404,6 +2404,11 @@
>    
>        /**
>         * Clear the current contents of the object stack.
>   +     * <p>
>   +     * Calling this method <i>might</i> allow another document of the
same type
>   +     * to be correctly parsed. However this method was not intended for this 
>   +     * purpose. In general, a separate Digester object should be created for
>   +     * each document to be parsed.
>         */
>        public void clear() {

Does anyone remember what the original purpose of the clear method was?
The comment "clear the current contents of the object stack" explains
*what* it is doing, but not why this would be useful.

This method is called automatically at the end of parse(). 

It was present in basically its current form in version 1.1 of this
file, so there's no clues in the CVS log about why it does what it does,
and why it is public.

Resetting a Digester instance to a state where it can safely parse
another input document is rather a tricky and fragile thing to do I
believe; I had a go, and didn't feel at all happy about the code that
was necessary so abandoned the attempt and just added the above comment.

Thanks,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message