Forum Discussion

TGupta's avatar
TGupta
New Contributor
17 years ago

2 data source - adding and deleting

Hi,
I am using two datasources, where i am adding a list in one, say "1,2,3,4,5", verifies in the wsdl and then deleting a couple of items, say "1,2,3" and verifying in the wsdl those items got deleted.  I created two datasources, with the following code
Add Lists:

def list = context.myList
if (list == null)
{
list = ["1", "2", "3", "4", "5"]
context.myList = list
}

if (!list.empty)
{
result.DeleteRList = list[0];
list.remove(0);
}

Delete List:

def list = context.myList
if (list == null)
{
list = ["1", "2", "3"]
context.myList = list
}

if (!list.empty)
{
result.DeleteRList = list[0];
list.remove(0);
}
But as I run my test, I keep getting a null pointer exception in DeleteList data source.  What am I doing wrong?

Thanks,
Tanvi