I don't think you are right. A new markup parser is create for each
markup file and each markup parser gets a new instance of
PrependContextPathHandler. Looks fine to me.

Juergen

On 4/25/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
I don't think I undestand the issue...

Eelco

On 4/25/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> ---------- Forwarded message ----------
> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Apr 25, 2007 5:37 AM
> Subject: MarkupParserFactory
> To: [EMAIL PROTECTED]
>
> Hello!
>
> I think you have a little bug in the class MarkupParserFactory.
> There is only one instance of PrependContextPathHandler and it is used in
> all instances of MarkupParser.
> Since the data source is stored in the "parent" field of the
> PrependContextPathHandler instance,
> all concurrently running parsers use the same data.
> The correct MarkupParserFactory should look like this:
>
> /**
> * Markup Factory.
> */
> public class Le3MarkupParserFactory implements IMarkupParserFactory
> {
>
>     /**
>      * Application.
>      */
>     private Application application;
>
>     /**
>      * Initialization.
>      */
>     public MarkupParserFactory(Application application)
>     {
>         this.application = application;
>     }
>
>     /**
>      * Gets application.
>      */
>     public final Application getApplication()
>     {
>         return application;
>     }
>
>     /**
>      * Appends additional filters.
>      * Override in descendants and call super to append more filters if
> desired.
>      * To append a filter call parser.appendMarkupFilter() method.
>      * @param parser Parser to append filters to.
>      */
>     protected void appendMarkupFilters(MarkupParser parser)
>     {
>         parser.appendMarkupFilter(new
> PrependContextPathHandler(getApplication()));
>     }
>
>     /**
>      * See ancestor.
>      */
>     public MarkupParser newMarkupParser()
>     {
>         final MarkupParser parser = new MarkupParser(new XmlPullParser())
>         {
>             public void initFilterChain()
>             {
>                 appendMarkupFilters(this);
>             }
>         };
>         return parser;
>     }
>
> }
>
>
> Have a nice day.
> Petr Slechta
>
> Petr Šlechta
> Programmer
>
> TietoEnator
> Telecom & Media
> Direct +420 386 102 534
> Mobile
> Fax +420 387 312 877
> E-mail mailto:[EMAIL PROTECTED]
> Vrchlického nábřeží 1388
> CZ-370 01 České Budějovice
> http://www.tietoenator.cz
>

Reply via email to