]> source.dussan.org Git - archiva.git/commitdiff
prevent possible NPE
authorOlivier Lamy <olamy@apache.org>
Mon, 16 Dec 2013 22:35:10 +0000 (22:35 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 16 Dec 2013 22:35:10 +0000 (22:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551386 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java

index ba3ab2fa1bfcd7ae06e79091de33b4195e071f68..09008e2a72d5141e8811265f12d5803755c85955 100644 (file)
@@ -102,7 +102,10 @@ public class DefaultFileLockManager
             {
                 // can happen if an other thread has deleted the file
                 // close RandomAccessFile!!!
-                closeQuietly( lock.getRandomAccessFile() );
+                if ( lock != null )
+                {
+                    closeQuietly( lock.getRandomAccessFile() );
+                }
                 log.debug( "read Lock skip: {} try to create file", e.getMessage() );
                 createNewFileQuietly( file );
             }
@@ -178,8 +181,10 @@ public class DefaultFileLockManager
             {
                 // can happen if an other thread has deleted the file
                 // close RandomAccessFile!!!
-                closeQuietly( lock.getRandomAccessFile() );
-
+                if ( lock != null )
+                {
+                    closeQuietly( lock.getRandomAccessFile() );
+                }
                 log.debug( "write Lock skip: {} try to create file", e.getMessage() );
                 createNewFileQuietly( file );
             }