This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 812e495d3 Better local variable name
812e495d3 is described below

commit 812e495d3a5c3eb17f6ee708ec472e78e7526e26
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Nov 6 07:56:11 2024 -0500

    Better local variable name
    
    Add @SuppressWarnings with comment
---
 .../apache/commons/compress/archivers/sevenz/SevenZFile.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java 
b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index fcd74b5ed..b14b31ee2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -1104,6 +1104,7 @@ public class SevenZFile implements Closeable {
      * @throws IOException if an I/O error has occurred
      */
     public int read() throws IOException {
+        @SuppressWarnings("resource") // does not allocate
         final int b = getCurrentStream().read();
         if (b >= 0) {
             uncompressedBytesReadFromCurrentEntry++;
@@ -1135,11 +1136,12 @@ public class SevenZFile implements Closeable {
         if (len == 0) {
             return 0;
         }
-        final int cnt = getCurrentStream().read(b, off, len);
-        if (cnt > 0) {
-            uncompressedBytesReadFromCurrentEntry += cnt;
+        @SuppressWarnings("resource") // does not allocate
+        final int current = getCurrentStream().read(b, off, len);
+        if (current > 0) {
+            uncompressedBytesReadFromCurrentEntry += current;
         }
-        return cnt;
+        return current;
     }
 
     private BitSet readAllOrBits(final ByteBuffer header, final int size) 
throws IOException {

Reply via email to