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-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 31af606  Address SpotBugs Medium: 
org.apache.commons.io.input.ReadAheadInputStream.waitForAsyncReadComplete() 
does not release lock on all exception paths 
[org.apache.commons.io.input.ReadAheadInputStream] At 
ReadAheadInputStream.java:[line 448] UL_UNRELEASED_LOCK_EXCEPTION_PATH
31af606 is described below

commit 31af606444524c8e16ed625490119bafa5f50962
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Jan 11 10:16:36 2022 -0500

    Address SpotBugs Medium:
    org.apache.commons.io.input.ReadAheadInputStream.waitForAsyncReadComplete()
    does not release lock on all exception paths
    [org.apache.commons.io.input.ReadAheadInputStream] At
    ReadAheadInputStream.java:[line 448] UL_UNRELEASED_LOCK_EXCEPTION_PATH
---
 .../java/org/apache/commons/io/input/ReadAheadInputStream.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java 
b/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
index c71812c..dc3f8fc 100644
--- a/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
@@ -458,8 +458,11 @@ public class ReadAheadInputStream extends InputStream {
             iio.initCause(e);
             throw iio;
         } finally {
-            isWaiting.set(false);
-            stateChangeLock.unlock();
+            try {
+                isWaiting.set(false);
+            } finally {
+                stateChangeLock.unlock();
+            }
         }
         checkReadException();
     }

Reply via email to