From 8dcfe79b2d1719d82f499f04d0f7baf93bfa015d Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Sat, 20 Feb 2021 22:18:34 +0100 Subject: [PATCH] [grid] Declaring individual imports --- .../selenium/grid/log/LoggingOptions.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/java/server/src/org/openqa/selenium/grid/log/LoggingOptions.java b/java/server/src/org/openqa/selenium/grid/log/LoggingOptions.java index 1c077ad1f074b..c15bce8e02b0a 100644 --- a/java/server/src/org/openqa/selenium/grid/log/LoggingOptions.java +++ b/java/server/src/org/openqa/selenium/grid/log/LoggingOptions.java @@ -23,8 +23,13 @@ import org.openqa.selenium.remote.tracing.empty.NullTracer; import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer; -import java.io.*; -import java.util.*; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.Enumeration; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; @@ -34,10 +39,8 @@ public class LoggingOptions { private static final Logger LOG = Logger.getLogger(LoggingOptions.class.getName()); private static final String LOGGING_SECTION = "logging"; - - private Level level = Level.INFO; - private final Config config; + private Level level = Level.INFO; public LoggingOptions(Config config) { this.config = Require.nonNull("Config", config); @@ -137,7 +140,7 @@ private void configureLogEncoding(Logger logger, String encoding, Handler handle } } catch (UnsupportedEncodingException e) { message = - String.format("Using the system default encoding. Unsupported encoding %s", encoding); + String.format("Using the system default encoding. Unsupported encoding %s", encoding); } logger.addHandler(handler); logger.log(Level.INFO, message); @@ -145,13 +148,13 @@ private void configureLogEncoding(Logger logger, String encoding, Handler handle private OutputStream getOutputStream() { return config.get(LOGGING_SECTION, "log-file") - .map(fileName -> { - try { - return (OutputStream) new FileOutputStream(fileName); - } catch (FileNotFoundException e) { - throw new UncheckedIOException(e); - } - }) - .orElse(System.out); + .map(fileName -> { + try { + return (OutputStream) new FileOutputStream(fileName); + } catch (FileNotFoundException e) { + throw new UncheckedIOException(e); + } + }) + .orElse(System.out); } }