DynamicMappingFilter may create multiple instances of StripesFilter
-------------------------------------------------------------------

                 Key: STS-843
                 URL: http://www.stripesframework.org/jira/browse/STS-843
             Project: Stripes
          Issue Type: Bug
    Affects Versions: Release 1.5.6
         Environment: Tomcat 5.5, Java 1.6, Stripes 1.5.6
            Reporter: Peter Štibraný


Our web.xml does NOT have StripesFilter, but it does have DynamicMappingFilter 
(DMF) with configuration for StripesFilter.

When DMF finds that there is no StripesFilter in servlet context, it tries to 
create its own:


            // Get a reference to a StripesFilter instance
            StripesFilter sf = getStripesFilter();
            if (sf == null) {
                initStripesFilter((HttpServletRequest) request, wrapper);
                sf = getStripesFilter();
            }

Problem may occur when multiple threads execute this code at once. They all 
find that getStripesFilter() returns null, and go ahead to initStripesFilter(). 
This method is synchronized, but it doesn't check if filter wasn't already 
created by other thread. So it happily creates new StripesFilter, possibly for 
second or third time :-( This later causes problem in 
StripesFilter.getConfiguration() method when called outside of stripes-action. 
Stripes.getConfiguration() if there is only single configuration, and if it 
finds multiple configs, it throws exception :-(

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

       

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to