Skip to content

Commit

Permalink
Wrong output of DoubleMetaphone in 1.16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Apr 18, 2024
1 parent f01b732 commit beb39d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Expand Up @@ -45,6 +45,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.17.0" date="YYYY-MM-DD" description="Feature and fix release. Requires a minimum of Java 8.">
<!-- FIX -->
<action type="fix" issue="CODEC-320" dev="ggregory" due-to="Martin Frydl, Gary Gregory">Wrong output of DoubleMetaphone in 1.16.1.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Optimize memory allocation in PhoneticEngine.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">BCodec and QCodec encode() methods throw UnsupportedCharsetException instead of EncoderException.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Set Javadoc link to latest Java API LTS version.</action>
Expand Down
Expand Up @@ -617,6 +617,7 @@ private int handleG(final String value, final DoubleMetaphoneResult result, int
private int handleGH(final String value, final DoubleMetaphoneResult result, int index) {
if (index > 0 && !isVowel(charAt(value, index - 1))) {
result.append('K');
index += 2;
} else if (index == 0) {
if (charAt(value, index + 2) == 'I') {
result.append('J');
Expand Down
Expand Up @@ -1070,6 +1070,11 @@ public void testCodec184() {
assertFalse(new DoubleMetaphone().isDoubleMetaphoneEqual("", "aa", true));
}

@Test
public void testCodec320() {
assertTrue(new DoubleMetaphone().isDoubleMetaphoneEqual("ANGHELINA", "ANKL", false));
}

@Test
public void testDoubleMetaphone() {
assertDoubleMetaphone("TSTN", "testing");
Expand Down

0 comments on commit beb39d4

Please sign in to comment.