Skip to content

Commit 937c6e6

Browse files
authored
Merge pull request zaproxy#5158 from thc202/add-on-exception-msg
Use AddOn's validation error in exception message
2 parents c27a49d + c627416 commit 937c6e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/org/zaproxy/zap/control/AddOn.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,7 @@ public static class InvalidAddOnException extends IOException {
21182118
private final ValidationResult validationResult;
21192119

21202120
private InvalidAddOnException(ValidationResult validationResult) {
2121-
super(getRootCauseMessage(validationResult.getException()), validationResult.getException());
2121+
super(getRootCauseMessage(validationResult), validationResult.getException());
21222122
this.validationResult = validationResult;
21232123
}
21242124

@@ -2132,9 +2132,10 @@ public ValidationResult getValidationResult() {
21322132
}
21332133
}
21342134

2135-
private static String getRootCauseMessage(Exception exception) {
2135+
private static String getRootCauseMessage(ValidationResult validationResult) {
2136+
Exception exception = validationResult.getException();
21362137
if (exception == null) {
2137-
return null;
2138+
return validationResult.getValidity().toString();
21382139
}
21392140
Throwable root = ExceptionUtils.getRootCause(exception);
21402141
return root == null ? exception.getLocalizedMessage() : root.getLocalizedMessage();

0 commit comments

Comments
 (0)