From 4ef79bda84d9c52412fe368e3768545f93dd5e94 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Wed, 6 Sep 2023 08:20:06 -0500 Subject: [PATCH] [java] fix bug for appium subclass that sets neither log file nor output stream --- .../org/openqa/selenium/remote/service/DriverService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/org/openqa/selenium/remote/service/DriverService.java b/java/src/org/openqa/selenium/remote/service/DriverService.java index a34f594e5ff1a..f5313bf90ed8f 100644 --- a/java/src/org/openqa/selenium/remote/service/DriverService.java +++ b/java/src/org/openqa/selenium/remote/service/DriverService.java @@ -444,8 +444,12 @@ protected Duration getDefaultTimeout() { } protected OutputStream getLogOutput() { + if (logOutputStream != null) { + return logOutputStream; + } try { - return logOutputStream != null ? logOutputStream : new FileOutputStream(logFile); + File logFile = getLogFile(); + return logFile == null ? ByteStreams.nullOutputStream() : new FileOutputStream(logFile); } catch (FileNotFoundException e) { throw new RuntimeException(e); }