Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P3
-
Resolution: Fixed
-
Affects Version/s: 6, 9
-
Fix Version/s: 9
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
Resolved In Build:b114
-
CPU:generic
-
OS:generic
Description
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);
}