gianm commented on code in PR #13177:
URL: https://github.com/apache/druid/pull/13177#discussion_r988505283
##########
core/src/main/java/org/apache/druid/common/exception/AllowedRegexErrorResponseTransformStrategy.java:
##########
@@ -51,7 +51,8 @@ public AllowedRegexErrorResponseTransformStrategy(
public Function<String, String> getErrorMessageTransformFunction()
{
return (String errorMessage) -> {
- if (allowedRegexPattern.stream().anyMatch(pattern ->
pattern.matcher(errorMessage).matches())) {
+ if (errorMessage == null || allowedRegexPattern.stream()
Review Comment:
Here's what I was thinking: in the current implementation, if the regex
doesn't match then we return null. If it does match, we return the original
message. If the original message is null itself, these outcomes are
indistinguishable and so there is no need to apply the regex.
As to whether a null message is helpful or not: no, not really, but the
interface allows it and there's some cases where it is in fact null. I do not
have the time right now to go find and change them all. But I do have time to
fix this class to conform to the current behavior of the interface. Therefore I
suggest we do this fix, and scrub through and improve the error messages as
time allows.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]