OldJTable.java - NullPointerException when columnData is null

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Generic / MacOS / Java 21

      A DESCRIPTION OF THE PROBLEM :
      OldJTable.java line 94 calls `columnData.toArray()` without null check, causing NullPointerException when null is passed.

      The `addColumn` method at lines 87-102 accepts a `List<?> columnData` parameter. At line 94, the code calls `m.addColumn(columnIdentifier, columnData.toArray())` without null check. The method is called with null at lines 72 and 84. When `columnData` is null, `columnData.toArray()` throws NullPointerException. `DefaultTableModel.addColumn(Object columnName, Object[] columnData)` explicitly accepts null for the array parameter.

      REGRESSION : Last worked in version 21.0.9-oracle

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Call `addColumn(columnIdentifier, width)` or `addColumn(columnIdentifier, width, renderer, editor)` which internally pass null for columnData.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The code is expected to handle null columnData without throwing NullPointerException, consistent with DefaultTableModel's behavior.

      ACTUAL -
      NullPointerException is thrown at line 94 when columnData is null.


            Assignee:
            Anupam Dev
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: