Index: contrib/CHANGES.txt =================================================================== --- contrib/CHANGES.txt (revision 821187) +++ contrib/CHANGES.txt (working copy) @@ -2,6 +2,11 @@ ======================= Trunk (not yet released) ======================= +Changes in backwards compatibility policy + + * LUCENE-1257: Changes some occurences of StringBuffer in public/protected + APIs of contrib/surround to StringBuilder. (Paul Elschot) + Changes in runtime behavior API Changes Index: contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java =================================================================== --- contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java (revision 821187) +++ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ComposedQuery.java (working copy) @@ -57,7 +57,7 @@ } public String toString() { - StringBuffer r = new StringBuffer(); + StringBuilder r = new StringBuilder(); if (isOperatorInfix()) { infixToString(r); } else { @@ -72,7 +72,7 @@ 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 @@ r.append(getBracketClose()); } - protected void prefixToString(StringBuffer r) { + protected void prefixToString(StringBuilder r) { Iterator sqi = getSubQueriesIterator(); r.append(getOperatorName()); /* prefix operator */ r.append(getBracketOpen()); Index: contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java =================================================================== --- contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java (revision 821187) +++ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/FieldsQuery.java (working copy) @@ -75,7 +75,7 @@ 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 @@ 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()); Index: contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java =================================================================== --- contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java (revision 821187) +++ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java (working copy) @@ -45,10 +45,10 @@ 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()); } Index: contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java =================================================================== --- contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java (revision 821187) +++ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java (working copy) @@ -42,7 +42,7 @@ 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, Index: contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java =================================================================== --- contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java (revision 821187) +++ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndQuery.java (working copy) @@ -36,7 +36,7 @@ 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()); Index: contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java =================================================================== --- contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java (revision 821187) +++ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java (working copy) @@ -52,7 +52,7 @@ 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 @@ } prefix = truncated.substring(0, i); - StringBuffer re = new StringBuffer(); + StringBuilder re = new StringBuilder(); while (i < truncated.length()) { appendRegExpForChar(truncated.charAt(i), re); i++; Index: contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java =================================================================== --- contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java (revision 821187) +++ contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/ExceptionQueryTst.java (working copy) @@ -30,7 +30,7 @@ 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 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); }