Skip to content

Commit

Permalink
Use default path if environment variable is not set or invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
chi3316 committed Sep 13, 2024
1 parent 957eb08 commit 748c938
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,14 @@ private void generateLatencyPointGraph() throws Exception {
ImageIO.write(png.getImage(), "png", file);
}

private String getValidLogFilePath(String envLogFilePath, String defaultFilePath) throws IOException {
private String getValidLogFilePath(String envLogFilePath, String defaultFilePath) {
if (envLogFilePath != null && !envLogFilePath.isEmpty()) {
Path path = Paths.get(envLogFilePath);
if (Files.exists(path) && Files.isReadable(path)) {
return envLogFilePath;
} else {
throw new IOException("CHAOS_MESH_LOG_FILE is set but the file does not exist or is not readable: " + envLogFilePath);
}
}
return defaultFilePath;
return defaultFilePath; // Use default path if environment variable is not set or invalid
}

private void renderPoint(JavaPlot plot, List<Point> dataSet, String title, int pointType, NamedPlotColor color) {
Expand Down

0 comments on commit 748c938

Please sign in to comment.