Author: ggregory Date: Sun Jul 10 18:07:05 2011 New Revision: 1144925 URL: http://svn.apache.org/viewvc?rev=1144925&view=rev Log: Eat own dog food: Call StringUtils.isEmpty().
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1144925&r1=1144924&r2=1144925&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Sun Jul 10 18:07:05 2011 @@ -5094,7 +5094,7 @@ public class StringUtils { * @return the changed String, {@code null} if null String input */ public static String swapCase(String str) { - if (str == null || str.length() == 0) { + if (StringUtils.isEmpty(str)) { return str; } Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java?rev=1144925&r1=1144924&r2=1144925&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrMatcher.java Sun Jul 10 18:07:05 2011 @@ -18,6 +18,8 @@ package org.apache.commons.lang3.text; import java.util.Arrays; +import org.apache.commons.lang3.StringUtils; + /** * A matcher class that can be queried to determine if a character array * portion matches. @@ -201,7 +203,7 @@ public abstract class StrMatcher { * @return a new Matcher for the given String */ public static StrMatcher stringMatcher(String str) { - if (str == null || str.length() == 0) { + if (StringUtils.isEmpty(str)) { return NONE_MATCHER; } return new StringMatcher(str); Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java?rev=1144925&r1=1144924&r2=1144925&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java Sun Jul 10 18:07:05 2011 @@ -16,6 +16,7 @@ */ package org.apache.commons.lang3.text; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; /** @@ -198,7 +199,7 @@ public class WordUtils { */ public static String capitalize(String str, char... delimiters) { int delimLen = delimiters == null ? -1 : delimiters.length; - if (str == null || str.length() == 0 || delimLen == 0) { + if (StringUtils.isEmpty(str) || delimLen == 0) { return str; } char[] buffer = str.toCharArray(); @@ -267,7 +268,7 @@ public class WordUtils { */ public static String capitalizeFully(String str, char... delimiters) { int delimLen = (delimiters == null ? -1 : delimiters.length); - if (str == null || str.length() == 0 || delimLen == 0) { + if (StringUtils.isEmpty(str) || delimLen == 0) { return str; } str = str.toLowerCase(); @@ -323,7 +324,7 @@ public class WordUtils { */ public static String uncapitalize(String str, char... delimiters) { int delimLen = (delimiters == null ? -1 : delimiters.length); - if (str == null || str.length() == 0 || delimLen == 0) { + if (StringUtils.isEmpty(str) || delimLen == 0) { return str; } char[] buffer = str.toCharArray(); @@ -364,7 +365,7 @@ public class WordUtils { * @return the changed String, <code>null</code> if null String input */ public static String swapCase(String str) { - if (str == null || str.length() == 0) { + if (StringUtils.isEmpty(str)) { return str; } char[] buffer = str.toCharArray(); @@ -448,7 +449,7 @@ public class WordUtils { * @since 2.2 */ public static String initials(String str, char... delimiters) { - if (str == null || str.length() == 0) { + if (StringUtils.isEmpty(str)) { return str; } if (delimiters != null && delimiters.length == 0) {