-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
Name: vrR10176 Date: 04/06/2001
The sizes (width or height) of tile can not be negative. But api spec (jdk1.4.0beta-b58)
does not specify behavior of javax.imageio.ImageWriteParam.setTiling() method if passed
parameters tileWidth or tileHeight are negative.
If tileWidth or tileHeight is negative the implementation of setTiling() assigns this
value to ImageWriteParam protected fields tileWidth or tileHeight respectively without
throwing any exception.
To reproduce the issue execute following test.
------------ myImageWriteParam.java ------------------------
import javax.imageio.ImageWriteParam;
public class myImageWriteParam extends ImageWriteParam {
public myImageWriteParam() {
super(null);
super.canWriteTiles = true;
super.canOffsetTiles = true;
}
public static void main(String[] argv) {
myImageWriteParam myimagewriteparam = new myImageWriteParam();
myimagewriteparam.setTilingMode(ImageWriteParam.MODE_EXPLICIT);
myimagewriteparam.setTiling(-1,-2,-3,-4);
System.out.println("tileWidth: " + myimagewriteparam.tileWidth);
System.out.println("tileHeight: " + myimagewriteparam.tileHeight);
}
}
------------ Logs ------------------------------------------
$ javac myImageWriteParam.java
$ java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b58)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b58, mixed mode)
$ java myImageWriteParam
tileWidth: -1
tileHeight: -2
------------------------------------------------------------
======================================================================