FULL PRODUCT VERSION :
jdk 1.4.2_09, 1.5.0_04, 6.0_50
ADDITIONAL OS VERSION INFORMATION :
Windows
A DESCRIPTION OF THE PROBLEM :
I have copied part of write method from java.io.OutputStream class's source code -
public void write(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
}
In this method the logic (off + len) < 0) is not rechable because if this condition has to satisfy then either off < 0 or len < 0 has to be satisfied.
so this code will never be reached and it is not required.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public void write(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
}
---------- END SOURCE ----------
jdk 1.4.2_09, 1.5.0_04, 6.0_50
ADDITIONAL OS VERSION INFORMATION :
Windows
A DESCRIPTION OF THE PROBLEM :
I have copied part of write method from java.io.OutputStream class's source code -
public void write(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
}
In this method the logic (off + len) < 0) is not rechable because if this condition has to satisfy then either off < 0 or len < 0 has to be satisfied.
so this code will never be reached and it is not required.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public void write(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
}
---------- END SOURCE ----------