From b93563718694e8e4081047c8a2104f3f079efd92 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 24 Apr 2024 13:19:27 +0200 Subject: [PATCH] Avoid deeply nesting log file when running tests Fixes #40196 --- .../quarkus/test/common/PropertyTestUtil.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/PropertyTestUtil.java b/test-framework/common/src/main/java/io/quarkus/test/common/PropertyTestUtil.java index 18366b7860861b..dfd24daba6e283 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/PropertyTestUtil.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/PropertyTestUtil.java @@ -22,23 +22,17 @@ public static void setLogFileProperty(String logFileName) { } public static String getLogFileLocation() { - return getLogFileLocation(getLogFinalName()); - } + String logFilePath = System.getProperty(LOG_FILE_PATH_PROPERTY); + + if (logFilePath != null) { + return logFilePath; + } - private static String getLogFinalName() { - return System.getProperty(LOG_FILE_PATH_PROPERTY, FileConfig.DEFAULT_LOG_FILE_NAME); + return getLogFileLocation(FileConfig.DEFAULT_LOG_FILE_NAME); } public static Path getLogFilePath() { - List logFileLocationParts = getLogFileLocationParts(getLogFinalName()); - if (logFileLocationParts.isEmpty()) { - throw new IllegalStateException("Unable to determine log file path"); - } else if (logFileLocationParts.size() == 1) { - return Paths.get(logFileLocationParts.get(0)); - } else { - return Paths.get(logFileLocationParts.get(0), - logFileLocationParts.subList(1, logFileLocationParts.size()).toArray(new String[0])); - } + return Paths.get(getLogFileLocation()); } private static String getLogFileLocation(String logFileName) {