-
Bug
-
Resolution: Fixed
-
P3
-
8
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);
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);