Table Reference Null even though can add items

I have a table on the screen and doing this to populate it.

logger.debug("extUserTable = " + extUserTable);

[/b].addItem(new Object { ActionLayout.buildActionLayout(ub.getLoginId(), appContextHelper,
, false, false),
ub.getEmailAddress()}, ub.getLoginId());

Note that I’m passing a reference to the table in the 1st property so I can update the item later on. The table shows up fine, however, the reference to it is always null. The debug statement will always show null and so will later accesses. Yet the addItem part works fine. I tried to use the attach() method with the same result. What am I missing?

Thank you for your help


You are not logging the reference to the table, but the value of toString(), which in your case is probably the value of the table (the itemId of the selected row) - in your case ‘null’ because nothing is selected.

Never trust toString() to return the object id - it can return anything.

Best Regards,


thank you for your reply. It may be true regarding the toString() in this particular case. However, my problem is that when I try to access that table reference later on in order to update some data it throws a null pointer exception.

in other words, changing the log statement to
logger.debug("tabletoUpdate " + tabletoUpdate + " tabletoUpdate==null?yes:no = " + (tabletoUpdate==null?“yes”:“no”));
returns a “yes” so it looks like a true null.



Well, you can not possibly call
without causing a NPE if
, so in that case there is something missing from your description of the situation. I’m afraid I can not help without a more complete example then - except saying that if the ‘reference’ is non-null at this point, and null later on, then just don’t set it to null in between :wink:

// Marc

Mark, as silly as it sounds you were right. I was not initializing a parameter in the constructor.
Thanks for your help!