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 2018/09/19 22:34:40 UTC

svn commit: r1841400 - in /commons/proper/vfs/trunk: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java src/changes/changes.xml

Author: ggregory
Date: Wed Sep 19 22:34:40 2018
New Revision: 1841400

URL: http://svn.apache.org/viewvc?rev=1841400&view=rev
Log:
[VFS-675] NullPointerException at AbstractFileObject.java:221.

Modified:
    commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
    commons/proper/vfs/trunk/src/changes/changes.xml

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java?rev=1841400&r1=1841399&r2=1841400&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java Wed Sep 19 22:34:40 2018
@@ -214,26 +214,28 @@ public abstract class AbstractFileObject
     @Override
     public void close() throws FileSystemException {
         FileSystemException exc = null;
+        
+        synchronized (fs) {
+            // Close the content
+            if (content != null) {
+                try {
+                    content.close();
+                    content = null;
+                } catch (final FileSystemException e) {
+                    exc = e;
+                }
+            }
 
-        // Close the content
-        if (content != null) {
+            // Detach from the file
             try {
-                content.close();
-                content = null;
-            } catch (final FileSystemException e) {
-                exc = e;
+                detach();
+            } catch (final Exception e) {
+                exc = new FileSystemException("vfs.provider/close.error", fileName, e);
             }
-        }
 
-        // Detach from the file
-        try {
-            detach();
-        } catch (final Exception e) {
-            exc = new FileSystemException("vfs.provider/close.error", fileName, e);
-        }
-
-        if (exc != null) {
-            throw exc;
+            if (exc != null) {
+                throw exc;
+            }
         }
     }
 

Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1841400&r1=1841399&r2=1841400&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Wed Sep 19 22:34:40 2018
@@ -89,6 +89,9 @@ The <action> type attribute can be add,u
       <action issue="VFS-671" dev="ggregory" type="update">
         Update Apache Commons Compress from 1.16.1 to 1.18.
       </action>
+      <action issue="VFS-675" dev="ggregory" type="fix">
+        NullPointerException at AbstractFileObject.java:221.
+      </action>
     </release>
     <release version="2.2" date="2017-10-06" description="New features and bug fix release.">
       <action issue="VFS-642" dev="pschumacher" type="update" due-to="ilangoldfeld">