diff --git a/src/main/java/org/codelibs/fess/FessBoot.java b/src/main/java/org/codelibs/fess/FessBoot.java index 026e7b9fe..6f7958bc0 100644 --- a/src/main/java/org/codelibs/fess/FessBoot.java +++ b/src/main/java/org/codelibs/fess/FessBoot.java @@ -128,9 +128,10 @@ public class FessBoot extends TomcatBoot { return System.getProperty(TOMCAT_CONFIG_PATH); } + @Override protected void setupWebappContext() { super.setupWebappContext(); - Context context = (Context) server.getHost().findChild(StringUtil.EMPTY); + final Context context = (Context) server.getHost().findChild(StringUtil.EMPTY); context.setResources(new FessWebResourceRoot(context)); } } diff --git a/src/main/java/org/codelibs/fess/app/web/logout/LogoutAction.java b/src/main/java/org/codelibs/fess/app/web/logout/LogoutAction.java index 31de3b78e..95d2cde84 100644 --- a/src/main/java/org/codelibs/fess/app/web/logout/LogoutAction.java +++ b/src/main/java/org/codelibs/fess/app/web/logout/LogoutAction.java @@ -44,7 +44,7 @@ public class LogoutAction extends FessSearchAction { @Execute public HtmlResponse index() { - OptionalThing userBean = getUserBean(); + final OptionalThing userBean = getUserBean(); activityHelper.logout(userBean); final String redirectUrl = userBean.map(user -> ComponentUtil.getSsoManager().logout(user)).orElse(null); fessLoginAssist.logout(); diff --git a/src/main/java/org/codelibs/fess/dict/kuromoji/KuromojiItem.java b/src/main/java/org/codelibs/fess/dict/kuromoji/KuromojiItem.java index 2237eccad..5f931b869 100644 --- a/src/main/java/org/codelibs/fess/dict/kuromoji/KuromojiItem.java +++ b/src/main/java/org/codelibs/fess/dict/kuromoji/KuromojiItem.java @@ -15,6 +15,8 @@ */ package org.codelibs.fess.dict.kuromoji; +import java.util.Objects; + import org.codelibs.fess.dict.DictionaryItem; public class KuromojiItem extends DictionaryItem { @@ -129,32 +131,16 @@ public class KuromojiItem extends DictionaryItem { return false; } final KuromojiItem other = (KuromojiItem) obj; - if (pos == null) { - if (other.pos != null) { - return false; - } - } else if (!pos.equals(other.pos)) { + if (!Objects.equals(pos, other.pos)) { return false; } - if (reading == null) { - if (other.reading != null) { - return false; - } - } else if (!reading.equals(other.reading)) { + if (!Objects.equals(reading, other.reading)) { return false; } - if (segmentation == null) { - if (other.segmentation != null) { - return false; - } - } else if (!segmentation.equals(other.segmentation)) { + if (!Objects.equals(segmentation, other.segmentation)) { return false; } - if (token == null) { - if (other.token != null) { - return false; - } - } else if (!token.equals(other.token)) { + if (!Objects.equals(token, other.token)) { return false; } return true; diff --git a/src/main/java/org/codelibs/fess/dict/stemmeroverride/StemmerOverrideItem.java b/src/main/java/org/codelibs/fess/dict/stemmeroverride/StemmerOverrideItem.java index c47bc0a74..95da833e7 100644 --- a/src/main/java/org/codelibs/fess/dict/stemmeroverride/StemmerOverrideItem.java +++ b/src/main/java/org/codelibs/fess/dict/stemmeroverride/StemmerOverrideItem.java @@ -15,6 +15,8 @@ */ package org.codelibs.fess.dict.stemmeroverride; +import java.util.Objects; + import org.codelibs.core.lang.StringUtil; import org.codelibs.fess.dict.DictionaryItem; @@ -92,18 +94,10 @@ public class StemmerOverrideItem extends DictionaryItem { return false; } final StemmerOverrideItem other = (StemmerOverrideItem) obj; - if (input == null) { - if (other.input != null) { - return false; - } - } else if (!input.equals(other.input)) { + if (!Objects.equals(input, other.input)) { return false; } - if (output == null) { - if (other.output != null) { - return false; - } - } else if (!output.equals(other.output)) { + if (!Objects.equals(output, other.output)) { return false; } return true; diff --git a/src/main/java/org/codelibs/fess/tomcat/webresources/FessWebResourceRoot.java b/src/main/java/org/codelibs/fess/tomcat/webresources/FessWebResourceRoot.java index afde62015..bc4b282c7 100644 --- a/src/main/java/org/codelibs/fess/tomcat/webresources/FessWebResourceRoot.java +++ b/src/main/java/org/codelibs/fess/tomcat/webresources/FessWebResourceRoot.java @@ -29,21 +29,22 @@ import org.apache.catalina.webresources.StandardRoot; public class FessWebResourceRoot extends StandardRoot { private static final Logger logger = Logger.getLogger(FessWebResourceRoot.class.getName()); - public FessWebResourceRoot(Context context) { + public FessWebResourceRoot(final Context context) { super(context); } + @Override protected void processWebInfLib() throws LifecycleException { super.processWebInfLib(); - WebResource[] possibleJars = listResources("/WEB-INF/plugin", false); + final WebResource[] possibleJars = listResources("/WEB-INF/plugin", false); - for (WebResource possibleJar : possibleJars) { + for (final WebResource possibleJar : possibleJars) { if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) { try (final JarFile jarFile = new JarFile(possibleJar.getCanonicalPath())) { final Manifest manifest = jarFile.getManifest(); if (manifest != null && manifest.getEntries() != null) { - Attributes attributes = manifest.getMainAttributes(); + final Attributes attributes = manifest.getMainAttributes(); if (attributes != null && attributes.get("Fess-WebAppJar") != null) { createWebResourceSet(ResourceSetType.CLASSES_JAR, "/WEB-INF/classes", possibleJar.getURL(), "/"); }