8316946: jtreg failure handler pages are mislabelling the jcmd/thread/dump_to_file results.

Reviewed-by: dholmes
This commit is contained in:
Jaikiran Pai 2023-09-28 05:42:26 +00:00
parent 384d2ea6d1
commit 42924ed4e5

View File

@ -36,6 +36,7 @@ public class PatternAction implements Action {
private final SimpleAction action;
private final String[] originalArgs;
private final String originalSuccessArtifacts;
public PatternAction(String id, Properties properties)
throws InvalidValueException {
@ -47,6 +48,11 @@ public class PatternAction implements Action {
action = new SimpleAction(name != null ? ("pattern." + name) : "pattern", id, properties);
ValueHandler.apply(this, properties, id);
originalArgs = action.args.clone();
ActionParameters params = action.getParameters();
// just like the "args" the "successArtifacts" param can also contain pattern that
// this PatternAction will (sometimes repeatedly) replace, so we keep track of
// the original (un-replaced text)
originalSuccessArtifacts = params == null ? null : params.successArtifacts;
}
public ProcessBuilder prepareProcess(HtmlSection section,
@ -63,9 +69,9 @@ public class PatternAction implements Action {
args[i] = args[i].replace("%java", helper.findApp("java").getAbsolutePath());
}
// replace occurrences of the pattern in the "successArtifacts" param
String successArtifacts = action.getParameters().successArtifacts;
if (successArtifacts != null) {
action.getParameters().successArtifacts = successArtifacts.replaceAll(pattern, value);
if (originalSuccessArtifacts != null) {
action.getParameters().successArtifacts = originalSuccessArtifacts.replaceAll(pattern,
value);
}
return action.prepareProcess(section.getWriter(), helper);
}