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

java.lang.Character.Subset constructor(null) does not throw NullPointerException

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: akC57697 Date: 02/05/99


      java.lang.Character.Subset constructor does not throw NullPointerException
      when called with null parameter.
      javadoc for Character.Subset constructor is silent about handling null:
      -------
      protected Character.Subset(String name)

          Constructs a new Subset instance.
          Parameters:
              name - The name of this subset
      -------

      However, null Subset name does not make any sense.

      A test example which demonstrates this problem.
      ===== Test31.java ========
      public class test31 {

          public static void main (String argv[]) {
             
              try {
                  MySubset s = new MySubset(null);
                  System.out.println("NullPointerException expected");
              }
              catch (NullPointerException npe) {
                  System.out.println("OKAY");
              }
              return;
          }
      }

      class MySubset extends Character.Subset {
          MySubset(String name) {
              super(name);
          }
      }
      ========= Sample run (JDK1.2-fcs) ==========
      #>java test31
      NullPointerException expected

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

            mmcclosksunw Michael Mccloskey (Inactive)
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: