[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] [Created] (COLLECTIONS-701) SetUniqueList.add() crashes due to infinite recursion when it rec
From:       "Shin Hong (JIRA)" <jira () apache ! org>
Date:       2018-10-31 12:39:01
Message-ID: JIRA.13195362.1540989515000.242781.1540989541264 () Atlassian ! JIRA
[Download RAW message or body]

Shin Hong created COLLECTIONS-701:
-------------------------------------

             Summary: SetUniqueList.add() crashes due to infinite recursion when it receives itself
                 Key: COLLECTIONS-701
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-701
             Project: Commons Collections
          Issue Type: Bug
          Components: Collection
    Affects Versions: 3.2.2
            Reporter: Shin Hong


Hi.

We found that the following test case  fails  with a StackOverFlowError exception:
{code:java}
test() {            
   SetUniqueList l = new SetUniqueList(new LinkedList<Object>()) ;            
   l.add((Object) l) ;      
}{code}
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.

  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic