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

Apparent bug in JTable.propertyChange(PropertyChangeEvent) source code.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • x86
    • windows_2000



      Name: yyT116575 Date: 09/28/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      This source code snippet is taken directly from javax/swing/JTable.java, in the
      public void propertyChange(PropertyChangeEvent) method:

      <pre>

                  // re-set columnModel listeners
              // and column's selection property listener as well
      1. } else if (name.compareTo("columnModel") == 0) {
      2.
      3. if (oldValue != null && oldValue instanceof TableColumnModel) {
      4. TableColumnModel tcm = (TableColumnModel) oldValue;
      5. tcm.removeColumnModelListener(this);
      6. tcm.getSelectionModel().removeListSelectionListener(this);
      7. }
      8. if (newValue != null && newValue instanceof TableColumnModel) {
      9. TableColumnModel tcm = (TableColumnModel) oldValue;
      10. tcm.addColumnModelListener(this);
      11. tcm.getSelectionModel().addListSelectionListener(this);
      12. }

      </pre>

      On line 9, shouldn't it be getting a reference to newValue instead of oldValue,
      and registering as a listener for the new TableColumnModel, instead of
      reregistering as a listener on the old TableColumnModel?
      (Review ID: 110143)
      ======================================================================

            lmonsantsunw Lynn Monsanto (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: