瀏覽代碼

LabelTypeHelper: Add null guard for excludedPaths

This fixes a warning from LGTM:

    Variable excludedPaths may be null here as suggested
    by this null guard.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Stefan Weil 6 年之前
父節點
當前提交
8ea50e9a43
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      src/main/java/org/codelibs/fess/helper/LabelTypeHelper.java

+ 6 - 4
src/main/java/org/codelibs/fess/helper/LabelTypeHelper.java

@@ -261,11 +261,13 @@ public class LabelTypeHelper {
                 }
                 return false;
             } else {
-                final boolean match = !excludedPaths.matcher(path).matches();
-                if (!match && logger.isDebugEnabled()) {
-                    logger.debug("Path " + path + " matched against the excludes paths expression " + excludedPaths.toString());
+                if (excludedPaths != null && excludedPaths.matcher(path).matches()) {
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("Path " + path + " matched against the excludes paths expression " + excludedPaths.toString());
+                    }
+                    return false;
                 }
-                return match;
+                return true;
             }
         }