You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ji...@apache.org on 2004/06/06 23:27:56 UTC
[jira] Closed: (JAMES-58) SqlResources.substituteSubString(): more than one replacement of one parameter may fail
Message:
The following issue has been closed.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/JAMES-58
Here is an overview of the issue:
---------------------------------------------------------------------
Key: JAMES-58
Summary: SqlResources.substituteSubString(): more than one replacement of one parameter may fail
Type: Bug
Status: Closed
Resolution: FIXED
Project: James
Components:
James Core
Assignee:
Reporter: Kai Heinecke
Created: Fri, 20 Sep 2002 11:57 AM
Updated: Sun, 6 Jun 2004 2:27 PM
Environment: Operating System: All
Platform: All
Description:
in package org.apache.james.util.SqlResources.substituteSubString() you better should
write
while ( index > -1 ) {
[...]
index = input.indexOf(find, index + /*replace_length*/
find_length);
}
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 );
}
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org