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

ImageIO.write(null, null, (File)null) throws NullPointerException

    XMLWordPrintable

    Details

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

      Description



      Name: ipR10067 Date: 04/06/2001



      The specification (ImageIO.write) reads:
      "
        ...
       
        Throws: IllegalArgumentException - if any parameter is null

      "

      But the method write(RenderedImage im, String formatName, File output)
      throws NullPointerException instead of IllegalArgumentException.

      Please see test source and log bellow.

      ===================== write.java =======================

      import javax.imageio.ImageIO;
      import java.io.IOException;

      import java.io.File;


      public class write{

          public static void main(String argv[]) {
                 
             try {

                 ImageIO.write(null, null, (File)null);
                 System.out.println("FAILED: No exception was thrown");

             } catch (IllegalArgumentException iae) {
                 System.out.println("PASSED: Expected exception - " + iae.toString());

             } catch (java.lang.NullPointerException iae) {
                 System.out.println("FAILED: Wrong exception - " + iae.toString());

             } catch (IOException io) {
                 System.out.println("Exception during writing " + io.toString());
             }
         }
      }


      ============================== log =================================
      > java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b58)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b58, mixed mode)
      > javac write.java
      > java write
      FAILED: Wrong exception - java.lang.NullPointerException

      This bug affects new JCK test
      tests/api/javax_imageio/ImageIO/index.html#write


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

        Attachments

          Activity

            People

            Assignee:
            dricesunw Daniel Rice (Inactive)
            Reporter:
            ipsunw Ip Ip (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: