From be8fc7e1809dfdba95b4047bd407c02262662a86 Mon Sep 17 00:00:00 2001 From: mk868 Date: Fri, 15 Nov 2024 10:12:37 +0100 Subject: [PATCH] [java] Fix SpotBugs bugs in the Selenium manager (#14608) Co-authored-by: Viet Nguyen Duc --- java/spotbugs-excludes.xml | 5 +++++ java/src/org/openqa/selenium/manager/SeleniumManager.java | 2 +- .../org/openqa/selenium/manager/SeleniumManagerOutput.java | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/java/spotbugs-excludes.xml b/java/spotbugs-excludes.xml index 389ebc78a76f3..d62598f910a60 100644 --- a/java/spotbugs-excludes.xml +++ b/java/spotbugs-excludes.xml @@ -230,4 +230,9 @@ + + + + + diff --git a/java/src/org/openqa/selenium/manager/SeleniumManager.java b/java/src/org/openqa/selenium/manager/SeleniumManager.java index f212b2b899d05..b907d8ab755ec 100644 --- a/java/src/org/openqa/selenium/manager/SeleniumManager.java +++ b/java/src/org/openqa/selenium/manager/SeleniumManager.java @@ -213,7 +213,7 @@ private synchronized Path getBinary() { if (!binary.toFile().exists()) { String binaryPathInJar = String.format("%s/%s%s", folder, SELENIUM_MANAGER, extension); try (InputStream inputStream = this.getClass().getResourceAsStream(binaryPathInJar)) { - binary.getParent().toFile().mkdirs(); + Files.createDirectories(binary.getParent()); Files.copy(inputStream, binary); } } diff --git a/java/src/org/openqa/selenium/manager/SeleniumManagerOutput.java b/java/src/org/openqa/selenium/manager/SeleniumManagerOutput.java index 62bc45273cbe5..1faee3a809729 100644 --- a/java/src/org/openqa/selenium/manager/SeleniumManagerOutput.java +++ b/java/src/org/openqa/selenium/manager/SeleniumManagerOutput.java @@ -98,6 +98,10 @@ private static Log fromJson(JsonInput input) { case "message": message = input.nextString(); break; + + default: + input.skipValue(); + break; } } input.endObject();