Skip to content

Commit

Permalink
Fix message generation of ActionExecutionException (#18257)
Browse files Browse the repository at this point in the history
This fixes an issue introduced by commit f95b80d, which resulted in certain exception message being printed twice.

Closes #18243.

PiperOrigin-RevId: 527848438
Change-Id: Ic0f7a4a0e3bdf07c1c520647dbb4b41d29e05648

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
  • Loading branch information
keertk and fmeum authored Apr 28, 2023
1 parent 2442a2e commit 034f646
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ActionExecutionException(
ActionAnalysisMetadata action,
boolean catastrophe,
DetailedExitCode detailedExitCode) {
super(combineMessages(message, cause), cause);
super(message, cause);
this.action = action;
this.catastrophe = catastrophe;
this.detailedExitCode = checkNotNull(detailedExitCode);
Expand Down Expand Up @@ -96,7 +96,7 @@ public ActionExecutionException(
NestedSet<Cause> rootCauses,
boolean catastrophe,
DetailedExitCode detailedExitCode) {
super(combineMessages(message, cause), cause);
super(message, cause);
this.action = action;
this.rootCauses = rootCauses;
this.catastrophe = catastrophe;
Expand Down Expand Up @@ -203,12 +203,4 @@ public DetailedExitCode getDetailedExitCode() {
public boolean showError() {
return getMessage() != null;
}

@Nullable
private static String combineMessages(String message, @Nullable Throwable cause) {
if (cause == null || cause.getMessage() == null) {
return message;
}
return message + ": " + cause.getMessage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,11 @@ private ActionExecutionException toActionExecutionException(
} else {
ex = new ActionExecutionException(message, cause, action, false, code);
}
printError(ex.getMessage(), action, actionOutput);
String reportMessage = ex.getMessage();
if (cause != null && cause.getMessage() != null) {
reportMessage += ": " + cause.getMessage();
}
printError(reportMessage, action, actionOutput);
return ex;
}

Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/test/java/com/google/devtools/build/lib/actions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils:depsutils",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code",
"//src/main/java/com/google/devtools/build/lib/util:filetype",
"//src/main/java/com/google/devtools/build/lib/util:string",
"//src/main/java/com/google/devtools/build/lib/vfs",
Expand Down

0 comments on commit 034f646

Please sign in to comment.