Skip to content

Commit

Permalink
Fixed workspace breakage on failed env var resolve
Browse files Browse the repository at this point in the history
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 "&lt;" and "&gt;" this also meant prior to this if you tried to use these symbols it would break your workspace.
  • Loading branch information
BeardyKing committed Dec 2, 2023
1 parent a99f326 commit a38eda1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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("<", "&lt;");
inCommandLineArguments = inCommandLineArguments.replace(">", "&gt;");

try {
String xmlContent = new String(workspaceFile.contentsToByteArray(), workspaceFile.getCharset());
String tagToSearch = "<configuration name=";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public static String extractEnvironmentVariables(String input) {
String variableValue = System.getenv(variableName);

if (variableValue != null) {

String replacement = Matcher.quoteReplacement(variableValue);
matcher.appendReplacement(result, replacement);
} else {
Expand Down

0 comments on commit a38eda1

Please sign in to comment.