Updating an Indexed Container...

I have a Timeline Graph object which contains an indexed BeanItemContainer. Works great. However, I would like to be able to ‘invert’ the graph by multiplying all the data values by (-1). When I do that, I get null pointer exceptions trying to access the container. So I’m managing the data incorrectly. Can someone tell me what I’m doing wrong?

The following code fails:

BeanItemContainer bic = (BeanItemContainer) getMyDataContainer();

for(int i = 0; i < bic.size(); i++){ // *** This for-loop completes successfully - or at least it doesn’t crash
oid = bic.getIdByIndex(i);
rawDataObj = bic.getItem(oid).getBean();
d = rawDataObj.getMyDataValue() * (-1);
rawDataObj.setMyDataValue(d);
}

// This then fails…
for(int i = 0; i < 10; i++){
oid = bic.getIdByIndex(i);
rawDataObj = bic.getItem(oid).getBean();
Logger.info("Data value = " + rawDataObj.getMyDataValue());
}

The second loop fails on the first iteration of rawDataObj = bic.getItem(oid).getBean();

I’m assuming the oid comes back null - but I will break that statement down and figure out if that is true or if the getBean() call is failing

So what am I doing wrong? How do I change values of existing data points?

Side note - I also tried for-loops like:
for(Object oid = bic.firstItemId(); oid != null; oid = bic.nextItemId(oid)){
rawDataObj = bic.getItem(oid).getBean();
etc. etc.

and it appears to fail the same way - works the first time through and fails on the second pass…

thanks,

nbc