exceptionfactory commented on code in PR #11426:
URL: https://github.com/apache/nifi/pull/11426#discussion_r3574388854
##########
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/AbstractJoltTransform.java:
##########
@@ -190,7 +190,8 @@ protected Collection<ValidationResult>
customValidate(ValidationContext validati
}
}
} catch (final Exception e) {
- String message = String.format("Specification not valid for
the selected transformation: %s", e.getMessage());
+ String message = String.format("Specification not valid for
the selected transformation: %s",
+ (e.getCause() != null ? e.getCause().getMessage() :
e.getMessage()));
Review Comment:
For readability, I recommend breaking out the ternary check into a variable
declaration along the lines of:
```
final String reason;
final Throwable cause = e.getCause();
if (cause == null) {
reason = e.getMessage();
} else {
reason = "%s [%s]".formatted(cause.getMessage(), e.getMessage);
}
message = "Specification not valid... %s".formatted(reason)
```
This approach should be a bit easier to follow, and also include both the
direct message and the cause message when available.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]