You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/01/18 16:48:23 UTC

[commons-vfs] 01/03: MonitorInputStream.read(byte[], int, int) and read() should be synchronized like the superclass BufferedInputStream

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

commit 1fcb6dbf209b44ec5f4cd5e2f2f31fd451eee1f8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 18 10:45:55 2023 -0500

    MonitorInputStream.read(byte[], int, int) and read() should be
    synchronized like the superclass BufferedInputStream
---
 .../main/java/org/apache/commons/vfs2/util/MonitorInputStream.java    | 4 ++--
 src/changes/changes.xml                                               | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java
index 84353d07..051afaa0 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java
@@ -139,7 +139,7 @@ public class MonitorInputStream extends BufferedInputStream {
      * @throws IOException if an IO error occurs.
      */
     @Override
-    public int read() throws IOException { // lgtm [java/non-sync-override]
+    public synchronized int read() throws IOException {
         if (isClosed()) {
             return EOF_CHAR;
         }
@@ -162,7 +162,7 @@ public class MonitorInputStream extends BufferedInputStream {
      * @throws IOException if an IO error occurs.
      */
     @Override
-    public int read(final byte[] buffer, final int offset, final int length) throws IOException { // lgtm [java/non-sync-override]
+    public synchronized int read(final byte[] buffer, final int offset, final int length) throws IOException {
         if (isClosed()) {
             return EOF_CHAR;
         }
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6a7c1022..4a07987e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -122,6 +122,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action issue="VFS-825" type="fix" dev="ggregory" due-to="Anthony Goubard">
         Fix for GZip input and output stream results in StackOverflowError #322.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        MonitorInputStream.read(byte[], int, int) and read() should be synchronized like the superclass BufferedInputStream.
+      </action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Seth Falco">
         Add vscode files to gitignore #205.