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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0385c8b7 Avoid use toString() or substring() in favor of a simplified 
expression.
0385c8b7 is described below

commit 0385c8b72d0eb5c840c2cabf8154dbd0e4917e23
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Apr 17 09:19:06 2022 -0400

    Avoid use toString() or substring() in favor of a simplified expression.
    
    No longer need to check length since contains() call does not need to
    guarded.
---
 src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java 
b/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
index 4ae2c618..65d26757 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
@@ -403,7 +403,7 @@ public class PhoneticEngine {
         input = input.toLowerCase(Locale.ENGLISH).replace('-', ' ').trim();
 
         if (this.nameType == NameType.GENERIC) {
-            if (input.length() >= 2 && input.startsWith("d'")) { // check for 
d'
+            if (input.startsWith("d'")) { // check for d'
                 final String remainder = input.substring(2);
                 final String combined = "d" + remainder;
                 return "(" + encode(remainder) + ")-(" + encode(combined) + 
")";

Reply via email to