Marcono1234 opened a new pull request, #1159:
URL: https://github.com/apache/commons-lang/pull/1159
With these changes if the call to `String.format` fails it will generate the
message as `message + "\nValues: " + Arrays.toString(values)` and add the
`IllegalFormatException` as suppressed exception.
If the message and values are wellformed the behavior remains the same as
before.
Rationale:
- Even if the message is malformed, showing it to the user still allows them
to troubleshoot the `Validate` failure, which would not be possible when only
propagating the `IllegalFormatException`
This is similar to [Guava's
`Preconditions`](https://javadoc.io/doc/com.google.guava/guava/latest/com/google/common/base/Preconditions.html)
which also does not fail on malformed messages
- Since the message is only constructed in the error case, it is likely that
unit tests of the user don't cover it since they normally mostly focus on the
'happy path'
However, #953 has in the past already improved the situation for `Validate`
a lot, so maybe these changes here are not that important or useful? What do
you think?
--
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]