RFR: 8188026: TextFieldXXCell: NPE on calling startEdit [v4]

Marius Hanl mhanl at openjdk.java.net
Sun Sep 19 11:27:47 UTC 2021


On Thu, 19 Aug 2021 12:16:28 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:

>> Marius Hanl has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Separated test and made the cell a supplier instead
>
> modules/javafx.controls/src/main/java/javafx/scene/control/cell/ChoiceBoxTreeCell.java line 301:
> 
>> 299:             return;
>> 300:         }
>> 301: 
> 
> (darn, can't add the important lines - which is backing out if treeItem is null)
> 
> The re-ordering leads to change of behavior, here's a test that's passing/failing before/after:
> 
>     /**
>      * change of behavior: cell must not be editing if treeItem == null.
>      * fails with fix, passes without
>      */
>     @Test
>     public void testChoiceBoxTreeCellEditing() {
>         TreeView<String> treeView = new TreeView<>();
>         treeView.setEditable(true);
>         ChoiceBoxTreeCell<String> cell = new ChoiceBoxTreeCell<>();
>         cell.updateTreeView(treeView);
>         cell.updateItem("TEST", false);
>         
>         cell.startEdit();
>         assertFalse(cell.isEditing());
>         assertNull(cell.getGraphic());
>     }
>     
> same for ComboBoxTreeCell

Hm.. weird that the super class is firing an edit event even with `treeItem = null`. Maybe this should be investigated in a follow-up. Good catch though. :)

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

PR: https://git.openjdk.java.net/jfx/pull/569


More information about the openjfx-dev mailing list