You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/10/06 02:52:35 UTC

[GitHub] [druid] gianm commented on a diff in pull request #13177: Fix null message handling in AllowedRegexErrorResponseTransformStrategy.

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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org