Procházet zdrojové kódy

Merge pull request #1869 from stweil/lgtm

Fix some warnings from LGTM
Shinsuke Sugaya před 6 roky
rodič
revize
4d8f69fa28

+ 1 - 1
src/main/java/org/codelibs/fess/api/gsa/GsaApiManager.java

@@ -260,7 +260,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
                                 final String tagName =
                                         name.replaceFirst("^" + gsaMetaPrefix, StringUtil.EMPTY).replaceAll(GSA_META_SUFFIX + "\\z",
                                                 StringUtil.EMPTY);
-                                if (getFields != null && getFields.contains(tagName)) {
+                                if (getFields.contains(tagName)) {
                                     buf.append("<MT N=\"");
                                     buf.append(tagName);
                                     buf.append("\" V=\"");

+ 1 - 4
src/main/java/org/codelibs/fess/dict/protwords/ProtwordsFile.java

@@ -134,10 +134,7 @@ public class ProtwordsFile extends DictionaryFile<ProtwordsItem> {
                 }
 
                 final String inputStrings = line;
-                String input = null;
-                if (inputStrings != null) {
-                    input = unescape(inputStrings);
-                }
+                String input = unescape(inputStrings);
 
                 if (input.length() > 0) {
                     id++;

+ 1 - 4
src/main/java/org/codelibs/fess/dict/stopwords/StopwordsFile.java

@@ -134,10 +134,7 @@ public class StopwordsFile extends DictionaryFile<StopwordsItem> {
                 }
 
                 final String inputStrings = line;
-                String input = null;
-                if (inputStrings != null) {
-                    input = unescape(inputStrings);
-                }
+                String input = unescape(inputStrings);
 
                 if (input.length() > 0) {
                     id++;

+ 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 " + includedPaths.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;
             }
         }