From 675447a6abace48b670deaeb525e23d15996f60c Mon Sep 17 00:00:00 2001 From: Maciej Kucharczyk Date: Wed, 16 Oct 2024 18:55:23 +0200 Subject: [PATCH] [java] Fix SpotBugs bugs in SeleniumManager --- 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 2c7acdbc9f1b5..f761fe7e2df43 100644 --- a/java/src/org/openqa/selenium/manager/SeleniumManager.java +++ b/java/src/org/openqa/selenium/manager/SeleniumManager.java @@ -209,7 +209,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();