-
Bug
-
Resolution: Fixed
-
P4
-
1.4.2, 5.0
-
b25
-
generic, x86
-
generic, windows_xp
This code improvement found by Bill Pugh and David Hovemeyer's findbugs program.
David writes:
M RCN: Redundant comparison to null in java.io.InputStream.read(byte[],int,int) At InputStream.java:[line 177]
b[off] = (byte)c;
int i = 1;
try {
for (; i < len ; i++) {
c = read();
if (c == -1) {
break;
}
if (b != null) { // b can never be null here [line 177]
b[off + i] = (byte)c;
}
}
} catch (IOException ee) {
}
return i;
This would just slow things down a little. The check can be removed.
David writes:
M RCN: Redundant comparison to null in java.io.InputStream.read(byte[],int,int) At InputStream.java:[line 177]
b[off] = (byte)c;
int i = 1;
try {
for (; i < len ; i++) {
c = read();
if (c == -1) {
break;
}
if (b != null) { // b can never be null here [line 177]
b[off + i] = (byte)c;
}
}
} catch (IOException ee) {
}
return i;
This would just slow things down a little. The check can be removed.
- duplicates
-
JDK-4923421 InputStream.read() has redundant null check
-
- Closed
-