<Swing Dev>  RFR JDK-8191639:NPE from BasicListUI.Actions.getNextPageIndex
Sergey.Bylokhov at oracle.com
Mon Nov 27 22:03:43 UTC 2017
A few notes about the fix:
- Can we get an NPE in adjustScrollPositionIfNecessary at
2391 list.scrollRectToVisible(cellBounds); Not sure that
scrollRectToVisible is ready for null.
- I think the assignment below can be simplified
cellBounds = startRect != null ? startRect : null;
- In the getNextPageIndex() probably we can "return index" immediately
instead of additional indentation?
On 22/11/2017 03:05, Prasanta Sadhukhan wrote:
> Hi All,
> Bug: https://bugs.openjdk.java.net/browse/JDK-8191639
> It is seen that when JList.locationToIndex() or getCellBounds() is
> overridden to return -1 or null respectively,
> it causes NPE when PageUp/PageDown is pressed in JList.
> From the spec
> of getCellBounds(), it is seen that it can return null under some
> circumstances. But, JList jdk code assumes it is always non-null.
> Proposed fix is to check for null return value of getCellBounds() and
> bail out.
> webrev: http://cr.openjdk.java.net/~psadhukhan/8191639/webrev.00/
Best regards, Sergey.
More information about the swing-dev