[ 
http://www.stripesframework.org/jira/browse/STS-725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12178#comment-12178
 ] 

Marcus Kraßmann commented on STS-725:
-------------------------------------

STS-494 seems to have a similar problem. The proposed patch adds at least a 
"removeFilters()" metjhod that also destroys all registered filters before 
removing them. Your proposed destroy() method could then act as a fascade that 
removes all filters and listeners.

> MockRoundTrip never destroys filters and dispatcher servlet
> -----------------------------------------------------------
>
>                 Key: STS-725
>                 URL: http://www.stripesframework.org/jira/browse/STS-725
>             Project: Stripes
>          Issue Type: Bug
>    Affects Versions: Release 1.6
>         Environment: Linux Ubuntu 9.10 64bits
> java version "1.6.0_07"
> Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
> Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)
>            Reporter: Remi VANKEISBELCK
>            Assignee: Remi VANKEISBELCK
>            Priority: Trivial
>
> MockRoundTrip can't be "closed" or "destroyed". 
> Thereby, registered filters and dispatcher servlet are never destroyed 
> either, and this causes problems with StripesFilter.getConfiguration().
> StripesFilter internally stores refs to configurations as WeakReferences, and 
> tries to clean them when you ask for a Configuration (see StripesFilter, line 
> 150). But as WeakRefs are not really predictable, you can have more than 1 
> config in the static "configurations" field, which eventually prevents from 
> getting the Configuration using StripesFilter.getConfiguration().
> The following test currently fails :
> public void testGetStripesConfigTwice() {
>     int count = 2;
>     for (int i=0; i<count ; i++) {
>       Map<String,String> params = new HashMap<String,String>();
>       params.put("ActionResolver.Packages", "foo.bar");
>       MockServletContext mockServletContext = new 
> MockServletContext("FacetedResolverTest");
>       mockServletContext.addFilter(StripesFilter.class, "StripesFilter", 
> params);
>       Configuration config = StripesFilter.getConfiguration();
>       assertNotNull(config);
> /*
>       for (Filter f : mockServletContext.getFilters()) {
>         f.destroy();
>       }
> */
>     }
>   }
>  
> but it passed when you set count to 1, or if you manually destroy all 
> registered filters (see commented code).
> A "MockServletContext.destroy()" method would be appreciated.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to