Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic JPlanner BaseList.remove fails to check presence of item to be removed (Read 1671 times)
bas_pharmapartners
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Aug 31st, 2022
JPlanner BaseList.remove fails to check presence of item to be removed
Aug 31st, 2022 at 4:31pm
Print Post  
Observed location of bug:
com.mindfusion.common.BaseList.remove(Object)

Condition for reproduction:
List does not contain the element to be removed.

Observed behavior:
Method throws java.lang.ArrayIndexOutOfBoundsException.

Specified behavior (per java.util.Collection.remove(Object)):
Method returns false.

Tested with:
JPlanner 2.1.3

Stacktrace:
java.lang.ArrayIndexOutOfBoundsException: -1
     at java.util.ArrayList.elementData(ArrayList.java:424)
     at java.util.ArrayList.remove(ArrayList.java:501)
     at com.mindfusion.common.BaseList.doRemove(Unknown Source)
     at com.mindfusion.common.BaseList.remove(Unknown Source)

Reproducing unittest:
Code (Java)
Select All
import static org.junit.Assert.assertFalse;

import com.mindfusion.common.BaseList;
import org.junit.Test;

public class BaseListTest {

    BaseList<Object> sut = new BaseList<Object>() {
        //
    };

    @Test
    public void test() {
        // Given
        final Object o = new Object();

        // When
        final boolean actual = sut.remove(o);

        // Then
        assertFalse(actual);
    }

}
 

  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: JPlanner BaseList.remove fails to check presence of item to be removed
Reply #1 - Sep 2nd, 2022 at 8:19am
Print Post  
New build here will return false -
https://mindfusion.eu/Forum/YaBB.pl?num=1660408551

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint