Skip to content

Commit beb39d4

Browse files
committed
Wrong output of DoubleMetaphone in 1.16.1
1 parent f01b732 commit beb39d4

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The <action> type attribute can be add,update,fix,remove.
4545
<body>
4646
<release version="1.17.0" date="YYYY-MM-DD" description="Feature and fix release. Requires a minimum of Java 8.">
4747
<!-- FIX -->
48+
<action type="fix" issue="CODEC-320" dev="ggregory" due-to="Martin Frydl, Gary Gregory">Wrong output of DoubleMetaphone in 1.16.1.</action>
4849
<action type="fix" dev="ggregory" due-to="Gary Gregory">Optimize memory allocation in PhoneticEngine.</action>
4950
<action type="fix" dev="ggregory" due-to="Gary Gregory">BCodec and QCodec encode() methods throw UnsupportedCharsetException instead of EncoderException.</action>
5051
<action type="fix" dev="ggregory" due-to="Gary Gregory">Set Javadoc link to latest Java API LTS version.</action>

src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ private int handleG(final String value, final DoubleMetaphoneResult result, int
617617
private int handleGH(final String value, final DoubleMetaphoneResult result, int index) {
618618
if (index > 0 && !isVowel(charAt(value, index - 1))) {
619619
result.append('K');
620+
index += 2;
620621
} else if (index == 0) {
621622
if (charAt(value, index + 2) == 'I') {
622623
result.append('J');

src/test/java/org/apache/commons/codec/language/DoubleMetaphoneTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,11 @@ public void testCodec184() {
10701070
assertFalse(new DoubleMetaphone().isDoubleMetaphoneEqual("", "aa", true));
10711071
}
10721072

1073+
@Test
1074+
public void testCodec320() {
1075+
assertTrue(new DoubleMetaphone().isDoubleMetaphoneEqual("ANGHELINA", "ANKL", false));
1076+
}
1077+
10731078
@Test
10741079
public void testDoubleMetaphone() {
10751080
assertDoubleMetaphone("TSTN", "testing");

0 commit comments

Comments
 (0)