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

unexpected exception thrown by ImageIO.getWriterMIMETypes

    XMLWordPrintable

    Details

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

      Description



      Name: ipR10067 Date: 05/24/2001



      The description for static method getWriterMIMETypes()
      of the class javax.imageio.ImageIO reads:

      "Returns an array of Strings listing all of the MIME types
      understood by the current set of registered writers.
      Returns: an array of Strings."

      The expected result of this method in the case when there are no
      registered writers is not described.

      It is intended to be an empty array of Strings
      but in fact unexpected IllegalArgumentException is thrown.
      (for method without argument).

      The same issue occurs for getWriterFormatNames(),
      getReaderMIMETypes() and getReaderFormatNames() methods too.


      To reproduce the problem run the following test:

      ---------------------------- source --------------------------------

      import javax.imageio.ImageIO;
      import javax.imageio.spi.*;


      public class Test {

          public static void main(String argv[]) {
            
              String[] formatNames;

              /* deregister all readers and writers */
              IIORegistry CurRegistry = IIORegistry.getDefaultInstance();
              CurRegistry.deregisterAll();

              try {
                  formatNames = ImageIO.getWriterMIMETypes();
              } catch (Throwable ex) {
                System.out.println ("Unexpected exception " + ex.toString());
              }
                    
              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
      Unexpected exception java.lang.IllegalArgumentException: category unknown!


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

        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: