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

StackOverflowError in SetUniqueList.add() when it receives itself

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 3.2.2
    • 4.3
    • Collection
    • None
    • 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

              Unassigned Unassigned
              shong03 Shin Hong
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: