You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/08/06 14:52:42 UTC

[activemq-artemis] branch master updated: ARTEMIS-2441 Avoiding NPE on FileLockNodeManager

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new e2d6d07  ARTEMIS-2441 Avoiding NPE on FileLockNodeManager
e2d6d07 is described below

commit e2d6d0729818ea9ba8b1bcd5781d2702502dd9b1
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Aug 6 10:34:55 2019 -0400

    ARTEMIS-2441 Avoiding NPE on FileLockNodeManager
---
 .../artemis/core/server/impl/FileLockNodeManager.java      | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
index e050e94..66ebbdc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
@@ -106,12 +106,14 @@ public class FileLockNodeManager extends NodeManager {
    @Override
    public synchronized void stop() throws Exception {
       for (FileChannel channel : lockChannels) {
-         try {
-            channel.close();
-         } catch (Throwable e) {
-            // I do not want to interrupt a shutdown. If anything is wrong here, just log it
-            // it could be a critical error or something like that throwing the system down
-            logger.warn(e.getMessage(), e);
+         if (channel != null && channel.isOpen()) {
+            try {
+               channel.close();
+            } catch (Throwable e) {
+               // I do not want to interrupt a shutdown. If anything is wrong here, just log it
+               // it could be a critical error or something like that throwing the system down
+               logger.warn(e.getMessage(), e);
+            }
          }
       }