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

RT-23769 introduces possiblepossibility of NPEs being thrown

    Details

      Description

      the Fix for RT-23789 (changeset 999698518921) introduced the possa possible NPE in the hashCode()-method. The window of opportunity for that NPE is quite small but it's there, twice.

      When working with WeakReference in order to avoid NPEs one has to store the value retrieved from the Reference in a local variable to avoid the referenced value being GCed.
      The hashCode()-method is the only one in that change set that does not conform to this and in not doing so introduces the possibility of causing NPEs.

      Current:
      hash = 79 * hash + (getTableColumn() != null ? getTableColumn().hashCode() : 0);
      hash = 79 * hash + (getTableView() != null ? getTableView().hashCode() : 0);

      Correct:
      TableColumn<S,T> tableColumn = getTableColumn();
      hash = 79 * hash + (tableColumn != null ? tableColumn.hashCode() : 0);
      TableView<S> tableView = getTableView();
      hash = 79 * hash + (tableView != null ? tableView.hashCode() : 0);

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              mklahnjfx Martin Klahn (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:
                Imported: