Null Pointer Exception - 3rd Gen Tree

Jump to navigation Jump to search
Revision as of 25 March 2013 at 23:28.
The highlighted comment was created in this revision.

Null Pointer Exception - 3rd Gen Tree


Getting an occasional null pointer exception. I've not worked out why its happening, and looking at the source I can't quite see how it could happen. Call stack looks like

at KDTree.KdNode.addLeafPoint( at KDTree.KdNode.splitLeafNode( at KDTree.KdNode.addLeafPoint( at KDTree.KdNode.addPoint( at KDTree.KdTree.addPoint(

Any ideas?

    Wolfman23:45, 25 March 2013

    Seems that the "points" array is getting set to 'null' in a newly created child node. Assuming you haven't modified the code of the tree, and you're not doing any multithreading things, I can only see one possible cause: *All* of the data points are being put in the same child node, causing the newly created child node to itself be split while the upper level's splitLeafNode is still running. This implies that calculateSplit() is returning true when it shouldn't.

    Could you add code to line 169 to print the list of coordinates stored in the node being split, or use a debugger to obtain similar information? My suspicion is that the coordinates you're putting into the tree are very unusual in some manner, possibly involving NaN values.

      Rednaxela00:28, 26 March 2013