Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8312475

org.jline.util.PumpReader signed byte problem

XMLWordPrintable

    • b21

      SonarCloud reports a problem in PumpReader here:
       https://github.com/openjdk/jdk/blob/354c6605e32790ca421869636d8bf5456fc51717/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/PumpReader.java#L417

              @Override
              public int read() throws IOException {
                  if (!buffer.hasRemaining() && !readUsingBuffer()) {
                      return EOF;
                  }
                  return buffer.get(); // <---- here
              }

      InputStream returns -1 as EOF, but that might be as well the value of signed byte from get(). We need cast to `& 0xFF` here.

            msobierski Michal Sobierski
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: