Author: tilman Date: Tue Jun 25 18:48:52 2024 New Revision: 1918621 URL: http://svn.apache.org/viewvc?rev=1918621&view=rev Log: PDFBOX-5660: Sonar fix
Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java URL: http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java?rev=1918621&r1=1918620&r2=1918621&view=diff ============================================================================== --- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java (original) +++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java Tue Jun 25 18:48:52 2024 @@ -38,7 +38,6 @@ public final class FlateFilterDecoderStr private boolean isEOF = false; private int currentDataIndex = 0; - private int bytesRead = 0; private int bytesDecoded = 0; private byte[] buffer = new byte[2048]; @@ -67,12 +66,11 @@ public final class FlateFilterDecoderStr { isEOF = true; bytesDecoded = 0; - bytesRead = 0; return false; } if (inflater.needsInput()) { - bytesRead = in.read(buffer); + int bytesRead = in.read(buffer); if (bytesRead > -1) { inflater.setInput(buffer, 0, bytesRead); @@ -120,12 +118,9 @@ public final class FlateFilterDecoderStr { return -1; } - if (currentDataIndex == bytesDecoded) + if (currentDataIndex == bytesDecoded && !fetch()) { - if (!fetch()) - { - return -1; - } + return -1; } return decodedData[currentDataIndex++] & 0xFF; }