This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git


The following commit(s) were added to refs/heads/master by this push:
     new 92107c29 Add messages when throwing NullPointerException.
92107c29 is described below

commit 92107c29303897871545d4e138b8804591854782
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jul 22 10:53:34 2026 -0400

    Add messages when throwing NullPointerException.
---
 .../apache/commons/beanutils2/converters/ColorConverter.java   | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/beanutils2/converters/ColorConverter.java 
b/src/main/java/org/apache/commons/beanutils2/converters/ColorConverter.java
index 092a9558..9543aad5 100644
--- a/src/main/java/org/apache/commons/beanutils2/converters/ColorConverter.java
+++ b/src/main/java/org/apache/commons/beanutils2/converters/ColorConverter.java
@@ -161,8 +161,7 @@ public class ColorConverter extends 
AbstractConverter<Color> {
      * @throws NumberFormatException If the hexadecimal input contains non 
parsable characters.
      */
     private Color parseHexadecimalColor(final String value) {
-        Objects.requireNonNull(value);
-
+        Objects.requireNonNull(value, "value");
         switch (value.length()) {
         case 4:
             return new Color(Integer.parseInt(value.substring(1, 2), 16) * 17, 
Integer.parseInt(value.substring(2, 3), 16) * 17,
@@ -198,22 +197,17 @@ public class ColorConverter extends 
AbstractConverter<Color> {
      * @throws IllegalArgumentException If the input can't be matches by the 
{@link #JAVA_COLOR_PATTERN} or a {@link Color} component specified is over 255.
      */
     private Color parseToStringColor(final String value) {
-        Objects.requireNonNull(value);
-
+        Objects.requireNonNull(value, "value");
         final Matcher matcher = JAVA_COLOR_PATTERN.matcher(value);
-
         if (!matcher.matches()) {
             throw new IllegalArgumentException("Invalid Color String provided. 
Could not parse.");
         }
-
         final int red = Integer.parseInt(matcher.group(1));
         final int green = Integer.parseInt(matcher.group(2));
         final int blue = Integer.parseInt(matcher.group(3));
-
         if (red > 255 || green > 255 || blue > 255) {
             throw new IllegalArgumentException("Color component integers must 
be between 0 and 255.");
         }
-
         return new Color(red, green, blue);
     }
 }

Reply via email to