You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jean-Francois Arcand <Je...@Sun.COM> on 2005/02/24 21:07:05 UTC

bug 33463: realy fixed?

Hi,

I've just wrote a unit test to verify this bug has fixed 
(http://issues.apache.org/bugzilla/show_bug.cgi?id=33463). But looking 
at the code in StandardContext:

>    4276             // Stop our application listeners
>    4277             listenerStop();
>    4278
>    4279             // Clear all application-originated servlet context attribut        es
>    4280             if (context != null)
>    4281                 context.clearAttributes();

I doubt it will works since in listenerStop, we set all the listeners to 
null:

>    3711         setApplicationEventListeners(null);
>    3712         setApplicationLifecycleListeners(null);
>    3713
>    3714         return (ok);

So when we call clearAttributes in ApplicationContext:

>     691         // Notify interested application event listeners
>     692         Object listeners[] = context.getApplicationEventListeners();
>     693         if ((listeners == null) || (listeners.length == 0))
>     694             return;
>     695         ServletContextAttributeEvent event =
>     696           new ServletContextAttributeEvent(context.getServletContext(),
>     697                                             name, value);
>  

The listeners[] are always null. Should the clearAttributes be called 
before? It was like that before but I don't understand why we moved the 
call after listenerStop().

Also, there is a couple of Catalina's private attributes available to 
the listener that should'nt be in StandardContext:

>    4072         // We put the resources into the servlet context
>    4073         if (ok)
>    4074             getServletContext().setAttribute
>    4075                 (Globals.RESOURCES_ATTR, getResources());

Should we add:

context.setAttributeReadOnly(Globals.RESOURCES_ATTR);

so this way the listener doesn't get notified with those read only 
attribute?

Thanks

-- Jeanfrancois






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


Re: bug 33463: realy fixed?

Posted by Remy Maucherat <re...@apache.org>.
Jean-Francois Arcand wrote:
> Hi,
> 
> I've just wrote a unit test to verify this bug has fixed 
> (http://issues.apache.org/bugzilla/show_bug.cgi?id=33463). But looking 
> at the code in StandardContext:
> 
>>    4276             // Stop our application listeners
>>    4277             listenerStop();
>>    4278
>>    4279             // Clear all application-originated servlet 
>> context attribut        es
>>    4280             if (context != null)
>>    4281                 context.clearAttributes();
> 
> 
> I doubt it will works since in listenerStop, we set all the listeners to 
> null:
> 
>>    3711         setApplicationEventListeners(null);
>>    3712         setApplicationLifecycleListeners(null);
>>    3713
>>    3714         return (ok);
> 
> 
> So when we call clearAttributes in ApplicationContext:
> 
>>     691         // Notify interested application event listeners
>>     692         Object listeners[] = 
>> context.getApplicationEventListeners();
>>     693         if ((listeners == null) || (listeners.length == 0))
>>     694             return;
>>     695         ServletContextAttributeEvent event =
>>     696           new 
>> ServletContextAttributeEvent(context.getServletContext(),
>>     697                                             name, value);
>>  
> 
> 
> The listeners[] are always null. Should the clearAttributes be called 
> before? It was like that before but I don't understand why we moved the 
> call after listenerStop().

Yes, it is fixed. The bug is that the attributes were cleared before 
destroy was called.

No attribute listner should to be called on stop, and the original bug 
was actually invalid.

> Also, there is a couple of Catalina's private attributes available to 
> the listener that should'nt be in StandardContext:
> 
>>    4072         // We put the resources into the servlet context
>>    4073         if (ok)
>>    4074             getServletContext().setAttribute
>>    4075                 (Globals.RESOURCES_ATTR, getResources());
> 
> 
> Should we add:
> 
> context.setAttributeReadOnly(Globals.RESOURCES_ATTR);
> 
> so this way the listener doesn't get notified with those read only 
> attribute?

I don't see the attribute replaced events as an issue, personally.

Rémy

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