-
Bug
-
Resolution: Fixed
-
P3
-
6, 9
-
b114
-
generic
-
generic
The code uses non-short-circuit logic (|) rather than short-circuit logic (||). Non-short-circuit logic causes both sides of the expression to be evaluated even when the result can be inferred from knowing the left-hand side.
$ pwd
/local-copy/1.6.0-rc-b69_src/j2se/src/share/classes/javax/imageio
$ tail +1095 ImageTypeSpecifier.java | head -6
public int getBitsPerBand(int band) {
if (band < 0 | band >= getNumBands()) { // <<------- here
throw new IllegalArgumentException("band out of range!");
}
return sampleModel.getSampleSize(band);
}
$ pwd
/local-copy/1.6.0-rc-b69_src/j2se/src/share/classes/javax/imageio
$ tail +1095 ImageTypeSpecifier.java | head -6
public int getBitsPerBand(int band) {
if (band < 0 | band >= getNumBands()) { // <<------- here
throw new IllegalArgumentException("band out of range!");
}
return sampleModel.getSampleSize(band);
}