-
Enhancement
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
Name: vrR10176 Date: 04/05/2001
Api docs (jdk1.4.0beta-b58) says about method
javax.imageio.ImageWriteParam.canOffsetTiles():
"public boolean canOffsetTiles()
Returns true if the writer can perform tiling with non-zero grid
offsets while writing. If this method returns false, then setTiling
will throw an UnsupportedOperationException if the grid offset
arguments are not both zero. If canWriteTiles returns false, this
method will return false as well."
But canOffsetTiles() may return true while canWriteTiles() returns
false. Subclasses can incorrectly set the value of canOffsetTiles to
true while canWriteTiles is set to false.
Method canOffsetTiles() should check the value of canWriteTiles or
sentence "If canWriteTiles returns false, this method will return
false as well." should be removed.
To reproduce the issue execute following test.
------------ myImageWriteParam.java ------------------------
import javax.imageio.ImageWriteParam;
public class myImageWriteParam extends ImageWriteParam {
public myImageWriteParam() {
super(null);
super.canOffsetTiles = true;
}
public static void main(String[] argv) {
myImageWriteParam myimagewriteparam = new myImageWriteParam();
System.out.println("canWriteTiles() returns: " + myimagewriteparam.canWriteTiles());
System.out.println("canOffsetTiles() returns: " + myimagewriteparam.canOffsetTiles());
}
}
------------ 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
canWriteTiles() returns: false
canOffsetTiles() returns: true
-----------------------------------------------
======================================================================