Hi Team,
The expected SonarQube bug appears not to be caught in the code below, even though it’s caught in a very similar code as seen in the screenshot. Any thoughts?
import java.io.IOException;
import java.io.InputStream;
class BuggyInputStream extends InputStream {
private byte[] buffer;
private int pos;
public BuggyInputStream(byte[] buffer) {
this.buffer = buffer;
this.pos = 0;
}
@Override
public int read() throws IOException {
if (pos == buffer.length) {
return -1;
}
int value = buffer[pos++];
return value;
}
public int showBug() throws IOException {
return this.read();
}
}
Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006
Screenshot of code scan results