Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NPE in SelectionModel
NPE in SelectionModel [message #1264798] Wed, 05 March 2014 14:08 Go to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Hi Dirk,

with Bug 414548 the issue from of this topic was fixed. There is still a lot of optimism in the selectionmodel. (NPE if the result of
selectionLayer.getCellByPosition(columnPosition, rowPosition)
is null.)

Is that done intentionally? If there is no cell under these coordinates, there are no selected cells, one could argue.


Re: NPE in SelectionModel [message #1264822 is a reply to message #1264798] Wed, 05 March 2014 14:31 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
If there is no cell under these coordinates, there are no selected cells

That statement is correct. While working a lot with NatTable, doing really fancy stuff, whenever at that place a NPE was thrown, something else was wrong. Because the question for the selection state of a cell in the SelectionModel is typically only requested by the SelectionLayer. And it should never ask for the selection state of a cell that does not exist.

Is that done intentionally?

I don't think possible NPEs are implemented intentionally. But as I said, in my experience a NPE should not occur if not something else is wrong. And the wrong things mostly caused by wrong usage.

If you give me a valid use case why the null check should be performed, you create a ticket telling about it, I am willing to add the null check of course. Smile
Previous Topic:Adding filter to entire table like viewer filters in TreeViewer
Next Topic:Question for best practice concerning a custom selection strategy
Goto Forum:

Current Time: Fri Dec 06 16:40:53 GMT 2019

Powered by FUDForum. Page generated in 0.01894 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top