pranavbhole commented on PR #15056:
URL: https://github.com/apache/druid/pull/15056#issuecomment-1740341407

   > Anything that is calling `StringUtils.nonStrictFormat` with a `null` 
format string is a bug. In the case of #15055, the bug is that 
`QueryExceptionCompat#makeException` calls `druidException.build(exception, 
exception.getMessage())`. The `build` method expects a format string in the 
second parameter. The call should instead be `.build(exception, "%s", 
exception.getMessage())`.
   > 
   > IMO, better to fix the above bug than to work around it in 
`StringUtils#nonStrictFormat`.
   > 
   > Btw, looking at other calls to `DruidException#build` I see a bunch of 
places that have the same problem, where they pass a regular string instead of 
a format string. Many of them should be changed from `build(e, s)` to `build(e, 
"%s", s)`. We should fix these too. Even if `s` is not null, it is problematic 
if it contains `%` characters that will be interpreted in special ways by the 
formatter.
   
   Thank you, I was able to find the potential null at multiple places, fixed 
all of them I could find. Added test to StringUtilsTest to ensure formatting 
with string containing `%` char.


-- 
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]

Reply via email to