myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Kitching (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (MYFACES-777) AddResource uses static StringBuffer ADDITIONAL_JAVASCRIPT_TO_BODY_TAG for per-request data
Date Thu, 03 Nov 2005 03:14:55 GMT
AddResource uses static StringBuffer ADDITIONAL_JAVASCRIPT_TO_BODY_TAG for per-request data
-------------------------------------------------------------------------------------------

         Key: MYFACES-777
         URL: http://issues.apache.org/jira/browse/MYFACES-777
     Project: MyFaces
        Type: Bug
    Reporter: Simon Kitching


The AddResource class has "getInstance" methods that return an instance of the class. However
a single instance is shared across all threads servicing the same webapp (ie which have the
same contextPath).

A member
    private static StringBuffer ADDITIONAL_JAVASCRIPT_TO_BODY_TAG = null;
Is used to store per-request data by the method:
    addJavaScriptToBodyTag

This is quite unsafe; multiple threads will interfere with the "body tag" text from other
requests.

In addition, the all-caps style of variable naming implies that this member was meant to be
a constant rather than a variable buffer.
I believe this member should be a private static final String, holding a key which is used
to look up a StringBuffer in the current request params,
and that the "body tag" text should be stored in that buffer from the request params rather
than stored directly on the AddResource class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message