From a38eda163d9d176615e85eead5eb6c299129d575 Mon Sep 17 00:00:00 2001 From: BeardyKing <39307332+BeardyKing@users.noreply.github.com> Date: Sat, 2 Dec 2023 22:52:38 +0000 Subject: [PATCH] Fixed workspace breakage on failed env var resolve If we failed to resolve the contents of <> to some environment variable we will have extra symbols that will break XML so we need to replace them with "<" and ">" this also meant prior to this if you tried to use these symbols it would break your workspace. --- .../com/github/beardyking/simpleclargs/ui/CLArgumentTree.java | 4 ++++ .../simpleclargs/utils/EnvironmentVariableExtractor.java | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/beardyking/simpleclargs/ui/CLArgumentTree.java b/src/main/java/com/github/beardyking/simpleclargs/ui/CLArgumentTree.java index 1d0f842..2177864 100644 --- a/src/main/java/com/github/beardyking/simpleclargs/ui/CLArgumentTree.java +++ b/src/main/java/com/github/beardyking/simpleclargs/ui/CLArgumentTree.java @@ -55,6 +55,10 @@ public void updateClargData(String inCommandLineArguments) { assert workspaceFile != null; System.out.println(workspaceFile.getName()); + // if we don't resolve environment variable we will have extra "<" and ">" which will break the XML in workspace.xml + inCommandLineArguments = inCommandLineArguments.replace("<", "<"); + inCommandLineArguments = inCommandLineArguments.replace(">", ">"); + try { String xmlContent = new String(workspaceFile.contentsToByteArray(), workspaceFile.getCharset()); String tagToSearch = "