mirror of https://github.com/apache/lucene.git
Use String.replace() instead of replaceAll() (#13047)
This commit is contained in:
parent
e3a6a4bd8f
commit
0c2802f37a
|
@ -478,14 +478,14 @@ public class TestHTMLStripCharFilter extends BaseTokenStreamTestCase {
|
|||
// ">"
|
||||
=
|
||||
TestUtil.randomHtmlishString(random(), maxNumElems)
|
||||
.replaceAll(">", " ")
|
||||
.replace('>', ' ')
|
||||
.replaceFirst("^--", "__");
|
||||
String closedAngleBangNonCDATA = "<!" + randomHtmlishString1 + "-[CDATA[&]]>";
|
||||
|
||||
// Don't create a comment (disallow "<!--") and don't include a closing ">"
|
||||
String randomHtmlishString2 =
|
||||
TestUtil.randomHtmlishString(random(), maxNumElems)
|
||||
.replaceAll(">", " ")
|
||||
.replace('>', ' ')
|
||||
.replaceFirst("^--", "__");
|
||||
String unclosedAngleBangNonCDATA = "<!" + randomHtmlishString2 + "-[CDATA[";
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class RepAllTask extends ReportTask {
|
|||
String line = taskReportLine(longestOp, stat);
|
||||
reported++;
|
||||
if (taskStats.size() > 2 && reported % 2 == 0) {
|
||||
line = line.replaceAll(" ", " - ");
|
||||
line = line.replace(" ", " - ");
|
||||
}
|
||||
sb.append(line);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class RepSelectByPrefTask extends RepSumByPrefTask {
|
|||
first = false;
|
||||
String line = taskReportLine(longestOp, stat);
|
||||
if (taskStats.size() > 2 && reported % 2 == 0) {
|
||||
line = line.replaceAll(" ", " - ");
|
||||
line = line.replace(" ", " - ");
|
||||
}
|
||||
sb.append(line);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public abstract class ReportTask extends PerfTask {
|
|||
String line = taskReportLine(longetOp, stat);
|
||||
lineNum++;
|
||||
if (partOfTasks.size() > 2 && lineNum % 2 == 0) {
|
||||
line = line.replaceAll(" ", " - ");
|
||||
line = line.replace(" ", " - ");
|
||||
}
|
||||
sb.append(line);
|
||||
int[] byTime = stat.getCountsByTime();
|
||||
|
|
|
@ -961,12 +961,11 @@ public class TestPerfTasksLogic extends BenchmarkTestCase {
|
|||
}
|
||||
|
||||
private String[] getAnalyzerFactoryConfig(String name, String params) {
|
||||
final String singleQuoteEscapedName = name.replaceAll("'", "\\\\'");
|
||||
final String singleQuoteEscapedName = name.replace("'", "\\'");
|
||||
String[] algLines = {
|
||||
"content.source=org.apache.lucene.benchmark.byTask.feeds.LineDocSource",
|
||||
"docs.file=" + getReuters20LinesFile(),
|
||||
"work.dir="
|
||||
+ getWorkDir().toAbsolutePath().toString().replaceAll("\\\\", "/"), // Fix Windows path
|
||||
"work.dir=" + getWorkDir().toAbsolutePath().toString().replace('\\', '/'), // Fix Windows path
|
||||
"content.source.forever=false",
|
||||
"directory=ByteBuffersDirectory",
|
||||
"AnalyzerFactory(name:'" + singleQuoteEscapedName + "', " + params + ")",
|
||||
|
|
|
@ -142,11 +142,11 @@ public class TestRegExp extends LuceneTestCase {
|
|||
break;
|
||||
case 3:
|
||||
// Star-replace all ab sequences.
|
||||
result.append(replacementPart.replaceAll("ab", ".*"));
|
||||
result.append(replacementPart.replace("ab", ".*"));
|
||||
break;
|
||||
case 4:
|
||||
// .-replace all b chars
|
||||
result.append(replacementPart.replaceAll("b", "."));
|
||||
result.append(replacementPart.replace("b", "."));
|
||||
break;
|
||||
case 5:
|
||||
// length-limited stars {1,2}
|
||||
|
@ -165,7 +165,7 @@ public class TestRegExp extends LuceneTestCase {
|
|||
break;
|
||||
case 8:
|
||||
// NOT a character - replace all b's with "not a"
|
||||
result.append(replacementPart.replaceAll("b", "[^a]"));
|
||||
result.append(replacementPart.replace("b", "[^a]"));
|
||||
break;
|
||||
case 9:
|
||||
// Make whole part repeatable 1 or more times
|
||||
|
|
Loading…
Reference in New Issue