fixbug: varPool value is error (#7724)

ui-next
Ivan0626 2022-02-23 14:53:20 +08:00 committed by GitHub
parent 209aa0a0bf
commit 60ddede6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -24,6 +24,8 @@ public class TaskConstants {
}
public static final String APPLICATION_REGEX = "application_\\d+_\\d+";
public static final String SETVALUE_REGEX = "\\$\\{setValue\\(([^)]*)\\)}";
/**
* string false
@ -369,4 +371,5 @@ public class TaskConstants {
* data.quality.error.output.path
*/
public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path";
}

View File

@ -60,6 +60,11 @@ public abstract class AbstractCommandExecutor {
* rules for extracting application ID
*/
protected static final Pattern APPLICATION_REGEX = Pattern.compile(TaskConstants.APPLICATION_REGEX);
/**
* rules for extracting Var Pool
*/
protected static final Pattern SETVALUE_REGEX = Pattern.compile(TaskConstants.SETVALUE_REGEX);
protected StringBuilder varPool = new StringBuilder();
/**
@ -318,7 +323,7 @@ public abstract class AbstractCommandExecutor {
String line;
while ((line = inReader.readLine()) != null) {
if (line.startsWith("${setValue(")) {
varPool.append(line, "${setValue(".length(), line.length() - 2);
varPool.append(findVarPool(line));
varPool.append("$VarPool$");
} else {
logBuffer.add(line);
@ -403,6 +408,19 @@ public abstract class AbstractCommandExecutor {
return lineList;
}
/**
* find var pool
* @param line
* @return
*/
private String findVarPool(String line){
Matcher matcher = SETVALUE_REGEX.matcher(line);
if (matcher.find()) {
return matcher.group(1);
}
return null;
}
/**
* find app id