You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stormcrawler.apache.org by jn...@apache.org on 2024/10/18 09:36:13 UTC

(incubator-stormcrawler) branch PWremoteOverWS updated: Fixed format

This is an automated email from the ASF dual-hosted git repository.

jnioche pushed a commit to branch PWremoteOverWS
in repository https://gitbox.apache.org/repos/asf/incubator-stormcrawler.git


The following commit(s) were added to refs/heads/PWremoteOverWS by this push:
     new 9a9f41e2 Fixed format
9a9f41e2 is described below

commit 9a9f41e2ed9c7f7ee9cc394fe16527956557b582
Author: Julien Nioche <ju...@digitalpebble.com>
AuthorDate: Fri Oct 18 10:36:03 2024 +0100

    Fixed format
    
    Signed-off-by: Julien Nioche <ju...@digitalpebble.com>
---
 .../stormcrawler/protocol/playwright/HttpProtocol.java     | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/external/playwright/src/main/java/org/apache/stormcrawler/protocol/playwright/HttpProtocol.java b/external/playwright/src/main/java/org/apache/stormcrawler/protocol/playwright/HttpProtocol.java
index 82d33e00..0dc698d8 100644
--- a/external/playwright/src/main/java/org/apache/stormcrawler/protocol/playwright/HttpProtocol.java
+++ b/external/playwright/src/main/java/org/apache/stormcrawler/protocol/playwright/HttpProtocol.java
@@ -37,7 +37,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-
 import org.apache.commons.lang.StringUtils;
 import org.apache.storm.Config;
 import org.apache.storm.utils.MutableInt;
@@ -106,7 +105,7 @@ public class HttpProtocol extends AbstractHttpProtocol {
         final Map<String, String> env = new HashMap<>();
 
         // no need to download if we are connecting to a remote instance
-        if (StringUtils.isNotBlank(CDP_URL) || StringUtils.isNotBlank(REMOTE_WS)){
+        if (StringUtils.isNotBlank(CDP_URL) || StringUtils.isNotBlank(REMOTE_WS)) {
             skipDownloads = true;
         }
 
@@ -118,13 +117,12 @@ public class HttpProtocol extends AbstractHttpProtocol {
         creationOptions.setEnv(env);
 
         BrowserType btype = Playwright.create(creationOptions).chromium();
-        if (StringUtils.isNotBlank(CDP_URL) && StringUtils.isNotBlank(REMOTE_WS)){
-            throw new RuntimeException("Can't specify both cdp.url and remote.ws in the configuration");
-        }
-        else if (StringUtils.isNotBlank(CDP_URL)) {
+        if (StringUtils.isNotBlank(CDP_URL) && StringUtils.isNotBlank(REMOTE_WS)) {
+            throw new RuntimeException(
+                    "Can't specify both cdp.url and remote.ws in the configuration");
+        } else if (StringUtils.isNotBlank(CDP_URL)) {
             browser = btype.connectOverCDP(CDP_URL);
-        }
-        else if (StringUtils.isNotBlank(REMOTE_WS)) {
+        } else if (StringUtils.isNotBlank(REMOTE_WS)) {
             browser = btype.connect(REMOTE_WS);
         } else {
             browser = btype.launch();