False Negative for rule RSPEC-2674

Hi Team,

Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006

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.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
class BugExample {

    public void showBug() throws IOException {
        byte[] data = new byte[] {1, 2, 3};
        InputStream is = new ByteArrayInputStream(data);
        byte [] buffer = new byte[1000];
        int unusedVariable12345678 = is.read(buffer); 
    }
    public static void main(String[] args) {

        BugExample bugExample = new BugExample();

        try {
            bugExample.showBug();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

screenshot of code scan result