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

spec:constructors Image[In|Out]putStreamSpi throw unspecified exception

    XMLWordPrintable

    Details

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

      Description



      Name: ipR10067 Date: 05/10/2001


        
      The descriptions for the constructors
      "public ImageInputStreamSpi (String vendorName, String version, Class inputClass)"
      of javax.imageio.spi.ImageInputStreamSpi class and
      "public ImageOutputStreamSpi (String vendorName, String version, Class outputClass)"
      of javax.imageio.spi.ImageOutputStreamSpi class
      say nothing about throwing IllegalArgumentException,
      but if "vendorName" or "version" is null it will be thrown.

      See the example below for class javax.imageio.spi.ImageInputStreamSpi:
      ========================== MyImageInputStreamSpi.java =============================
      import java.util.Locale;
      import java.io.File;
      import java.io.IOException;
      import javax.imageio.stream.ImageInputStream;
      import javax.imageio.spi.ImageInputStreamSpi;

      public class MyImageInputStreamSpi extends ImageInputStreamSpi {

          public static void main (String argv[]) {
              try {
                  ImageInputStreamSpi MyProvider = new MyImageInputStreamSpi(
                                  null, "version", ImageInputStreamSpi.class);
             
              } catch (Throwable iae) {
                   System.out.println("Unexpected exception was thrown " + iae.toString());
              }
          }

          /*---------------------------------*/
       
          MyImageInputStreamSpi(String vendorName, String version, Class inputClass) {
              super(vendorName, version, inputClass);
          }
        
          public ImageInputStream createInputStreamInstance
              (Object input, boolean useCache, File cacheDir) throws IOException {
              return null;
          }

          public String getDescription(Locale locale) {
              return "OK";
          }
      }

      ==========================log========================
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b63)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b63, mixed mode)
      % java MyImageInputStreamSpi
      Unexpected exception was thrown java.lang.IllegalArgumentException: vendorName == null!

      This bug causes failure of the new JCK tests
      api/javax_imageio/spi/ImageInputStreamSpi/index.html#Ctor
      api/javax_imageio/spi/ImageOutputStreamSpi/index.html#Ctor

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

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

        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: