xrl1 opened a new pull request, #5057:
URL: https://github.com/apache/iceberg/pull/5057

   Closes #4618 
   
   From the issue:
   `Preconditions.checkArgument` only works with %s, as %d does not parse and 
returns a bad error message.
   
   Created a multiline regex to prevent this.
   
   The regex is as follows:
   ```regex
   Preconditions\.checkArgument\([^;]+,\s+"[^;]*%d[^;]+\);
   ```
   The logic behind it: Find the function call, then some first parameter until 
a ',' (as the error message is the second parameter), and finally search until 
the function closes and a ';'.
   * Used `[^;]*` instead of `.*`, because this is a multiline search and the 
dotall regex param (enabled by `matchAcrossLines` config) is aggressive and 
this is the best way to break its search.
   * It can be removed and the "\s+" can be enough
   * Added the quote and comma to avoid matching the first argument, but I can 
simplify the regex and not handle the edge cases where there is "%d" in the 
first argument
   
   Tell me what you think, I have no problem tuning it
   
   Also, fixed %d usages that the Checkstyle rule found


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