From f8c0d2c83cb5f2adeba5791aeadbb551146049eb Mon Sep 17 00:00:00 2001 From: Shinsuke Sugaya Date: Sat, 12 Oct 2024 10:34:21 +0900 Subject: [PATCH] Refactor code --- .../fess/crawler/client/http/PlaywrightClient.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/codelibs/fess/crawler/client/http/PlaywrightClient.java b/src/main/java/org/codelibs/fess/crawler/client/http/PlaywrightClient.java index b40cf00..0d0b52b 100644 --- a/src/main/java/org/codelibs/fess/crawler/client/http/PlaywrightClient.java +++ b/src/main/java/org/codelibs/fess/crawler/client/http/PlaywrightClient.java @@ -155,7 +155,7 @@ protected Tuple4 createPlaywrightWork try { playwright = Playwright.create(new Playwright.CreateOptions().setEnv(options)); browser = getBrowserType(playwright).launch(launchOptions); - browserContext = this.createAuthenticatedContext(browser, newContextOptions); + browserContext = createAuthenticatedContext(browser, newContextOptions); page = browserContext.newPage(); } catch (final Exception e) { if (logger.isDebugEnabled()) { @@ -469,7 +469,7 @@ protected String getCharSet(final Response response) { if (StringUtil.isNotBlank(contentType)) { final String[] result = StreamUtil.split(contentType, ";").get(stream -> stream.map(s -> { final String[] values = s.split("="); - if ((values.length == 2) && "charset".equalsIgnoreCase(values[0].trim())) { + if (values.length == 2 && "charset".equalsIgnoreCase(values[0].trim())) { return values[1].trim(); } return null; @@ -504,7 +504,7 @@ protected NewContextOptions initNewContextOptions() { final String proxyBypass = getInitParameter(PROXY_BYPASS_PROPERTY, null, String.class); if (!StringUtils.isBlank(proxyHost)) { - final String proxyAddress = proxyPort == null ? proxyHost : (proxyHost + ":" + proxyPort); + final String proxyAddress = proxyPort == null ? proxyHost : proxyHost + ":" + proxyPort; final Proxy proxy = new Proxy(proxyAddress); if (proxyCredentials != null) { proxy.setUsername(proxyCredentials.getUserName()); @@ -540,7 +540,7 @@ protected BrowserContext createAuthenticatedContext(final Browser browser, final final BrowserContext playwrightContext = browser.newContext(newContextOptions); try (final var fessHttpClient = new HcHttpClient()) { - fessHttpClient.setInitParameterMap(this.initParamMap); + fessHttpClient.setInitParameterMap(initParamMap); fessHttpClient.init(); final List fessCookies = fessHttpClient.cookieStore.getCookies(); final List playwrightCookies = fessCookies.stream().map(apacheCookie -> { @@ -577,7 +577,7 @@ public void setDownloadTimeout(final int downloadTimeout) { } public void setRenderedState(final LoadState loadState) { - this.renderedState = loadState; + renderedState = loadState; } public void setCloseTimeout(final int closeTimeout) {