Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1322

ToStringStyle should not use WeakHashMap as registry

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5
    • None
    • lang.builder.*
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            fillg1 Michael Illgner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: