[jira] [Created] (LANG-1322) ToStringStyle should not use WeakHashMap as registry

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jira] [Created] (LANG-1322) ToStringStyle should not use WeakHashMap as registry

JIRA jira@apache.org
Michael Illgner created LANG-1322:
-------------------------------------

             Summary: ToStringStyle should not use WeakHashMap as registry
                 Key: LANG-1322
                 URL: https://issues.apache.org/jira/browse/LANG-1322
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.builder.*
    Affects Versions: 3.5
            Reporter: Michael Illgner


org.apache.commons.lang3.builderToStringStyle uses a WeakHashMap as REGISTRY to detect that an object was already added to the StringBuilder to avoid recursion for cyclic object graphs. This is used by RecursiveToStringStyle.
In a low memory situation when the garbage collector starts, the WeakHashMap is cleared and some parts of the potentially cyclic object graph will be logged again.
We run in this problem, when we accidentally logged an HttpServletRequest and a HttpSession using a ReflectiontoStringBuilder  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Loading...