diff --git a/src/main/java/org/codelibs/fess/api/BaseApiManager.java b/src/main/java/org/codelibs/fess/api/BaseApiManager.java index 4ac4e26b6..54bf9ee9e 100644 --- a/src/main/java/org/codelibs/fess/api/BaseApiManager.java +++ b/src/main/java/org/codelibs/fess/api/BaseApiManager.java @@ -68,29 +68,35 @@ public abstract class BaseApiManager implements WebApiManager { } if (value == null) { return FormatType.SEARCH; - } else { - final String type = value.toUpperCase(Locale.ROOT); - if (FormatType.SEARCH.name().equals(type)) { - return FormatType.SEARCH; - } else if (FormatType.LABEL.name().equals(type)) { - return FormatType.LABEL; - } else if (FormatType.POPULARWORD.name().equals(type)) { - return FormatType.POPULARWORD; - } else if (FormatType.FAVORITE.name().equals(type)) { - return FormatType.FAVORITE; - } else if (FormatType.FAVORITES.name().equals(type)) { - return FormatType.FAVORITES; - } else if (FormatType.PING.name().equals(type)) { - return FormatType.PING; - } else if (FormatType.SCROLL.name().equals(type)) { - return FormatType.SCROLL; - } else if (FormatType.SUGGEST.name().equals(type)) { - return FormatType.SUGGEST; - } else { - // default - return FormatType.OTHER; - } } + final String type = value.toUpperCase(Locale.ROOT); + if (FormatType.SEARCH.name().equals(type)) { + return FormatType.SEARCH; + } + if (FormatType.LABEL.name().equals(type)) { + return FormatType.LABEL; + } + if (FormatType.POPULARWORD.name().equals(type)) { + return FormatType.POPULARWORD; + } + if (FormatType.FAVORITE.name().equals(type)) { + return FormatType.FAVORITE; + } + if (FormatType.FAVORITES.name().equals(type)) { + return FormatType.FAVORITES; + } + if (FormatType.PING.name().equals(type)) { + return FormatType.PING; + } + if (FormatType.SCROLL.name().equals(type)) { + return FormatType.SCROLL; + } + if (FormatType.SUGGEST.name().equals(type)) { + return FormatType.SUGGEST; + } + + // default + return FormatType.OTHER; } protected void write(final String text, final String contentType, final String encoding) { diff --git a/src/main/java/org/codelibs/fess/api/json/SearchApiManager.java b/src/main/java/org/codelibs/fess/api/json/SearchApiManager.java index c556d9c94..34183dbcb 100644 --- a/src/main/java/org/codelibs/fess/api/json/SearchApiManager.java +++ b/src/main/java/org/codelibs/fess/api/json/SearchApiManager.java @@ -127,22 +127,27 @@ public class SearchApiManager extends BaseApiManager { } // return FormatType.SCROLL; return FormatType.SEARCH; - } else if ("labels".equals(type)) { - return FormatType.LABEL; - } else if ("popular-words".equals(type)) { - return FormatType.POPULARWORD; - } else if ("favorites".equals(type)) { - return FormatType.FAVORITES; - } else if ("health".equals(type)) { - return FormatType.PING; - } else if ("suggest-words".equals(type)) { - return FormatType.SUGGEST; - } else if ("scroll".equals(type)) { - return FormatType.SCROLL; - } else { - // default - return FormatType.OTHER; } + if ("labels".equals(type)) { + return FormatType.LABEL; + } + if ("popular-words".equals(type)) { + return FormatType.POPULARWORD; + } + if ("favorites".equals(type)) { + return FormatType.FAVORITES; + } + if ("health".equals(type)) { + return FormatType.PING; + } + if ("suggest-words".equals(type)) { + return FormatType.SUGGEST; + } + if ("scroll".equals(type)) { + return FormatType.SCROLL; + } + // default + return FormatType.OTHER; } @Override @@ -192,7 +197,7 @@ public class SearchApiManager extends BaseApiManager { protected boolean acceptHttpMethod(final HttpServletRequest request, final String... methods) { final String method = request.getMethod(); - for (String m : methods) { + for (final String m : methods) { if (m.equals(method)) { return true; } diff --git a/src/main/java/org/codelibs/fess/es/client/SearchEngineClient.java b/src/main/java/org/codelibs/fess/es/client/SearchEngineClient.java index d49b1ad3f..9279480da 100644 --- a/src/main/java/org/codelibs/fess/es/client/SearchEngineClient.java +++ b/src/main/java/org/codelibs/fess/es/client/SearchEngineClient.java @@ -1211,7 +1211,7 @@ public class SearchEngineClient implements Client { throw new SearchEngineClientException(response.buildFailureMessage()); } - return Arrays.stream(response.getItems()).map(res -> res.getId()).toArray(n -> new String[n]); + return Arrays.stream(response.getItems()).map(BulkItemResponse::getId).toArray(n -> new String[n]); } public static class SearchConditionBuilder { diff --git a/src/main/java/org/codelibs/fess/helper/ActivityHelper.java b/src/main/java/org/codelibs/fess/helper/ActivityHelper.java index d42506ca6..741714e9a 100644 --- a/src/main/java/org/codelibs/fess/helper/ActivityHelper.java +++ b/src/main/java/org/codelibs/fess/helper/ActivityHelper.java @@ -82,7 +82,7 @@ public class ActivityHelper { valueMap.put("action", Action.LOGIN_FAILURE.name()); credential.ifPresent(c -> { valueMap.put("class", c.getClass().getSimpleName()); - if (c instanceof FessCredential fessCredential) { + if (c instanceof final FessCredential fessCredential) { valueMap.put("user", fessCredential.getUserId()); } }); @@ -177,15 +177,15 @@ public class ActivityHelper { this.permissionSeparator = permissionSeparator; } - public void setEcsVersion(String ecsVersion) { + public void setEcsVersion(final String ecsVersion) { this.ecsVersion = ecsVersion; } - public void setEcsServiceName(String ecsServiceName) { + public void setEcsServiceName(final String ecsServiceName) { this.ecsServiceName = ecsServiceName; } - public void setEcsEventDataset(String ecsEventDataset) { + public void setEcsEventDataset(final String ecsEventDataset) { this.ecsEventDataset = ecsEventDataset; } } diff --git a/src/main/java/org/codelibs/fess/helper/SuggestHelper.java b/src/main/java/org/codelibs/fess/helper/SuggestHelper.java index 520a73064..171d8113f 100644 --- a/src/main/java/org/codelibs/fess/helper/SuggestHelper.java +++ b/src/main/java/org/codelibs/fess/helper/SuggestHelper.java @@ -398,7 +398,7 @@ public class SuggestHelper { } } - public void setSearchStoreInterval(long searchStoreInterval) { + public void setSearchStoreInterval(final long searchStoreInterval) { this.searchStoreInterval = searchStoreInterval; } } diff --git a/src/main/java/org/codelibs/fess/thumbnail/ThumbnailManager.java b/src/main/java/org/codelibs/fess/thumbnail/ThumbnailManager.java index 9bedad926..3634374b8 100644 --- a/src/main/java/org/codelibs/fess/thumbnail/ThumbnailManager.java +++ b/src/main/java/org/codelibs/fess/thumbnail/ThumbnailManager.java @@ -543,7 +543,7 @@ public class ThumbnailManager { this.noImageExpired = noImageExpired; } - public void setSplitHashSize(int splitHashSize) { + public void setSplitHashSize(final int splitHashSize) { this.splitHashSize = splitHashSize; } diff --git a/src/main/java/org/codelibs/fess/thumbnail/impl/BaseThumbnailGenerator.java b/src/main/java/org/codelibs/fess/thumbnail/impl/BaseThumbnailGenerator.java index 96ee14666..dbbadfe30 100644 --- a/src/main/java/org/codelibs/fess/thumbnail/impl/BaseThumbnailGenerator.java +++ b/src/main/java/org/codelibs/fess/thumbnail/impl/BaseThumbnailGenerator.java @@ -84,7 +84,7 @@ public abstract class BaseThumbnailGenerator implements ThumbnailGenerator { return false; } for (final Map.Entry entry : conditionMap.entrySet()) { - if (docMap.get(entry.getKey()) instanceof String value && value.matches(entry.getValue())) { + if (docMap.get(entry.getKey()) instanceof final String value && value.matches(entry.getValue())) { if (logger.isDebugEnabled()) { logger.debug("[{}] match {}:{}", entry.getKey(), name, value); } diff --git a/src/main/java/org/codelibs/fess/util/SearchEngineUtil.java b/src/main/java/org/codelibs/fess/util/SearchEngineUtil.java index 023af4fad..bc40b795d 100644 --- a/src/main/java/org/codelibs/fess/util/SearchEngineUtil.java +++ b/src/main/java/org/codelibs/fess/util/SearchEngineUtil.java @@ -63,7 +63,7 @@ public final class SearchEngineUtil { public static String getXContentString(final ToXContent xContent, final XContentType xContentType) { try { return XContentHelper.toXContent(xContent, xContentType, ToXContent.EMPTY_PARAMS, false).utf8ToString(); - } catch (IOException e) { + } catch (final IOException e) { throw new IORuntimeException(e); } }