[JIRA] Created: (STS-725) MockRoundTrip never destroys filters and dispatcher servlet

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[JIRA] Created: (STS-725) MockRoundTrip never destroys filters and dispatcher servlet

JIRA jira@stripesframework.org
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.
-
If you think it was sent incorrectly contact one of the administrators: http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

[JIRA] Commented: (STS-725) MockRoundTrip never destroys filters and dispatcher servlet

JIRA jira@stripesframework.org

    [ 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

[JIRA] Resolved: (STS-725) MockRoundTrip never destroys filters and dispatcher servlet

JIRA jira@stripesframework.org
In reply to this post by JIRA jira@stripesframework.org

     [ http://www.stripesframework.org/jira/browse/STS-725?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remi VANKEISBELCK resolved STS-725.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: Release 1.6
                   Release 1.5.8

fixed in r1521. Listeners + close().

> 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
>             Fix For: Release 1.5.8, Release 1.6
>
>
> 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

       

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development