Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
12855
Description
in package org.apache.james.util.SqlResources.substituteSubString() you better should
write
while ( index > -1 )
to find all occurrences of one parameter in the input
string.
TestCase:
public void testSubstituteSubString() {
String subst = null;
subst = sr.substituteSubString("${aa} ${aa}", "${aa}", "Test" );
assertEquals( "double
replacement one after another", "Test Test", subst );
subst =
sr.substituteSubString("${aa}${aa}", "${aa}", "Test" );
assertEquals( "double
replacement one after another without spaces", "TestTest", subst );
subst =
sr.substituteSubString("Ein ${k} ${k}", "${k}", "langerTest" );
assertEquals( "double
replacement where NEW is longer than OLD", "Ein langerTest langerTest", subst );
subst =
sr.substituteSubString("Ein ${keyword} ${keyword}", "${keyword}", "T" );
assertEquals( "double replacement where NEW is shorter than OLD", "Ein T T", subst );
subst
= sr.substituteSubString("Ein ${keyword} ${keyword}", "${keyword}", "Testwort12" );
assertEquals( "double replacement where NEW is as long as OLD", "Ein Testwort12 Testwort12",
subst );
}