Skip to content

Commit fb07bd4

Browse files
author
jantje
committed
Added try catch for #1073
1 parent ea23cd7 commit fb07bd4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

io.sloeber.core/src/io/sloeber/core/tools/Helpers.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -980,10 +980,7 @@ private static void setHookBuildEnvironmentVariable(IContributedEnvironment cont
980980
* @return the string to be stored as value for the environment variable
981981
*/
982982
public static String MakeEnvironmentString(String inputString, String keyPrefix, boolean touppercase) {
983-
// String ret = inputString.replaceAll("-o \"\\{object_file}\"",
984-
// "").replaceAll("\"\\{object_file}\"",
985-
// "").replaceAll("\"\\{source_file}\"", "")
986-
// .replaceAll("\\{", "\\${" + ArduinoConst.ENV_KEY_START);
983+
try {
987984
String ret = inputString.replaceAll("\\{(?!\\{)", "\\${" + keyPrefix);
988985
if (!touppercase) {
989986
return ret;
@@ -996,7 +993,12 @@ public static String MakeEnvironmentString(String inputString, String keyPrefix,
996993
String buf = sb.substring(matcher.start(), matcher.end()).toUpperCase();
997994
sb.replace(matcher.start(), matcher.end(), buf);
998995
}
999-
return sb.toString();
996+
return sb.toString();}
997+
catch (Exception e){
998+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
999+
"Failed to parse environment var "+inputString, e));
1000+
return inputString;
1001+
}
10001002
}
10011003

10021004
/**

0 commit comments

Comments
 (0)