Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-701

StackOverflowError in SetUniqueList.add() when it receives itself

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.2.2
    • Fix Version/s: 4.3
    • Component/s: Collection
    • Labels:
      None
    • Flags:
      Important

      Description

      Hi.

      We found that the following test case fails with a StackOverFlowError exception:

      test() {        
         SetUniqueList l = new SetUniqueList(new LinkedList<Object>()) ;        
         l.add((Object) l) ;    
      }

      The add() execution traps into an infinite recursion which crashes the program.

      From the stack trace, we found that the infinite recursion occurs

      at AbstractList.hashCode() since it invokes hashCode() of each of its elements.

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                shong03 Shin Hong
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: