Author: tilman
Date: Tue Jun 25 18:48:48 2024
New Revision: 1918620

URL: http://svn.apache.org/viewvc?rev=1918620&view=rev
Log:
PDFBOX-5660: Sonar fix

Modified:
    
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java

Modified: 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java?rev=1918620&r1=1918619&r2=1918620&view=diff
==============================================================================
--- 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java
 (original)
+++ 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilterDecoderStream.java
 Tue Jun 25 18:48:48 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;
     }


Reply via email to