Skip to content

Commit

Permalink
8316946: jtreg failure handler pages are mislabelling the jcmd/thread…
Browse files Browse the repository at this point in the history
…/dump_to_file results.

Reviewed-by: dholmes
  • Loading branch information
jaikiran committed Sep 28, 2023
1 parent 384d2ea commit 42924ed
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -47,6 +48,11 @@ public PatternAction(String name, String id, Properties properties)
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,
Expand All @@ -63,9 +69,9 @@ public ProcessBuilder prepareProcess(HtmlSection section,
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);
}
Expand Down

1 comment on commit 42924ed

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.