aherbert commented on code in PR #953:
URL: https://github.com/apache/commons-lang/pull/953#discussion_r976855201


##########
src/main/java/org/apache/commons/lang3/Validate.java:
##########
@@ -1265,7 +1264,11 @@ public static void isAssignableFrom(final Class<?> 
superType, final Class<?> typ
     public static void isAssignableFrom(final Class<?> superType, final 
Class<?> type, final String message, final Object... values) {
         // TODO when breaking BC, consider returning type
         if (!superType.isAssignableFrom(type)) {
-            throw new IllegalArgumentException(String.format(message, values));
+            throw new IllegalArgumentException(getMessage(message, values));
         }
     }
+
+    private static String getMessage(final String message, final Object... 
values) {

Review Comment:
   This all looks fine. Please add a comment to the private method, e.g. 
   ```
   Get the message using {@link String#format(String, Object...) 
String.format(message, values)}
   if the values are not empty, otherwise return the message unformatted.
   This method exists to allow validation methods declaring a String message 
and varargs parameters
   to be used without any message parameters when the message contains special 
characters,
   e.g. {@code Validate.isTrue(false, "%Failed%")}.
   @param ...
   @return ...
   ```



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

Reply via email to