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

Adding an empty row to DefaultTableModel causes NullPointerException.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.0.2
    • 1.2.0
    • client-libs
    • 1.0.2
    • sparc
    • solaris_2.5

      I'm currently working with the JTable component using
      the DefaultTableModel. Into the TableModel i want
      to insert an empty row of data via
      addRow((Vector) null).
      As a result a got an NullPointerException. I looked
      in the code of DefaultTableModel and found the following

       538: if (newRow == null)
                      newRow = new Vector(numColumns);
       540: dataVector.addElement(rowData);

      I think, line 540 has to be changed to
       540: dataVector.addElement(newRow);

      regards
      Ulrich

      //////////////////////////////////////////////
      Ulrich Schaefer
      Daimler-Benz AG
      CAE-Research (FT3/EK)
      P.O. Box 2360
      D-89013 Ulm, Germany
      Phone: +49 731 505-2846
      Fax: +49 731 505-4210
      //////////////////////////////////////////////

            erapinsunw Eric Rapin (Inactive)
            pchusunw Patience Chu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: