From 66ed6cb4b0103fe9e9935f0ccd84fd833b2c09ec Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 16 Dec 2013 22:35:10 +0000 Subject: [PATCH] prevent possible NPE git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551386 13f79535-47bb-0310-9956-ffa450edef68 --- .../common/filelock/DefaultFileLockManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 ); } -- 2.39.5