commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: [digester] Can rules be re-used?
Date Wed, 19 Jan 2005 05:48:05 GMT
On Wed, 2005-01-19 at 10:52 +0900, Bill Keese wrote:
> >But Rules aren't "read-only" objects. They are objects whose begin, body
> >and end methods perform real work...
> >  CallMethodRule: modifies "bodyText" member.
> >...
> >Simon
> >  
> >
> Ah, I see. But then what if a Rule matches recursively? Ie,
> 
> <foo>
> hello world
> <foo>
> other body text
> </foo>
> </foo>
> 
> If there is only one Rule to process <foo> elements (matching pattern
> */foo), won't bodyText get mangled?

For those which have a Stack member: no. This will work fine
"recursively", but will fail in multi-threaded environments.

For those which just have a single String member: yes, they will fail in
a "recursive" setup, even without multiple threads. Ideally these
classes should be fixed; patches are very welcome. Note, however, that
these classes *will* work fine unless used recursively (which isn't very
common), and even when failing will fail predictably, unlike
non-thread-safe classes in a threaded environment.

CallMethodRule actually has worse problems in recursive situations than
the one described; the matching of call-param rules -> call-method rules
can get completely tangled. However in practice it isn't a major issue.
Hopefully digester 2.0 will resolve this anyway.

Regards,

Simon




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


Mime
View raw message