<Swing Dev> [11] Review Request: JDK-6257207 : JTable.getDefaultEditor throws undocumented NullPointerException

Andrej Golovnin andrej.golovnin at gmail.com
Fri Jan 5 13:19:22 UTC 2018


Hi Pankaj,

your change may break existing applications. Suppose that someone has
created a sub-class of JTable and has overridden the
#initializeLocalVars()-method and tries to access the table model in
this model. Before your change the application works and after your
change the application would throw NPE.

Best regards,
Andrej Golovnin

On Fri, Jan 5, 2018 at 1:16 PM, Pankaj Bansal
<pankaj.b.bansal at oracle.com> wrote:
> Hi All,
>
>
>
> Please review the fix for JDK 11.
>
>
>
> Bug:
>
> https://bugs.openjdk.java.net/browse/JDK-6257207
>
>
>
> Webrev:
>
> http://cr.openjdk.java.net/~pbansal/6257207/webrev.00/
>
>
>
> Issue:
>
> JTable.getDefaultEditor can throw a NullPointerException.
>
>
>
> Fix:
>
> While creating JTable, when data model is set by calling SetModel function,
> SetModel function throws TableChanged event. Now if client code has
> subclassed the JTable and is listening to TableChanged events, client can
> try to use DefaultEditor, which causes problem as it has not been
> initialized as of now. Moved the call to initializeLocalVars above setModel
> call.
>
>
>
> Regards,
>
> Pankaj Bansal
>
>



More information about the swing-dev mailing list