Hi Andreas,
>> The field in question is infact initialized in
>> Servlet#init(ServletConfig servletConfig). This should be a common
>> pattern in many servlets and the container would dispatch requests to
>> the servlet only after init.
>> How do I convince FindBugs to not worry about this?
> just wildly guessing (I currently don't have any FindBugs installation
> at hand to check against):
>
> The description of MSF_MUTABLE_SERVLET_FIELD says:
>
> "A web server generally only creates one instance of servlet or jsp
> class (i.e., treats the class as a Singleton), and will have multiple
> threads invoke methods on that instance to service multiple
> simultaneous requests. Thus, having a mutable instance field generally
> creates race conditions."
>
> Would it be possible to make your field a *static* variable of your
> Servlet class instead of an instance variable and thereby signal to
> FindBugs that you take care of the fact that it will not create a race
> condition?
>
No, the value is associated with an instance and computed from
ServletConfig. I could have synchronized, But I feel its not warranted
for this case.
If you agree, can this be added to exclusion list.
thanks,
Rama Pulavarthi
> HTH & best regards,
>
> Andreas
>