LabelTypeHelper: Add null guard for excludedPaths
This fixes a warning from LGTM:
Variable excludedPaths may be null here as suggested
by this null guard.
@@ -261,11 +261,13 @@ public class LabelTypeHelper {
}
return false;
} else {
- final boolean match = !excludedPaths.matcher(path).matches();
- if (!match && logger.isDebugEnabled()) {
+ if (excludedPaths != null && excludedPaths.matcher(path).matches()) {
+ if (logger.isDebugEnabled()) {
logger.debug("Path " + path + " matched against the excludes paths expression " + excludedPaths.toString());
}
- return match;
+ return false;
+ }
+ return true;
}
}
