<Swing Dev> [10] RFR JDK-8191639:NPE from BasicListUI.Actions.getNextPageIndex

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Wed Nov 22 11:05:13 UTC 2017


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 
[https://docs.oracle.com/javase/9/docs/api/javax/swing/JList.html#getCellBounds-int-int-]
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/

Regards
Prasanta



More information about the swing-dev mailing list