Skip to content

Apache Lucene open-source search software

LUCENE-1257: Change some occurrences of StringBuffer in public/protected APIs of contrib/surround to StringBuilder

Uwe Schindlerb75e96f2f4b7
diff --git a/contrib/CHANGES.txt b/contrib/CHANGES.txt
index b128c5a3dbb..9108ad9bcc9 100644
--- a/contrib/CHANGES.txt
+++ b/contrib/CHANGES.txt
@@ -2,6 +2,12 @@ Lucene contrib change Log
======================= Trunk (not yet released) =======================
+Changes in backwards compatibility policy
+
+ * LUCENE-1257: Change some occurences of StringBuffer in public/protected
+ APIs of contrib/surround to StringBuilder.
+ (Paul Elschot via Uwe Schindler)
+
Changes in runtime behavior
API Changes
diff --git a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java
index c542a6787a7..39b6101265f 100644
--- a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java
+++ b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java
@@ -57,7 +57,7 @@ public abstract class ComposedQuery extends SrndQuery {
}
public String toString() {
- StringBuffer r = new StringBuffer();
+ StringBuilder r = new StringBuilder();
if (isOperatorInfix()) {
infixToString(r);
} else {
@@ -72,7 +72,7 @@ public abstract class ComposedQuery extends SrndQuery {
protected String getBracketOpen() { return "(";}
protected String getBracketClose() { return ")";}
- protected void infixToString(StringBuffer r) {
+ protected void infixToString(StringBuilder r) {
/* Brackets are possibly redundant in the result. */
Iterator sqi = getSubQueriesIterator();
r.append(getBracketOpen());
@@ -88,7 +88,7 @@ public abstract class ComposedQuery extends SrndQuery {
r.append(getBracketClose());
}
- protected void prefixToString(StringBuffer r) {
+ protected void prefixToString(StringBuilder r) {
Iterator sqi = getSubQueriesIterator();
r.append(getOperatorName()); /* prefix operator */
r.append(getBracketOpen());
diff --git a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java
index f7d59447711..300c5148838 100644
--- a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java
+++ b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java
@@ -75,7 +75,7 @@ public class FieldsQuery extends SrndQuery { /* mostly untested */
public char getFieldOperator() { return fieldOp;}
public String toString() {
- StringBuffer r = new StringBuffer();
+ StringBuilder r = new StringBuilder();
r.append("(");
fieldNamesToString(r);
r.append(q.toString());
@@ -83,7 +83,7 @@ public class FieldsQuery extends SrndQuery { /* mostly untested */
return r.toString();
}
- protected void fieldNamesToString(StringBuffer r) {
+ protected void fieldNamesToString(StringBuilder r) {
Iterator fni = getFieldNames().listIterator();
while (fni.hasNext()) {
r.append((String) fni.next());
diff --git a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
index 9efc603b1a5..9f55e477906 100644
--- a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
+++ b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
@@ -45,10 +45,10 @@ public abstract class SimpleTerm
return this.toStringUnquoted().compareTo( ost.toStringUnquoted());
}
- protected void suffixToString(StringBuffer r) {;} /* override for prefix query */
+ protected void suffixToString(StringBuilder r) {;} /* override for prefix query */
public String toString() {
- StringBuffer r = new StringBuffer();
+ StringBuilder r = new StringBuilder();
if (isQuoted()) {
r.append(getQuote());
}
diff --git a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java
index 931610baf78..f7facc4945f 100644
--- a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java
+++ b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java
@@ -42,7 +42,7 @@ public class SrndPrefixQuery extends SimpleTerm {
public String toStringUnquoted() {return getPrefix();}
- protected void suffixToString(StringBuffer r) {r.append(getSuffixOperator());}
+ protected void suffixToString(StringBuilder r) {r.append(getSuffixOperator());}
public void visitMatchingTerms(
IndexReader reader,
diff --git a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java
index 326b448ea78..cc2cc882a82 100644
--- a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java
+++ b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java
@@ -36,7 +36,7 @@ public abstract class SrndQuery implements Cloneable {
public String getWeightOperator() {return "^";}
- protected void weightToString(StringBuffer r) { /* append the weight part of a query */
+ protected void weightToString(StringBuilder r) { /* append the weight part of a query */
if (isWeighted()) {
r.append(getWeightOperator());
r.append(getWeightString());
diff --git a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java
index 229db6fa88c..21e4dc3fecf 100644
--- a/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java
+++ b/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java
@@ -52,7 +52,7 @@ public class SrndTruncQuery extends SimpleTerm {
return (c != unlimited) && (c != mask);
}
- protected void appendRegExpForChar(char c, StringBuffer re) {
+ protected void appendRegExpForChar(char c, StringBuilder re) {
if (c == unlimited)
re.append(".*");
else if (c == mask)
@@ -68,7 +68,7 @@ public class SrndTruncQuery extends SimpleTerm {
}
prefix = truncated.substring(0, i);
- StringBuffer re = new StringBuffer();
+ StringBuilder re = new StringBuilder();
while (i < truncated.length()) {
appendRegExpForChar(truncated.charAt(i), re);
i++;
diff --git a/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java b/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java
index e9937b3833e..2fa38bac811 100644
--- a/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java
+++ b/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java
@@ -30,7 +30,7 @@ public class ExceptionQueryTst {
this.verbose = verbose;
}
- public void doTest(StringBuffer failQueries) {
+ public void doTest(StringBuilder failQueries) {
boolean pass = false;
SrndQuery lq = null;
try {
@@ -55,7 +55,7 @@ public class ExceptionQueryTst {
}
public static String getFailQueries(String[] exceptionQueries, boolean verbose) {
- StringBuffer failQueries = new StringBuffer();
+ StringBuilder failQueries = new StringBuilder();
for (int i = 0; i < exceptionQueries.length; i++ ) {
new ExceptionQueryTst( exceptionQueries[i], verbose).doTest(failQueries);
}