Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8271474

Tree-/TableCell: inconsistent edit event firing pattern

    XMLWordPrintable

Details

    Description

      in commit/cancelEdit:

           if (table != null)
              // create and fire edit event

      in startEdit:
           
           if (column != null)
              // create and fire edit event

      digging into history: for cancel, the current pattern (null check of table) was added with JDK-8116392: before it checked column for null

      failing test:

           @Test
           public void testEditCancelNoColumn() {
               table.setEditable(true);
               cell.updateTableView(table);
               // force artificially not-empty cell state
               TableCellShim.set_lockItemOnEdit(cell, true);
               CellShim.updateItem(cell, "something", false);
               // start edit: succeeds without firing event (null check
      against column)
               cell.startEdit();
               assertTrue(cell.isEditing());
               // cancel edit: NPE from Event.fire - all params
      must be != null
               cell.cancelEdit();
               assertFalse(cell.isEditing());
           }

      notes:
      - the event is fired on the column as target, so the column must not be null
      - without guarding against null table, throws NPE due to JDK-8269871 (CellEditEvent is incorrectly? implemented to require !null table)
      - same pattern in TreeTableCell which looks like c&p'ed from TableCell

      see also: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-July/031106.html

      Attachments

        Issue Links

          Activity

            People

              fastegal Jeanette Winzenburg
              fastegal Jeanette Winzenburg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: