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/02/19 22:35:09 UTC

[activemq-artemis] branch master updated: NO-JIRA Fix a "Dereference null return value" Coverity Scan warning

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 b8df8de  NO-JIRA Fix a "Dereference null return value" Coverity Scan warning
     new a683819  This closes #2552
b8df8de is described below

commit b8df8dead373fd43ca184568a606d90389dff70e
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Thu Feb 14 15:50:03 2019 +0100

    NO-JIRA Fix a "Dereference null return value" Coverity Scan warning
    
    The value checked for null was not the one that was subsequently used.
---
 .../java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java  | 2 +-
 .../java/org/apache/activemq/artemis/component/WebTmpCleaner.java | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java
index 82724c1..d998715 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java
@@ -146,7 +146,7 @@ public class SpawnedVMSupport {
       if (files == null) {
          return getClassPath();
       } else {
-         for (File f : libfolder.listFiles()) {
+         for (File f : files) {
             if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip")) {
                if (!empty) {
                   stringBuilder.append(File.pathSeparator);
diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java
index 0bc0b67..478a012 100644
--- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java
+++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java
@@ -65,9 +65,11 @@ public class WebTmpCleaner {
    public static final void deleteFolder(final File file) {
       if (file.isDirectory()) {
          String[] files = file.list();
-         for (String path : files) {
-            File f = new File(file, path);
-            deleteFolder(f);
+         if (files != null) {
+            for (String path : files) {
+               File f = new File(file, path);
+               deleteFolder(f);
+            }
          }
       }
       file.delete();