You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/03/15 07:44:19 UTC

[GitHub] [commons-vfs] boris-petrov opened a new pull request #167: Fix NPE when closing a stream from a different thread

boris-petrov opened a new pull request #167:
URL: https://github.com/apache/commons-vfs/pull/167


   This is the workaround for the issue we spoke about in https://github.com/apache/commons-vfs/pull/166.
   
   cc @garydgregory, @MaxKellermann


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on a change in pull request #167: Fix NPE when closing a stream from a different thread

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #167:
URL: https://github.com/apache/commons-vfs/pull/167#discussion_r594284827



##########
File path: commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
##########
@@ -167,4 +174,28 @@ public void testOutputStreamBufferSizeNegativeWithAppendFlag() throws Exception
         }
     }
 
+    @Test
+    public void testOutputStreamClosedInADifferentThread() throws Exception {
+        testStreamClosedInADifferentThread(content -> content.getOutputStream());
+    }
+
+    private <T extends Closeable> void testStreamClosedInADifferentThread(FailableFunction<FileContent, T, IOException> getStream) throws Exception {
+        final File temp = File.createTempFile("temp-file-name", ".tmp");
+        final FileSystemManager fileSystemManager = VFS.getManager();
+
+        try (FileObject file = fileSystemManager.resolveFile(temp.getAbsolutePath())) {
+            T stream = getStream.apply(file.getContent());
+            boolean[] check = { false };

Review comment:
       You no longer need the array hack since AtomicBoolean was introduced in Java 7.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory merged pull request #167: Fix NPE when closing a stream from a different thread

Posted by GitBox <gi...@apache.org>.
garydgregory merged pull request #167:
URL: https://github.com/apache/commons-vfs/pull/167


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on pull request #167: Fix NPE when closing a stream from a different thread

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #167:
URL: https://github.com/apache/commons-vfs/pull/167#issuecomment-859759289


   Yes, my release train is:
   
   IO (vote underway), POOL, DBCP, others.
   
   Gary
   
   On Fri, Jun 11, 2021, 13:16 Boris Petrov ***@***.***> wrote:
   
   > @garydgregory <https://github.com/garydgregory> - do you have any plans
   > on releasing a 2.8.1 version soon? I've been stuck on 2.7.0 because of the
   > couple of issues introduced in 2.8.0.
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/commons-vfs/pull/167#issuecomment-859726383>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AAJB6NYV2BR5PF7SQOR3IVTTSJAGTANCNFSM4ZGAN7DA>
   > .
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] boris-petrov commented on pull request #167: Fix NPE when closing a stream from a different thread

Posted by GitBox <gi...@apache.org>.
boris-petrov commented on pull request #167:
URL: https://github.com/apache/commons-vfs/pull/167#issuecomment-859726383


   @garydgregory - do you have any plans on releasing a 2.8.1 version soon? I've been stuck on 2.7.0 because of the couple of issues introduced in 2.8.0.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on pull request #167: Fix NPE when closing a stream from a different thread

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #167:
URL: https://github.com/apache/commons-vfs/pull/167#issuecomment-799390559


   @boris-petrov 
   Thank you for your PR. See my one comment. Aside from that, LGTM, while knowing that there is the larger issue at play.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org