You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Neale Swinnerton <ne...@isismanor.com> on 2003/05/22 17:57:52 UTC

Why is Digester.configure() called multiple times during parse()?

Hi,

I'm new to Digester and have been caught out by the following.

I subclassed Digester, overriding the configure() method. After some
puzzling results I discovered that my configure() method was called
twice, meaning I had two of each of my rules, making my object graph 2x
deeper than it should have been.

On investigation of the source, I see that the Digester holds a
configure flag that is checked in the configure() method. I needed to
add a similar 

  if(configured) {
   ...
  }

to my code.The existing javadoc incorrectly state that by default the
configure() method does nothing.

SO: Is there any reason why the subclass-er can't be protected from this
mistake. I've attached a patch, with an initialise() method that does
the check and calls the configure() method as appropriate, alternatively
the javadoc comments could be updated to stop idiots like me making this
mistake :-)

regards


Neale Swinnerton

[digester] Re: Why is Digester.configure() called multiple times during parse()?

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi neale

could you please remember to prefix with the name of the component when 
posting to this list. (most developers and committers use email filters.)

thanks for the accurate report. i haven't committed your suggestion (it 
would have introduced a slight change to the configure method symantics) 
but i have committed something very similar (configure calls initialize 
rather than the other way round) and i've improved the java docs.

- robert

On Thursday, May 22, 2003, at 04:57 PM, Neale Swinnerton wrote:

> Hi,
>
> I'm new to Digester and have been caught out by the following.
>
> I subclassed Digester, overriding the configure() method. After some
> puzzling results I discovered that my configure() method was called
> twice, meaning I had two of each of my rules, making my object graph 2x
> deeper than it should have been.
>
> On investigation of the source, I see that the Digester holds a
> configure flag that is checked in the configure() method. I needed to
> add a similar
>
>   if(configured) {
>    ...
>   }
>
> to my code.The existing javadoc incorrectly state that by default the
> configure() method does nothing.
>
> SO: Is there any reason why the subclass-er can't be protected from this
> mistake. I've attached a patch, with an initialise() method that does
> the check and calls the configure() method as appropriate, alternatively
> the javadoc comments could be updated to stop idiots like me making this
> mistake :-)
>
> regards
>
>
> Neale Swinnerton
>  ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


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