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 415df554a..23696b105 100644 --- a/src/main/java/org/codelibs/fess/api/json/SearchApiManager.java +++ b/src/main/java/org/codelibs/fess/api/json/SearchApiManager.java @@ -120,8 +120,7 @@ protected FormatType detectFormatType(final HttpServletRequest request) { return FormatType.SEARCH; } final String type = value.toLowerCase(Locale.ROOT); - switch (type) { - case "documents": + if ("documents".equals(type)) { if (values.length > 5 && "favorite".equals(values[5])) { request.setAttribute(DOC_ID_FIELD, values[4]); return FormatType.FAVORITE; @@ -130,18 +129,21 @@ protected FormatType detectFormatType(final HttpServletRequest request) { return FormatType.SCROLL; } return FormatType.SEARCH; - case "labels": + } + if ("labels".equals(type)) { return FormatType.LABEL; - case "popular-words": + } + if ("popular-words".equals(type)) { return FormatType.POPULARWORD; - case "favorites": + } + if ("favorites".equals(type)) { return FormatType.FAVORITES; - case "health": + } + if ("health".equals(type)) { return FormatType.PING; - case "suggest-words": + } + if ("suggest-words".equals(type)) { return FormatType.SUGGEST; - default: - break; } // default return FormatType.OTHER; diff --git a/src/main/java/org/codelibs/fess/app/web/admin/backup/AdminBackupAction.java b/src/main/java/org/codelibs/fess/app/web/admin/backup/AdminBackupAction.java index ca2a8abf3..b238a07d1 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/backup/AdminBackupAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/backup/AdminBackupAction.java @@ -319,17 +319,17 @@ public ActionResponse download(final String id) { } if (id.endsWith(NDJSON_EXTENTION)) { final String name = id.substring(0, id.length() - NDJSON_EXTENTION.length()); - switch (name) { - case "search_log": + if ("search_log".equals(name)) { return writeNdjsonResponse(id, getSearchLogNdjsonWriteCall()); - case "user_info": + } + if ("user_info".equals(name)) { return writeNdjsonResponse(id, getUserInfoNdjsonWriteCall()); - case "click_log": + } + if ("click_log".equals(name)) { return writeNdjsonResponse(id, getClickLogNdjsonWriteCall()); - case "favorite_log": + } + if ("favorite_log".equals(name)) { return writeNdjsonResponse(id, getFavoriteLogNdjsonWriteCall()); - default: - break; } } else if ("fess.json".equals(id)) { return asStream(id).contentTypeOctetStream().stream(out -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java b/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java index ca520826d..9b9c6ac4e 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java @@ -144,18 +144,12 @@ public HtmlResponse createnewjob(final String type, final String id, final Strin final String decodedName = new String(Base64.getUrlDecoder().decode(name), Constants.CHARSET_UTF_8); scheduledJobForm.name = MessageFormat.format(fessConfig.getJobTemplateTitle(type), decodedName); final String[] ids = { "", "", "" }; - switch (type) { - case Constants.WEB_CRAWLER_TYPE: + if (Constants.WEB_CRAWLER_TYPE.equals(type)) { ids[0] = "\"" + id + "\""; - break; - case Constants.FILE_CRAWLER_TYPE: + } else if (Constants.FILE_CRAWLER_TYPE.equals(type)) { ids[1] = "\"" + id + "\""; - break; - case Constants.DATA_CRAWLER_TYPE: + } else if (Constants.DATA_CRAWLER_TYPE.equals(type)) { ids[2] = "\"" + id + "\""; - break; - default: - break; } scheduledJobForm.scriptData = MessageFormat.format(fessConfig.getJobTemplateScript(), ids[0], ids[1], ids[2], id.replace('-', '_')); diff --git a/src/main/java/org/codelibs/fess/app/web/admin/upgrade/AdminUpgradeAction.java b/src/main/java/org/codelibs/fess/app/web/admin/upgrade/AdminUpgradeAction.java index 993441aa9..7d0b3967d 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/upgrade/AdminUpgradeAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/upgrade/AdminUpgradeAction.java @@ -191,8 +191,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { validate(form, messages -> {}, this::asIndexHtml); verifyToken(this::asIndexHtml); - switch (form.targetVersion) { - case VERSION_13_0: + if (VERSION_13_0.equals(form.targetVersion)) { try { upgradeFrom13_0(); upgradeFrom13_1(); @@ -237,8 +236,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_0, e.getLocalizedMessage())); } - break; - case VERSION_13_1: + } else if (VERSION_13_1.equals(form.targetVersion)) { try { upgradeFrom13_1(); upgradeFrom13_2(); @@ -283,8 +281,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_1, e.getLocalizedMessage())); } - break; - case VERSION_13_2: + } else if (VERSION_13_2.equals(form.targetVersion)) { try { upgradeFrom13_2(); upgradeFrom13_3(); @@ -328,8 +325,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_2, e.getLocalizedMessage())); } - break; - case VERSION_13_3: + } else if (VERSION_13_3.equals(form.targetVersion)) { try { upgradeFrom13_3(); upgradeFrom13_4(); @@ -372,8 +368,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_3, e.getLocalizedMessage())); } - break; - case VERSION_13_4: + } else if (VERSION_13_4.equals(form.targetVersion)) { try { upgradeFrom13_4(); upgradeFrom13_5(); @@ -415,8 +410,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_4, e.getLocalizedMessage())); } - break; - case VERSION_13_5: + } else if (VERSION_13_5.equals(form.targetVersion)) { try { upgradeFrom13_5(); upgradeFrom13_6(); @@ -457,8 +451,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_5, e.getLocalizedMessage())); } - break; - case VERSION_13_6: + } else if (VERSION_13_6.equals(form.targetVersion)) { try { upgradeFrom13_6(); upgradeFrom13_7(); @@ -498,8 +491,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_6, e.getLocalizedMessage())); } - break; - case VERSION_13_7: + } else if (VERSION_13_7.equals(form.targetVersion)) { try { upgradeFrom13_7(); upgradeFrom13_8(); @@ -538,8 +530,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_7, e.getLocalizedMessage())); } - break; - case VERSION_13_8: + } else if (VERSION_13_8.equals(form.targetVersion)) { try { upgradeFrom13_8(); upgradeFrom13_9(); @@ -577,8 +568,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_8, e.getLocalizedMessage())); } - break; - case VERSION_13_9: + } else if (VERSION_13_9.equals(form.targetVersion)) { try { upgradeFrom13_9(); upgradeFrom13_10(); @@ -615,8 +605,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_9, e.getLocalizedMessage())); } - break; - case VERSION_13_10: + } else if (VERSION_13_10.equals(form.targetVersion)) { try { upgradeFrom13_10(); upgradeFrom13_11(); @@ -652,8 +641,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_10, e.getLocalizedMessage())); } - break; - case VERSION_13_11: + } else if (VERSION_13_11.equals(form.targetVersion)) { try { upgradeFrom13_11(); upgradeFrom13_12(); @@ -687,8 +675,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_11, e.getLocalizedMessage())); } - break; - case VERSION_13_12: + } else if (VERSION_13_12.equals(form.targetVersion)) { try { upgradeFrom13_12(); upgradeFrom13_13(); @@ -721,8 +708,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_12, e.getLocalizedMessage())); } - break; - case VERSION_13_13: + } else if (VERSION_13_13.equals(form.targetVersion)) { try { upgradeFrom13_13(); upgradeFrom13_14(); @@ -754,8 +740,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_13, e.getLocalizedMessage())); } - break; - case VERSION_13_14: + } else if (VERSION_13_14.equals(form.targetVersion)) { try { upgradeFrom13_14(); upgradeFrom13_15(); @@ -786,8 +771,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_14, e.getLocalizedMessage())); } - break; - case VERSION_13_15: + } else if (VERSION_13_15.equals(form.targetVersion)) { try { upgradeFrom13_15(); upgradeFrom13_16(); @@ -818,8 +802,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_15, e.getLocalizedMessage())); } - break; - case VERSION_13_16: + } else if (VERSION_13_16.equals(form.targetVersion)) { try { upgradeFrom13_16(); upgradeFrom13_17(); @@ -849,8 +832,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_16, e.getLocalizedMessage())); } - break; - case VERSION_13_17: + } else if (VERSION_13_17.equals(form.targetVersion)) { try { upgradeFrom13_17(); upgradeFrom14_0(); @@ -879,8 +861,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_13_17, e.getLocalizedMessage())); } - break; - case VERSION_14_0: + } else if (VERSION_14_0.equals(form.targetVersion)) { try { upgradeFrom14_0(); upgradeFrom14_1(); @@ -908,8 +889,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_0, e.getLocalizedMessage())); } - break; - case VERSION_14_1: + } else if (VERSION_14_1.equals(form.targetVersion)) { try { upgradeFrom14_1(); upgradeFrom14_2(); @@ -936,8 +916,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_1, e.getLocalizedMessage())); } - break; - case VERSION_14_2: + } else if (VERSION_14_2.equals(form.targetVersion)) { try { upgradeFrom14_2(); upgradeFrom14_3(); @@ -963,8 +942,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_2, e.getLocalizedMessage())); } - break; - case VERSION_14_3: + } else if (VERSION_14_3.equals(form.targetVersion)) { try { upgradeFrom14_3(); upgradeFrom14_4(); @@ -989,8 +967,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_3, e.getLocalizedMessage())); } - break; - case VERSION_14_4: + } else if (VERSION_14_4.equals(form.targetVersion)) { try { upgradeFrom14_4(); upgradeFrom14_5(); @@ -1014,8 +991,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_4, e.getLocalizedMessage())); } - break; - case VERSION_14_5: + } else if (VERSION_14_5.equals(form.targetVersion)) { try { upgradeFrom14_5(); upgradeFrom14_6(); @@ -1038,8 +1014,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_5, e.getLocalizedMessage())); } - break; - case VERSION_14_6: + } else if (VERSION_14_6.equals(form.targetVersion)) { try { upgradeFrom14_6(); upgradeFrom14_7(); @@ -1061,8 +1036,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_6, e.getLocalizedMessage())); } - break; - case VERSION_14_7: + } else if (VERSION_14_7.equals(form.targetVersion)) { try { upgradeFrom14_7(); upgradeFrom14_8(); @@ -1083,8 +1057,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_7, e.getLocalizedMessage())); } - break; - case VERSION_14_8: + } else if (VERSION_14_8.equals(form.targetVersion)) { try { upgradeFrom14_8(); upgradeFrom14_9(); @@ -1104,8 +1077,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_8, e.getLocalizedMessage())); } - break; - case VERSION_14_9: + } else if (VERSION_14_9.equals(form.targetVersion)) { try { upgradeFrom14_9(); upgradeFrom14_10(); @@ -1124,8 +1096,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_9, e.getLocalizedMessage())); } - break; - case VERSION_14_10: + } else if (VERSION_14_10.equals(form.targetVersion)) { try { upgradeFrom14_10(); upgradeFrom14_11(); @@ -1143,8 +1114,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_10, e.getLocalizedMessage())); } - break; - case VERSION_14_11: + } else if (VERSION_14_11.equals(form.targetVersion)) { try { upgradeFrom14_11(); upgradeFrom14_12(); @@ -1161,8 +1131,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_11, e.getLocalizedMessage())); } - break; - case VERSION_14_12: + } else if (VERSION_14_12.equals(form.targetVersion)) { try { upgradeFrom14_12(); upgradeFrom14_13(); @@ -1178,8 +1147,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_12, e.getLocalizedMessage())); } - break; - case VERSION_14_13: + } else if (VERSION_14_13.equals(form.targetVersion)) { try { upgradeFrom14_13(); upgradeFrom14_14(); @@ -1194,8 +1162,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_13, e.getLocalizedMessage())); } - break; - case VERSION_14_14: + } else if (VERSION_14_14.equals(form.targetVersion)) { try { upgradeFrom14_14(); upgradeFrom14_15(); @@ -1209,8 +1176,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_14, e.getLocalizedMessage())); } - break; - case VERSION_14_15: + } else if (VERSION_14_15.equals(form.targetVersion)) { try { upgradeFrom14_15(); upgradeFrom14_16(); @@ -1223,8 +1189,7 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_15, e.getLocalizedMessage())); } - break; - case VERSION_14_16: + } else if (VERSION_14_16.equals(form.targetVersion)) { try { upgradeFrom14_16(); upgradeFromAll(); @@ -1236,10 +1201,8 @@ public HtmlResponse upgradeFrom(final UpgradeForm form) { logger.warn("Failed to upgrade data.", e); saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, VERSION_14_16, e.getLocalizedMessage())); } - break; - default: + } else { saveError(messages -> messages.addErrorsUnknownVersionForUpgrade(GLOBAL)); - break; } return redirect(getClass()); } diff --git a/src/main/java/org/codelibs/fess/app/web/api/admin/backup/ApiAdminBackupAction.java b/src/main/java/org/codelibs/fess/app/web/api/admin/backup/ApiAdminBackupAction.java index c21a0adf5..b373f1a0d 100644 --- a/src/main/java/org/codelibs/fess/app/web/api/admin/backup/ApiAdminBackupAction.java +++ b/src/main/java/org/codelibs/fess/app/web/api/admin/backup/ApiAdminBackupAction.java @@ -102,17 +102,17 @@ public JsonResponse files() { }); } final String name = id.substring(0, id.length() - NDJSON_EXTENTION.length()); - switch (name) { - case "search_log": + if ("search_log".equals(name)) { return writeNdjsonResponse(id, getSearchLogNdjsonWriteCall()); - case "user_info": + } + if ("user_info".equals(name)) { return writeNdjsonResponse(id, getUserInfoNdjsonWriteCall()); - case "click_log": + } + if ("click_log".equals(name)) { return writeNdjsonResponse(id, getClickLogNdjsonWriteCall()); - case "favorite_log": + } + if ("favorite_log".equals(name)) { return writeNdjsonResponse(id, getFavoriteLogNdjsonWriteCall()); - default: - break; } } diff --git a/src/main/java/org/codelibs/fess/es/config/exentity/DataConfig.java b/src/main/java/org/codelibs/fess/es/config/exentity/DataConfig.java index d0a3c26e2..548a61bbe 100644 --- a/src/main/java/org/codelibs/fess/es/config/exentity/DataConfig.java +++ b/src/main/java/org/codelibs/fess/es/config/exentity/DataConfig.java @@ -299,30 +299,21 @@ public CrawlerClientFactory initializeClientFactory(final Supplier paramMap, final String webAuthName, final String scheme) { AuthScheme authScheme = null; - switch (scheme) { - case Constants.BASIC: + if (Constants.BASIC.equals(scheme)) { authScheme = new BasicScheme(); - break; - case Constants.DIGEST: + } else if (Constants.DIGEST.equals(scheme)) { authScheme = new DigestScheme(); - break; - case Constants.NTLM: { + } else if (Constants.NTLM.equals(scheme)) { final Properties props = new Properties(); paramMap.entrySet().stream().filter(e -> e.getKey().startsWith("jcifs.")).forEach(e -> { props.setProperty(e.getKey(), e.getValue()); }); authScheme = new NTLMScheme(new JcifsEngine(props)); - break; - } - case Constants.FORM: { + } else if (Constants.FORM.equals(scheme)) { final String prefix = CRAWLER_WEB_AUTH + "." + webAuthName + "."; final Map parameterMap = paramMap.entrySet().stream().filter(e -> e.getKey().startsWith(prefix)) .collect(Collectors.toMap(e -> e.getKey().substring(prefix.length()), Entry::getValue)); authScheme = new FormScheme(parameterMap); - break; - } - default: - break; } return authScheme; } diff --git a/src/main/java/org/codelibs/fess/es/config/exentity/WebAuthentication.java b/src/main/java/org/codelibs/fess/es/config/exentity/WebAuthentication.java index cd60ad425..242229115 100644 --- a/src/main/java/org/codelibs/fess/es/config/exentity/WebAuthentication.java +++ b/src/main/java/org/codelibs/fess/es/config/exentity/WebAuthentication.java @@ -59,12 +59,13 @@ public Authentication getAuthentication() { private AuthScheme getAuthScheme() { final String scheme = getProtocolScheme(); - switch (scheme) { - case Constants.BASIC: + if (Constants.BASIC.equals(scheme)) { return new BasicScheme(); - case Constants.DIGEST: + } + if (Constants.DIGEST.equals(scheme)) { return new DigestScheme(); - case Constants.NTLM: { + } + if (Constants.NTLM.equals(scheme)) { final Properties props = new Properties(); getWebConfig().getConfigParameterMap(ConfigName.CONFIG).entrySet().stream() .filter(e -> e.getKey().startsWith(Config.JCIFS_PREFIX)).forEach(e -> { @@ -72,13 +73,10 @@ private AuthScheme getAuthScheme() { }); return new NTLMScheme(new JcifsEngine(props)); } - case Constants.FORM: { + if (Constants.FORM.equals(scheme)) { final Map parameterMap = ParameterUtil.parse(getParameters()); return new FormScheme(parameterMap); } - default: - break; - } return null; } diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java index baa4f7514..41d7cc52c 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java @@ -909,15 +909,14 @@ default String[] getSupportedUploadedMediaExtentionsAsArray() { String getJobTemplateTitleData(); default String getJobTemplateTitle(final String type) { - switch (type) { - case Constants.WEB_CRAWLER_TYPE: + if (Constants.WEB_CRAWLER_TYPE.equals(type)) { return getJobTemplateTitleWeb(); - case Constants.FILE_CRAWLER_TYPE: + } + if (Constants.FILE_CRAWLER_TYPE.equals(type)) { return getJobTemplateTitleFile(); - case Constants.DATA_CRAWLER_TYPE: + } + if (Constants.DATA_CRAWLER_TYPE.equals(type)) { return getJobTemplateTitleData(); - default: - break; } return "None"; } diff --git a/src/main/java/org/codelibs/fess/query/TermQueryCommand.java b/src/main/java/org/codelibs/fess/query/TermQueryCommand.java index 1b8b5d959..8aa63cc1a 100644 --- a/src/main/java/org/codelibs/fess/query/TermQueryCommand.java +++ b/src/main/java/org/codelibs/fess/query/TermQueryCommand.java @@ -72,15 +72,14 @@ protected QueryBuilder convertTermQuery(final FessConfig fessConfig, final Query if (fessConfig.getQueryReplaceTermWithPrefixQueryAsBoolean() && text.length() > 1 && text.endsWith("*")) { return convertPrefixQuery(fessConfig, context, termQuery, boost, field, text); } - switch (field) { - case DEFAULT_FIELD: + if (DEFAULT_FIELD.equals(field)) { return convertDefaultTermQuery(fessConfig, context, termQuery, boost, field, text); - case SORT_FIELD: + } + if (SORT_FIELD.equals(field)) { return convertSortQuery(fessConfig, context, termQuery, boost, field, text); - case SITE_FIELD: + } + if (SITE_FIELD.equals(field)) { return convertSiteQuery(fessConfig, context, termQuery, boost, field, text); - default: - break; } if (INURL_FIELD.equals(field) || StringUtil.equals(field, context.getDefaultField()) && fessConfig.getIndexFieldUrl().equals(context.getDefaultField())) { diff --git a/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java b/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java index 97601462b..fbcd8582d 100644 --- a/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java +++ b/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java @@ -173,8 +173,7 @@ public ServletContext getServletContext() { @Override public String getInitParameter(final String name) { - switch (name) { - case SpnegoHttpFilter.Constants.LOGGER_LEVEL: { + if (SpnegoHttpFilter.Constants.LOGGER_LEVEL.equals(name)) { final String logLevel = getProperty(SPNEGO_LOGGER_LEVEL, StringUtil.EMPTY); if (StringUtil.isNotBlank(logLevel)) { return logLevel; @@ -193,32 +192,41 @@ public String getInitParameter(final String name) { } return "0"; } - case SpnegoHttpFilter.Constants.LOGIN_CONF: + if (SpnegoHttpFilter.Constants.LOGIN_CONF.equals(name)) { return getResourcePath(getProperty(SPNEGO_LOGIN_CONF, "auth_login.conf")); - case SpnegoHttpFilter.Constants.KRB5_CONF: + } + if (SpnegoHttpFilter.Constants.KRB5_CONF.equals(name)) { return getResourcePath(getProperty(SPNEGO_KRB5_CONF, "krb5.conf")); - case SpnegoHttpFilter.Constants.CLIENT_MODULE: + } + if (SpnegoHttpFilter.Constants.CLIENT_MODULE.equals(name)) { return getProperty(SPNEGO_LOGIN_CLIENT_MODULE, "spnego-client"); - case SpnegoHttpFilter.Constants.SERVER_MODULE: + } + if (SpnegoHttpFilter.Constants.SERVER_MODULE.equals(name)) { return getProperty(SPNEGO_LOGIN_SERVER_MODULE, "spnego-server"); - case SpnegoHttpFilter.Constants.PREAUTH_USERNAME: + } + if (SpnegoHttpFilter.Constants.PREAUTH_USERNAME.equals(name)) { return getProperty(SPNEGO_PREAUTH_USERNAME, "username"); - case SpnegoHttpFilter.Constants.PREAUTH_PASSWORD: + } + if (SpnegoHttpFilter.Constants.PREAUTH_PASSWORD.equals(name)) { return getProperty(SPNEGO_PREAUTH_PASSWORD, "password"); - case SpnegoHttpFilter.Constants.ALLOW_BASIC: + } + if (SpnegoHttpFilter.Constants.ALLOW_BASIC.equals(name)) { return getProperty(SPNEGO_ALLOW_BASIC, "true"); - case SpnegoHttpFilter.Constants.ALLOW_UNSEC_BASIC: + } + if (SpnegoHttpFilter.Constants.ALLOW_UNSEC_BASIC.equals(name)) { return getProperty(SPNEGO_ALLOW_UNSECURE_BASIC, "true"); - case SpnegoHttpFilter.Constants.PROMPT_NTLM: + } + if (SpnegoHttpFilter.Constants.PROMPT_NTLM.equals(name)) { return getProperty(SPNEGO_PROMPT_NTLM, "true"); - case SpnegoHttpFilter.Constants.ALLOW_LOCALHOST: + } + if (SpnegoHttpFilter.Constants.ALLOW_LOCALHOST.equals(name)) { return getProperty(SPNEGO_ALLOW_LOCALHOST, "true"); - case SpnegoHttpFilter.Constants.ALLOW_DELEGATION: + } + if (SpnegoHttpFilter.Constants.ALLOW_DELEGATION.equals(name)) { return getProperty(SPNEGO_ALLOW_DELEGATION, "false"); - case SpnegoHttpFilter.Constants.EXCLUDE_DIRS: + } + if (SpnegoHttpFilter.Constants.EXCLUDE_DIRS.equals(name)) { return getProperty(SPNEGO_EXCLUDE_DIRS, StringUtil.EMPTY); - default: - break; } return null; }