From ad36741433af869796b3bc01b0a4a22990f35012 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Wed, 21 Feb 2024 16:44:21 +0300 Subject: [PATCH] Fix some warnings --- .../java/com/epam/reportportal/util/test/ProcessUtils.java | 5 +++-- .../java/com/epam/reportportal/util/test/SocketUtils.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/epam/reportportal/util/test/ProcessUtils.java b/src/main/java/com/epam/reportportal/util/test/ProcessUtils.java index bf31d4e..265f733 100644 --- a/src/main/java/com/epam/reportportal/util/test/ProcessUtils.java +++ b/src/main/java/com/epam/reportportal/util/test/ProcessUtils.java @@ -26,6 +26,7 @@ import javax.annotation.Nullable; import java.io.*; import java.nio.charset.StandardCharsets; +import java.nio.file.FileSystems; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; @@ -52,7 +53,7 @@ private static String getPathToClass(@Nonnull Class mainClass) { public static Process buildProcess(boolean inheritOutput, @Nonnull Class mainClass, @Nullable Map additionalEnvironmentVariables, @Nullable Map additionSystemVariables, String... params) throws IOException { - String fileSeparator = System.getProperty("file.separator"); + String fileSeparator = FileSystems.getDefault().getSeparator(); String javaHome = System.getProperty("java.home"); String executablePath = joinWith(fileSeparator, javaHome, "bin", "java"); File executableFile = new File(executablePath); @@ -136,7 +137,7 @@ public static String waitForLine(final BufferedReader reader, final BufferedRead if (errorReader.ready()) { errorLines = IOUtils.readLines(errorReader); } - String lineSeparator = System.getProperty("line.separator"); + String lineSeparator = System.lineSeparator(); throw new IllegalStateException("Unable to run test class: " + String.join(lineSeparator, errorLines)); } } diff --git a/src/main/java/com/epam/reportportal/util/test/SocketUtils.java b/src/main/java/com/epam/reportportal/util/test/SocketUtils.java index 0e8d1b8..1aec9a4 100644 --- a/src/main/java/com/epam/reportportal/util/test/SocketUtils.java +++ b/src/main/java/com/epam/reportportal/util/test/SocketUtils.java @@ -67,7 +67,7 @@ public List call() throws Exception { StringBuilder builder = new StringBuilder(); String line; while ((line = in.readLine()) != null) { - if (line.equals("")) { + if (line.isEmpty()) { break; } builder.append(line);