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

PageRanges(null) throws IllegalArgumentException instead of NullPointerException

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: ooR10006 Date: 04/03/2001


      The spec for constructor javax.print.attribute.standard.PageRanges(int[][] members)
      says:
      "Throws:
       NullPointerException - (unchecked exception) Thrown if members is null or any
       element of members is null."

      But in Merlin b58 API implementation of PageRanges((int[][])null)
      throws IllegalArgumentException.

      The following test shows this:

      import javax.print.attribute.standard.PageRanges;

      public class Test {
          public static void main(String[] args){
              try {
                  int[][] m = null;
                  PageRanges pr = new PageRanges(m);
                  System.out.println("wrong: no exceptions, NullPointerException expected");
              } catch (NullPointerException e){
                  System.out.println("OKAY");
              } catch (IllegalArgumentException ie){
                  System.out.println("wrong: IllegalArgumentException");
              }
          }
      }

      The error is in JDK1.4 source code of PageRanges(int[][] members) constructor:

          public PageRanges(int[][] members) {
      super (members);
      if (members == null) {
      throw new IllegalArgumentException("members is null");
      }
          ...

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

        Attachments

          Activity

            People

            Assignee:
            jgodinez Jennifer Godinez (Inactive)
            Reporter:
            ovosunw Ovo Ovo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: