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

AreaAveragingScaleFilter(int, int): IAE is not specified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 5.0
    • client-libs
    • None
    • 2d
    • b09
    • generic
    • generic

      Constructor for java.awt.image.AreaAveragingScaleFilter class throws IllegalArgumentException when passed a zero value for a input parameter. Such behavior is not specified either in the member spec or in the package/class description.

      ---------
      import java.awt.image.AreaAveragingScaleFilter;

      public class Test1 {
          public static void main(String[] args) {
              int[] values = { 1, -1, Integer.MAX_VALUE, Integer.MIN_VALUE,
                               29, 180, -32, -439 };
              StubFilter filter = null;
              for (int i = 0; i < values.length; i++) {
                  try {
                      filter = new StubFilter(0, values[i]);
                      System.out.println("result: false");
                  } catch (IllegalArgumentException e) {
                      System.out.println("result (iae): true");
                  }
              }
          }

          public static class StubFilter extends AreaAveragingScaleFilter {

              public StubFilter(int width, int height) {
                  super(width, height);
              }

              public int getSrcWidth() {
                  return srcWidth;
              }

              public int getSrcHeight() {
                  return srcHeight;
              }

              public int getDestWidth() {
                  return destWidth;
              }

              public int getDestHeight() {
                  return destHeight;
              }
          }
      }

      ###@###.### 2004-12-21 14:42:51 GMT

            psadhukhan Prasanta Sadhukhan
            ydanilev Yury Danilevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: