[ https://issues.apache.org/jira/browse/CODEC-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated CODEC-332: ---------------------------------- Affects Version/s: (was: 1.19.0) > removeVowels() incorrectly treating leading whitespace as the first character > ----------------------------------------------------------------------------- > > Key: CODEC-332 > URL: https://issues.apache.org/jira/browse/CODEC-332 > Project: Commons Codec > Issue Type: Bug > Reporter: Steven Verrell > Priority: Major > > It appears that when the input contains leading whitespace, the > MatchRatingApproachEncoder.removeVowels(String) method incorrectly treats the > whitespace as the first character of the word. > > > For example, removeVowels(" AIDAN") => " DN" > The expected result should be "ADN". Is there miss a step like use ".trim()" > to remove whitespace from the input? > I used the test code in "/src/test/java/org/apache/commons/codec/language > /MatchRatingApproachEncoderTest.java" and made a minor change to trigger this > error. > > The test code is as follows: > > {code:java} > @Test > public final void testRemoveVowel__AIDAN_Returns_ADN() { > assertEquals("ADN", getStringEncoder().removeVowels("AIDAN")); // pass > } > @Test > public final void testRemoveVowel__WithLeadingWhitespace_Returns_ADN() { > assertEquals("ADN", getStringEncoder().removeVowels(" AIDAN")); //fail > } > {code} > The testRemoveVowel_{_}AIDAN_Returns_ADN{_} test passes successfully{_},{_} > while the \{_}testRemoveVowel{_}_WithLeadingWhitespace_Returns_ADN test fails > and returns " DN" instead of the expected "ADN". > -- This message was sent by Atlassian Jira (v8.20.10#820010)