You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2023/03/01 11:20:37 UTC

[GitHub] [maven] elharo commented on a diff in pull request #1015: Prefer Java standard library to Plexus util

elharo commented on code in PR #1015:
URL: https://github.com/apache/maven/pull/1015#discussion_r1121552266


##########
maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java:
##########
@@ -60,7 +59,7 @@ public void validate(Settings settings, SettingsProblemCollector problems) {
             for (int i = 0; i < pluginGroups.size(); i++) {
                 String pluginGroup = pluginGroups.get(i).trim();
 
-                if (StringUtils.isBlank(pluginGroup)) {
+                if (pluginGroup.trim().isEmpty()) {
                     addViolation(
                             problems, Severity.ERROR, "pluginGroups.pluginGroup[" + i + "]", null, "must not be empty");
                 } else if (!ID_REGEX.matcher(pluginGroup).matches()) {

Review Comment:
   Yes, and they aren't clear to me either. This is a problem with all the isEmpty, isBlank, isNullOrEmpty methods that litter utility libraries across Java, not just here but in Guava and many, many other libraries. They do not agree on what "empty", "blank", and similar terms mean. Sometimes "empty" strings can contain whitespace. Sometimes they can't. Sometimes they can be null. Sometimes they can't. It depends on which version of which library you're using. It's confusing and error prone. That's a big reason I want to get rid of all of them and stick exclusively to JDK methods.
   
   In this case the string was already trimmed in line 60 so empty and blank are the same. 



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org