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

JTable(Vector, Vector) throws unexpected NullPointerException

XMLWordPrintable

    • 1.0.2
    • sparc
    • solaris_2.5



      Name: asC58863 Date: 02/18/98


      java.awt.swing.JTable.JTable(Vector data, Vector columnNames) throws
      unexpected java.lang.NullPinterException if data is null. It should
      throw java.lang.IllegalArgumentException instead.

      (see JavaDoc Comment )
      "public JTable(Vector data,
                    Vector columnNames)
      ..............
      Throws:
                  IllegalArgumentException - if data is null or if the number of
                  columns in data does not equal the number of
                  names in columnNames. "
                  
      This exception is thrown starting with JDK1.2-Beta3E build only.

      Here is the test demonstrating the bug:
      ------------------ Test.java -----------------
      import java.awt.swing.*;
      import java.util.*;

      class Test {
        public static void main(String[] argv) {
          Vector data = new Vector();
          data.addElement(null);
          Vector columnNames = new Vector();
          try {
           JTable table = new JTable(data,columnNames);
           System.out.println(" IllegalArgumentException does not thrown ");
          } catch(IllegalArgumentException e){
            System.out.println(" thrown "+e);
          } catch(Exception e2){
            System.out.println(" IllegalArgumentException does not thrown ");
            System.out.println(" but "+e2+" has been thrown ");
          }
         
          System.exit(0);
        }
      }

      -------------- Output from the test -----------------
      :\>/set/java/JDK1.2-Beta3E/solaris/bin/java Test
        IllegalArgumentException does not thrown
        but java.lang.NullPointerException has been thrown
      ------------------------------------------------------


      ======================================================================

            erapinsunw Eric Rapin (Inactive)
            asemidetsunw Alexei Semidetnov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: