From: Olivier Lamy Date: Mon, 16 Dec 2013 22:35:10 +0000 (+0000) Subject: prevent possible NPE X-Git-Tag: archiva-2.0.0-RC1~98 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=66ed6cb4b0103fe9e9935f0ccd84fd833b2c09ec;p=archiva.git prevent possible NPE git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551386 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java b/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java index ba3ab2fa1..09008e2a7 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java +++ b/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java @@ -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 ); }