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

ImageIO.getImageTranscoders: incorrect diagnostic message

    XMLWordPrintable

    Details

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

      Description



      Name: ipR10067 Date: 05/21/2001


      There seems to be a typo in diagnostic message in method ImageIO.getImageTranscoders.

      The message of IllegalArgumentException reads "reader == null!"
      even though the parameter "writer" is null and "reader" is not null.

      To reproduce the problem run the following test:

      ---------------------------- source --------------------------------
      import javax.imageio.ImageIO;
      import javax.imageio.ImageWriter;
      import javax.imageio.ImageReader;
      import java.io.PrintWriter;
      import java.io.IOException;
      import java.util.Iterator;

      public class Test {
          public static void main(String argv[]) {

              String[] Formatnames = null;
              Iterator readers = null;
              ImageReader reader = null;

              /* get reader */
              Formatnames = ImageIO.getReaderFormatNames();
              readers = ImageIO.getImageReadersByFormatName(Formatnames[0]);
              while (readers.hasNext()){
                  reader = (ImageReader)readers.next();
                  if (reader != null) {
                      break;
                  }
              }

              try {
                     Iterator transcoders = ImageIO.getImageTranscoders(reader, null);
              } catch (IllegalArgumentException iae) {
                   System.out.println("writer == null, exception: " + iae.toString());
                   return;
              }
              System.out.println("No expected exception was thrown");
              return;
          }
      }

      ---------------------------- log --------------------------------
      >java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
      >java Test
      writer == null, exception: java.lang.IllegalArgumentException: reader == null!


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

        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: