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

Undefined Exception in SampleModel, method createCompatibleSampleModel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 6, 9
    • client-libs
    • None
    • 2d
    • b114
    • x86
    • generic

    Description

      There are no Exceptions are defined for method createCompatibleSampleModel in class SampleModel.
      However when w = Integer.MAX_VALUE, IllegalException is thrown.

      import java.awt.color.*;
      import java.awt.image.*;
      import java.awt.*;

      public class Test {
          static int defaultWidth = 6;
          static int defaultHeight = 4;

          public static void test1() {
              SampleModel model = Raster.createBandedRaster(DataBuffer.TYPE_INT, defaultWidth,
                      defaultHeight, 4, null).getSampleModel();
              SampleModel model2 = model.createCompatibleSampleModel(Integer.MAX_VALUE,1);
          }
          public static void main(String[] a) {
              test1();
          }
      }
      ---------------------------------- output --------------------------------------------
      Exception in thread "main" java.lang.IllegalArgumentException: Dimensions (width=2147483647 height=1) are too large
              at java.awt.image.SampleModel.<init>(SampleModel.java:112)
              at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:191)
              at java.awt.image.BandedSampleModel.<init>(BandedSampleModel.java:94)
              at java.awt.image.BandedSampleModel.createCompatibleSampleModel(BandedSampleModel.java:125)
              at Test.test1(Test.java:20)
              at Test.main(Test.java:23)
      ###@###.### 10/27/04 11:58 GMT
      ###@###.### 10/27/04 12:04 GMT

      Attachments

        Issue Links

          Activity

            People

              aghaisas Ajit Ghaisas
              lmesnik Leonid Mesnik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: