mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Refactor: removed useless parameter from StringReplacer.formatAndSplit
This commit is contained in:
parent
0a0d3c88e0
commit
5428420e0a
@ -405,7 +405,7 @@ public class Compiler implements MessageConsumer {
|
||||
String[] cmdArray;
|
||||
String cmd = prefs.getOrExcept(recipe);
|
||||
try {
|
||||
cmdArray = StringReplacer.formatAndSplit(cmd, dict, true);
|
||||
cmdArray = StringReplacer.formatAndSplit(cmd, dict);
|
||||
} catch (Exception e) {
|
||||
throw new RunnerException(e);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class GenericNetworkUploader extends Uploader {
|
||||
pattern = prefs.get("upload.network_pattern");
|
||||
if(pattern == null)
|
||||
pattern = prefs.getOrExcept("upload.pattern");
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
uploadResult = executeUploadCommand(cmd);
|
||||
} catch (RunnerException e) {
|
||||
throw e;
|
||||
|
@ -165,7 +165,7 @@ public class SSHUploader extends Uploader {
|
||||
}
|
||||
|
||||
String pattern = prefs.getOrExcept("upload.pattern");
|
||||
String command = StringUtils.join(StringReplacer.formatAndSplit(pattern, prefs, true), " ");
|
||||
String command = StringUtils.join(StringReplacer.formatAndSplit(pattern, prefs), " ");
|
||||
if (verbose) {
|
||||
System.out.println(command);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class SerialUploader extends Uploader {
|
||||
boolean uploadResult;
|
||||
try {
|
||||
String pattern = prefs.getOrExcept("upload.pattern");
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
uploadResult = executeUploadCommand(cmd);
|
||||
} catch (Exception e) {
|
||||
throw new RunnerException(e);
|
||||
@ -200,7 +200,7 @@ public class SerialUploader extends Uploader {
|
||||
boolean uploadResult;
|
||||
try {
|
||||
String pattern = prefs.getOrExcept("upload.pattern");
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
uploadResult = executeUploadCommand(cmd);
|
||||
} catch (RunnerException e) {
|
||||
throw e;
|
||||
@ -330,7 +330,7 @@ public class SerialUploader extends Uploader {
|
||||
|
||||
try {
|
||||
String pattern = prefs.getOrExcept("program.pattern");
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
return executeUploadCommand(cmd);
|
||||
} catch (RunnerException e) {
|
||||
throw e;
|
||||
@ -394,12 +394,12 @@ public class SerialUploader extends Uploader {
|
||||
new LoadVIDPIDSpecificPreferences().load(prefs);
|
||||
|
||||
String pattern = prefs.getOrExcept("erase.pattern");
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
if (!executeUploadCommand(cmd))
|
||||
return false;
|
||||
|
||||
pattern = prefs.getOrExcept("bootloader.pattern");
|
||||
cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
cmd = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
return executeUploadCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class Sizer implements MessageConsumer {
|
||||
int r = 0;
|
||||
try {
|
||||
String pattern = prefs.get("recipe.size.pattern");
|
||||
String cmd[] = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||
String cmd[] = StringReplacer.formatAndSplit(pattern, prefs);
|
||||
|
||||
exception = null;
|
||||
textSize = -1;
|
||||
|
@ -27,16 +27,13 @@ import java.util.Map;
|
||||
|
||||
public class StringReplacer {
|
||||
|
||||
public static String[] formatAndSplit(String src, Map<String, String> dict,
|
||||
boolean recursive) throws Exception {
|
||||
public static String[] formatAndSplit(String src, Map<String, String> dict) throws Exception {
|
||||
String res;
|
||||
|
||||
// Recursive replace with a max depth of 10 levels.
|
||||
for (int i = 0; i < 10; i++) {
|
||||
// Do a replace with dictionary
|
||||
res = StringReplacer.replaceFromMapping(src, dict);
|
||||
if (!recursive)
|
||||
break;
|
||||
if (res.equals(src))
|
||||
break;
|
||||
src = res;
|
||||
|
Loading…
Reference in New Issue
Block a user