<Swing Dev> RFR: 4819544: SwingSet2 JTable Demo throws NullPointerException [v2]

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Aug 5 04:59:52 UTC 2021


> In the JTable demo, if we double click on the first cell in the Favorite Number column, delete the value and click on some
> other cell, a java.lang.NullPointerException is getting thrown.
> The flaw is in the TableDemo's TableModel getColumnClass() method which queries the value of cell 0 in the target column, and returns its Class. This logic seems to be flawed - an NPE will be thrown when the value in cell 0 is null.
> Fix by checking for null.

Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:

  Use ternary operator

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4969/files
  - new: https://git.openjdk.java.net/jdk/pull/4969/files/5b181bee..fffb3f32

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4969&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4969&range=00-01

  Stats: 4 lines in 1 file changed: 0 ins; 3 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4969.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4969/head:pull/4969

PR: https://git.openjdk.java.net/jdk/pull/4969


More information about the swing-dev mailing list