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

public boolean containsKey(Object key) doesn't throw NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.2.1, 5.0
    • client-libs
    • 2d
    • b63
    • generic, sparc
    • generic, solaris_9

      Name: lm153972 Date: 08/16/2004


      public boolean containsKey(java.lang.Object key) doesn't throw
      NullPointerException when key is null as described in
      specification for AGUI and J2SE 1.5
      "Throws:
      NullPointerException - key is null"
      ------------------------- ContainsKey.java --------------------
      import java.awt.*;
      import java.util.*;
      public class ContainsKey{

          public static void main(String argv[]) {
              try {
                  RenderingHints rH = new RenderingHints(
                          RenderingHints.KEY_ALPHA_INTERPOLATION,
                          RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
                  if (!rH.containsKey(null)) {
                      System.out.println("NullPointerException expected");
                  }
              } catch (Exception e) {
                  System.out.println("Exception during test:" + e.toString());
              }
          }
      }
      ----------------------------------------------------------------

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

            flar Jim Graham
            lmesnik Leonid Mesnik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: