mirror of https://github.com/apache/openjpa.git
OPENJPA-1456 Replace StringBuffer usage with StringBuilder for minor performance/scalability improvement
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@898168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e53378bd26
commit
55bf86a4c8
|
@ -782,7 +782,7 @@ public class JDBCStoreQuery
|
|||
|
||||
Val value2 = concatVal.getVal2();
|
||||
Object val2 = getValue(value2, ob, params, sm);
|
||||
return new StringBuffer(100).append(val1).append(val2).toString();
|
||||
return new StringBuilder(100).append(val1).append(val2).toString();
|
||||
}
|
||||
|
||||
private Object handleSubstringVal(Object value, Object ob, Object[] params,
|
||||
|
|
|
@ -373,7 +373,7 @@ public class SQLStoreQuery
|
|||
tok.wordChars('0', '9');
|
||||
tok.wordChars('?', '?');
|
||||
|
||||
StringBuffer buf = new StringBuffer(sql.length());
|
||||
StringBuilder buf = new StringBuilder(sql.length());
|
||||
for (int ttype; (ttype = tok.nextToken()) !=
|
||||
StreamTokenizer.TT_EOF;) {
|
||||
switch (ttype) {
|
||||
|
|
|
@ -446,7 +446,7 @@ public class JDBCExpressionFactory
|
|||
private Value getLiteralRawString(Value val) {
|
||||
if (val instanceof Lit) {
|
||||
Lit lit = (Lit) val;
|
||||
StringBuffer value = new StringBuffer();
|
||||
StringBuilder value = new StringBuilder();
|
||||
int pType = lit.getParseType();
|
||||
if (pType == Literal.TYPE_SQ_STRING ||
|
||||
pType == Literal.TYPE_STRING)
|
||||
|
|
|
@ -128,7 +128,7 @@ class MatchesExpression
|
|||
private static String replaceEscape(String str, String from, String to,
|
||||
String escape) {
|
||||
String[] parts = Strings.split(str, from, Integer.MAX_VALUE);
|
||||
StringBuffer repbuf = new StringBuffer();
|
||||
StringBuilder repbuf = new StringBuilder();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (i > 0) {
|
||||
// if the previous part ended with an escape character, then
|
||||
|
|
|
@ -216,7 +216,7 @@ public class PCPath
|
|||
}
|
||||
|
||||
public String getXPath() {
|
||||
StringBuffer xpath = new StringBuffer();
|
||||
StringBuilder xpath = new StringBuilder();
|
||||
Action action;
|
||||
Iterator itr = _actions.iterator();
|
||||
|
||||
|
@ -248,7 +248,7 @@ public class PCPath
|
|||
if (_actions == null)
|
||||
return (_varName == null) ? "" : _varName + ".";
|
||||
|
||||
StringBuffer path = new StringBuffer();
|
||||
StringBuilder path = new StringBuilder();
|
||||
Action action;
|
||||
for (Iterator itr = _actions.iterator(); itr.hasNext();) {
|
||||
action = (Action) itr.next();
|
||||
|
|
|
@ -114,7 +114,7 @@ public class TypeLit
|
|||
}
|
||||
|
||||
private String getDiscriminator(LitExpState lstate) {
|
||||
StringBuffer disc = new StringBuffer(lstate.discValue.toString());
|
||||
StringBuilder disc = new StringBuilder(lstate.discValue.toString());
|
||||
switch(lstate.disc.getJavaType()) {
|
||||
case JavaTypes.INT:
|
||||
return disc.toString();
|
||||
|
|
|
@ -1474,7 +1474,7 @@ public class ReverseMappingTool
|
|||
* name, using the default package.
|
||||
*/
|
||||
private String getClassName(Table table) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (getPackageName() != null)
|
||||
buf.append(getPackageName()).append(".");
|
||||
|
||||
|
@ -1514,7 +1514,7 @@ public class ReverseMappingTool
|
|||
else
|
||||
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String[] subs = Strings.split(name, "_", 0);
|
||||
for (int i = 0; i < subs.length; i++) {
|
||||
if (i > 0)
|
||||
|
@ -1571,7 +1571,7 @@ public class ReverseMappingTool
|
|||
if (StringUtils.isEmpty(str))
|
||||
return str;
|
||||
|
||||
StringBuffer buf = new StringBuffer(str);
|
||||
StringBuilder buf = new StringBuilder(str);
|
||||
char c;
|
||||
for (int i = 0; i < buf.length(); i++) {
|
||||
c = buf.charAt(i);
|
||||
|
|
|
@ -161,7 +161,7 @@ public class SequenceMapping
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addStandardProperties(StringBuffer props) {
|
||||
protected void addStandardProperties(StringBuilder props) {
|
||||
super.addStandardProperties(props);
|
||||
// Quotes are conditionally added to the following because the props
|
||||
// are eventually passed to the Configurations.parseProperties()
|
||||
|
|
|
@ -240,7 +240,7 @@ public class StateComparisonVersionStrategy
|
|||
*/
|
||||
public String getSQL() {
|
||||
Column[] cols = getTable().getColumns();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
boolean hasWhere = false;
|
||||
Object val;
|
||||
for (int i = 0; i < cols.length; i++) {
|
||||
|
|
|
@ -499,7 +499,7 @@ public abstract class StoreCollectionFieldStrategy
|
|||
// we know we don't need a union
|
||||
Select sel = store.getSQLFactory().newSelect();
|
||||
sel.setAggregate(true);
|
||||
StringBuffer sql = new StringBuffer();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("MAX(").
|
||||
append(sel.getColumnAlias(field.getOrderColumn())).
|
||||
append(")");
|
||||
|
|
|
@ -668,7 +668,7 @@ public class Column
|
|||
* Useful for debugging.
|
||||
*/
|
||||
public String getDescription() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Full Name: ").append(getFullName()).append("\n");
|
||||
buf.append("Type: ").append(Schemas.getJDBCName(getType())).
|
||||
append("\n");
|
||||
|
|
|
@ -231,7 +231,7 @@ public class DB2Dictionary
|
|||
}
|
||||
|
||||
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(sequenceSQL);
|
||||
if (schemaName != null || sequenceName != null)
|
||||
buf.append(" WHERE ");
|
||||
|
@ -381,7 +381,7 @@ public class DB2Dictionary
|
|||
int isolationLevel;
|
||||
// For db2UDBV81OrEarlier and db2ISeriesV5R3OrEarlier:
|
||||
// "optimize for" clause appears before "for update" clause.
|
||||
StringBuffer forUpdateString = new StringBuffer(getOptimizeClause(sel));
|
||||
StringBuilder forUpdateString = new StringBuilder(getOptimizeClause(sel));
|
||||
// Determine the isolationLevel; the fetch
|
||||
// configuration data overrides the persistence.xml value
|
||||
if (fetch != null && fetch.getIsolation() != -1)
|
||||
|
@ -534,7 +534,7 @@ public class DB2Dictionary
|
|||
|
||||
protected String getOptimizeClause(Select sel) {
|
||||
if (sel != null && sel.getExpectedResultCount() > 0) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(" ").append(optimizeClause).append(" ")
|
||||
.append(String.valueOf(sel.getExpectedResultCount()))
|
||||
.append(" ").append(rowClause);
|
||||
|
@ -569,7 +569,7 @@ public class DB2Dictionary
|
|||
getMethod("getSqlWarn", null);
|
||||
Method getSqlErrdMethd = sqlca.getClass().
|
||||
getMethod("getSqlErrd", null);
|
||||
StringBuffer errdStr = new StringBuffer();
|
||||
StringBuilder errdStr = new StringBuilder();
|
||||
|
||||
int[] errds = (int[]) getSqlErrdMethd.invoke(sqlca, new Object[]{});
|
||||
for (int i = 0; i < errds.length; i++)
|
||||
|
|
|
@ -1747,7 +1747,7 @@ public class DBDictionary
|
|||
|
||||
String size = null;
|
||||
if (col.getSize() > 0) {
|
||||
StringBuffer buf = new StringBuffer(10);
|
||||
StringBuilder buf = new StringBuilder(10);
|
||||
buf.append("(").append(col.getSize());
|
||||
if (col.getDecimalDigits() > 0)
|
||||
buf.append(", ").append(col.getDecimalDigits());
|
||||
|
@ -3176,7 +3176,7 @@ public class DBDictionary
|
|||
if (name == null || name.length() <= targetLength)
|
||||
return name;
|
||||
|
||||
StringBuffer nm = new StringBuffer(name);
|
||||
StringBuilder nm = new StringBuilder(name);
|
||||
while (nm.length() > targetLength) {
|
||||
if (!stripVowel(nm)) {
|
||||
// cut out the middle char
|
||||
|
@ -3191,7 +3191,8 @@ public class DBDictionary
|
|||
*
|
||||
* @return true if any vowels have been removed
|
||||
*/
|
||||
private static boolean stripVowel(StringBuffer name) {
|
||||
//private static boolean stripVowel(StringBuffer name) {
|
||||
private static boolean stripVowel(StringBuilder name) {
|
||||
if (name == null || name.length() == 0)
|
||||
return false;
|
||||
|
||||
|
@ -3336,7 +3337,7 @@ public class DBDictionary
|
|||
* with columns. Indexes and constraints will be created separately.
|
||||
*/
|
||||
public String[] getCreateTableSQL(Table table) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String tableName = checkNameLength(getFullName(table, false),
|
||||
maxTableNameLength, "long-table-name");
|
||||
buf.append("CREATE TABLE ").append(tableName);
|
||||
|
@ -3350,7 +3351,7 @@ public class DBDictionary
|
|||
|
||||
// do this before getting the columns so we know how to handle
|
||||
// the last comma
|
||||
StringBuffer endBuf = new StringBuffer();
|
||||
StringBuilder endBuf = new StringBuilder();
|
||||
PrimaryKey pk = table.getPrimaryKey();
|
||||
String pkStr;
|
||||
if (pk != null) {
|
||||
|
@ -3390,7 +3391,8 @@ public class DBDictionary
|
|||
return batchFetchSize;
|
||||
}
|
||||
|
||||
protected StringBuffer comment(StringBuffer buf, String comment) {
|
||||
//protected StringBuffer comment(StringBuffer buf, String comment) {
|
||||
protected StringBuilder comment(StringBuilder buf, String comment) {
|
||||
return buf.append("-- ").append(comment);
|
||||
}
|
||||
|
||||
|
@ -3414,7 +3416,7 @@ public class DBDictionary
|
|||
if (nextSequenceQuery == null)
|
||||
return null;
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("CREATE SEQUENCE ");
|
||||
String seqName = checkNameLength(getFullName(seq), maxTableNameLength,
|
||||
"long-seq-name");
|
||||
|
@ -3440,7 +3442,7 @@ public class DBDictionary
|
|||
* (<col list>)</code> by default.
|
||||
*/
|
||||
public String[] getCreateIndexSQL(Index index) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("CREATE ");
|
||||
if (index.isUnique())
|
||||
buf.append("UNIQUE ");
|
||||
|
@ -3562,7 +3564,7 @@ public class DBDictionary
|
|||
* {@link #getAddColumnSQL}.
|
||||
*/
|
||||
protected String getDeclareColumnSQL(Column col, boolean alter) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String columnName = checkNameLength(col.getName(), maxColumnNameLength,
|
||||
"long-column-name");
|
||||
buf.append(columnName).append(" ");
|
||||
|
@ -3601,7 +3603,7 @@ public class DBDictionary
|
|||
if (name != null && reservedWordSet.contains(name.toUpperCase()))
|
||||
name = null;
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (name != null && CONS_NAME_BEFORE.equals(constraintNameMode))
|
||||
buf.append("CONSTRAINT ").append(name).append(" ");
|
||||
buf.append("PRIMARY KEY ");
|
||||
|
@ -3649,7 +3651,7 @@ public class DBDictionary
|
|||
String delAction = getActionName(delActionId);
|
||||
String upAction = getActionName(fk.getUpdateAction());
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (fk.getName() != null
|
||||
&& CONS_NAME_BEFORE.equals(constraintNameMode))
|
||||
buf.append("CONSTRAINT ").append(fk.getName()).append(" ");
|
||||
|
@ -3754,7 +3756,7 @@ public class DBDictionary
|
|||
if (!supportsUniqueConstraints
|
||||
|| (unq.isDeferred() && !supportsDeferredUniqueConstraints()))
|
||||
return null;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (unq.getName() != null
|
||||
&& CONS_NAME_BEFORE.equals(constraintNameMode))
|
||||
buf.append("CONSTRAINT ").append(checkNameLength(unq.getName(),
|
||||
|
@ -4378,7 +4380,7 @@ public class DBDictionary
|
|||
// this assumes that tname is longer than extraChars
|
||||
tname = tname.substring(0, tname.length() - extraChars);
|
||||
}
|
||||
StringBuffer buf = new StringBuffer(max);
|
||||
StringBuilder buf = new StringBuilder(max);
|
||||
buf.append(tname).append("_").append(cname).append("_SEQ");
|
||||
return buf.toString();
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ public class DBDictionaryFactory {
|
|||
public static String toString(DatabaseMetaData meta)
|
||||
throws SQLException {
|
||||
String lineSep = J2DoPrivHelper.getLineSeparator();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder(4096);
|
||||
try {
|
||||
buf.append("catalogSeparator: ")
|
||||
.append(meta.getCatalogSeparator())
|
||||
|
|
|
@ -118,7 +118,7 @@ public class H2Dictionary extends DBDictionary {
|
|||
}
|
||||
|
||||
public String[] getCreateTableSQL(Table table) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("CREATE TABLE ").append(getFullName(table, false))
|
||||
.append(" (");
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class H2Dictionary extends DBDictionary {
|
|||
}
|
||||
|
||||
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("SELECT SEQUENCE_SCHEMA, SEQUENCE_NAME FROM ")
|
||||
.append("INFORMATION_SCHEMA.SEQUENCES");
|
||||
if (schemaName != null || sequenceName != null)
|
||||
|
|
|
@ -134,7 +134,7 @@ public class HSQLDictionary
|
|||
}
|
||||
|
||||
public String[] getCreateTableSQL(Table table) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("CREATE ");
|
||||
if (cacheTables)
|
||||
buf.append("CACHED ");
|
||||
|
@ -179,7 +179,7 @@ public class HSQLDictionary
|
|||
}
|
||||
|
||||
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("SELECT SEQUENCE_SCHEMA, SEQUENCE_NAME FROM ").
|
||||
append("INFORMATION_SCHEMA.SYSTEM_SEQUENCES");
|
||||
if (schemaName != null || sequenceName != null)
|
||||
|
|
|
@ -210,7 +210,7 @@ public class IngresDictionary extends DBDictionary {
|
|||
*/
|
||||
@Override
|
||||
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(sequenceSQL);
|
||||
if (schemaName != null || sequenceName != null)
|
||||
buf.append(" WHERE ");
|
||||
|
|
|
@ -345,7 +345,7 @@ class JoinSet {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[");
|
||||
for (Iterator itr = iterator(); itr.hasNext();) {
|
||||
buf.append("<").append(itr.next()).append(">");
|
||||
|
|
|
@ -288,7 +288,7 @@ public class MySQLDictionary
|
|||
if (!optimizeMultiTableDeletes)
|
||||
return super.getDeleteTableContentsSQL(tables,conn);
|
||||
else {
|
||||
StringBuffer buf = new StringBuffer(tables.length * 8);
|
||||
StringBuilder buf = new StringBuilder(tables.length * 8);
|
||||
buf.append("DELETE FROM ");
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
buf.append(tables[i].getFullName());
|
||||
|
|
|
@ -668,7 +668,7 @@ public class OracleDictionary
|
|||
public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta,
|
||||
String catalog, String schemaName, String tableName, Connection conn)
|
||||
throws SQLException {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("SELECT t0.OWNER AS TABLE_SCHEM, ").
|
||||
append("t0.TABLE_NAME AS TABLE_NAME, ").
|
||||
append("t0.COLUMN_NAME AS COLUMN_NAME, ").
|
||||
|
@ -714,7 +714,7 @@ public class OracleDictionary
|
|||
String schemaName, String tableName, boolean unique, boolean approx,
|
||||
Connection conn)
|
||||
throws SQLException {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("SELECT t0.INDEX_OWNER AS TABLE_SCHEM, ").
|
||||
append("t0.TABLE_NAME AS TABLE_NAME, ").
|
||||
append("DECODE(t1.UNIQUENESS, 'UNIQUE', 0, 'NONUNIQUE', 1) ").
|
||||
|
@ -760,7 +760,7 @@ public class OracleDictionary
|
|||
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, String catalog,
|
||||
String schemaName, String tableName, Connection conn, boolean partialKeys)
|
||||
throws SQLException {
|
||||
StringBuffer delAction = new StringBuffer("DECODE(t1.DELETE_RULE").
|
||||
StringBuilder delAction = new StringBuilder("DECODE(t1.DELETE_RULE").
|
||||
append(", 'NO ACTION', ").append(meta.importedKeyNoAction).
|
||||
append(", 'RESTRICT', ").append(meta.importedKeyRestrict).
|
||||
append(", 'CASCADE', ").append(meta.importedKeyCascade).
|
||||
|
@ -768,7 +768,7 @@ public class OracleDictionary
|
|||
append(", 'SET DEFAULT', ").append(meta.importedKeySetDefault).
|
||||
append(")");
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("SELECT t2.OWNER AS PKTABLE_SCHEM, ").
|
||||
append("t2.TABLE_NAME AS PKTABLE_NAME, ").
|
||||
append("t2.COLUMN_NAME AS PKCOLUMN_NAME, ").
|
||||
|
@ -902,7 +902,7 @@ public class OracleDictionary
|
|||
|
||||
|
||||
protected String getSequencesSQL(String schemaName, String sequenceName) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("SELECT SEQUENCE_OWNER AS SEQUENCE_SCHEMA, ").
|
||||
append("SEQUENCE_NAME FROM ALL_SEQUENCES");
|
||||
if (schemaName != null || sequenceName != null)
|
||||
|
|
|
@ -747,7 +747,7 @@ public class RowImpl
|
|||
* Return the SQL for a prepared statement update on this row.
|
||||
*/
|
||||
private String getUpdateSQL(DBDictionary dict) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("UPDATE ").append(dict.getFullName(getTable(), false)).
|
||||
append(" SET ");
|
||||
|
||||
|
@ -774,8 +774,8 @@ public class RowImpl
|
|||
* Return the SQL for a prepared statement insert on this row.
|
||||
*/
|
||||
private String getInsertSQL(DBDictionary dict) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuffer vals = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
StringBuilder vals = new StringBuilder();
|
||||
buf.append("INSERT INTO ").
|
||||
append(dict.getFullName(getTable(), false)).append(" (");
|
||||
|
||||
|
@ -804,7 +804,7 @@ public class RowImpl
|
|||
* Return the SQL for a prepared statement delete on this row.
|
||||
*/
|
||||
private String getDeleteSQL(DBDictionary dict) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("DELETE FROM ").
|
||||
append(dict.getFullName(getTable(), false));
|
||||
appendWhere(buf, dict);
|
||||
|
@ -814,7 +814,7 @@ public class RowImpl
|
|||
/**
|
||||
* Appends the where clause onto the given sql buffer.
|
||||
*/
|
||||
private void appendWhere(StringBuffer buf, DBDictionary dict) {
|
||||
private void appendWhere(StringBuilder buf, DBDictionary dict) {
|
||||
boolean hasWhere = false;
|
||||
for (int i = 0; i < _cols.length; i++) {
|
||||
if (_vals[getWhereIndex(_cols[i])] == null)
|
||||
|
|
|
@ -715,7 +715,7 @@ public class SelectImpl
|
|||
else if (join.getTable2() == table)
|
||||
tableAlias = join.getAlias2();
|
||||
if (tableAlias != null)
|
||||
return new StringBuffer(tableAlias).append(".").
|
||||
return new StringBuilder(tableAlias).append(".").
|
||||
append(columnName).toString();
|
||||
}
|
||||
}
|
||||
|
@ -2147,7 +2147,7 @@ public class SelectImpl
|
|||
return false;
|
||||
}
|
||||
|
||||
public StringBuffer path() {
|
||||
public StringBuilder path() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2339,7 +2339,7 @@ public class SelectImpl
|
|||
return this;
|
||||
|
||||
PathJoinsImpl pj = new PathJoinsImpl();
|
||||
pj.path = new StringBuffer(pre.path().toString());
|
||||
pj.path = new StringBuilder(pre.path().toString());
|
||||
return pj;
|
||||
}
|
||||
|
||||
|
@ -2500,7 +2500,7 @@ public class SelectImpl
|
|||
return false;
|
||||
}
|
||||
|
||||
public StringBuffer path() {
|
||||
public StringBuilder path() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2577,7 +2577,7 @@ public class SelectImpl
|
|||
private static class PathJoinsImpl
|
||||
implements PathJoins {
|
||||
|
||||
protected StringBuffer path = null;
|
||||
protected StringBuilder path = null;
|
||||
protected String var = null;
|
||||
protected String correlatedVar = null;
|
||||
protected Context context = null;
|
||||
|
@ -2599,7 +2599,7 @@ public class SelectImpl
|
|||
return var != null || path != null;
|
||||
}
|
||||
|
||||
public StringBuffer path() {
|
||||
public StringBuilder path() {
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -2683,7 +2683,7 @@ public class SelectImpl
|
|||
protected void append(String str) {
|
||||
if (str != null) {
|
||||
if (path == null)
|
||||
path = new StringBuffer(str);
|
||||
path = new StringBuilder(str);
|
||||
else
|
||||
path.append('.').append(str);
|
||||
}
|
||||
|
@ -2971,7 +2971,7 @@ public class SelectImpl
|
|||
SelectJoins sj = new SelectJoins(sel);
|
||||
sj.var = var;
|
||||
if (path != null)
|
||||
sj.path = new StringBuffer(path.toString());
|
||||
sj.path = new StringBuilder(path.toString());
|
||||
if (_joins != null && !_joins.isEmpty())
|
||||
sj._joins = new JoinSet(_joins);
|
||||
sj._outer = _outer;
|
||||
|
@ -3221,7 +3221,7 @@ interface PathJoins
|
|||
/**
|
||||
* Return the relation path traversed by these joins, or null if none.
|
||||
*/
|
||||
public StringBuffer path();
|
||||
public StringBuilder path();
|
||||
|
||||
/**
|
||||
* Return the set of {@link Join} elements, or null if none.
|
||||
|
|
|
@ -194,7 +194,7 @@ public class SybaseDictionary
|
|||
if (!createIdentityColumn)
|
||||
return super.getCreateTableSQL(table);
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("CREATE TABLE ").append(getFullName(table, false)).
|
||||
append(" (");
|
||||
|
||||
|
@ -231,7 +231,7 @@ public class SybaseDictionary
|
|||
}
|
||||
|
||||
protected String getDeclareColumnSQL(Column col, boolean alter) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(col).append(" ");
|
||||
buf.append(getTypeName(col));
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class OpenJPAVersion {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(80 * 30);
|
||||
StringBuilder buf = new StringBuilder(80 * 40);
|
||||
appendOpenJPABanner(buf);
|
||||
buf.append("\n");
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class OpenJPAVersion {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
public void appendOpenJPABanner(StringBuffer buf) {
|
||||
public void appendOpenJPABanner(StringBuilder buf) {
|
||||
buf.append(VENDOR_NAME).append(" ");
|
||||
buf.append(VERSION_NUMBER);
|
||||
buf.append("\n");
|
||||
|
@ -134,7 +134,7 @@ public class OpenJPAVersion {
|
|||
buf.append("\n");
|
||||
}
|
||||
|
||||
private StringBuffer appendProperty(String prop, StringBuffer buf) {
|
||||
private StringBuilder appendProperty(String prop, StringBuilder buf) {
|
||||
return buf.append(prop).append(": ").append(
|
||||
AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getPropertyAction(prop)));
|
||||
|
|
|
@ -429,7 +429,7 @@ public class QueryKey
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(255);
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append(super.toString()).
|
||||
append("[query:[").append(_query).append("]").
|
||||
append(",access path:").append(_accessPathClassNames).
|
||||
|
|
|
@ -1100,7 +1100,7 @@ public class ApplicationIdTool {
|
|||
append("b == null").closeParen().endl();
|
||||
code.tab(3).append("return \"null\";").endl(2);
|
||||
|
||||
code.tab(2).append("StringBuffer r = new StringBuffer").
|
||||
code.tab(2).append("StringBuilder r = new StringBuilder").
|
||||
openParen(true).append("b.length * 2").closeParen().
|
||||
append(";").endl();
|
||||
code.tab(2).append("for").openParen(true).
|
||||
|
|
|
@ -888,7 +888,7 @@ public class PCEnhancer {
|
|||
return;
|
||||
|
||||
String sep = J2DoPrivHelper.getLineSeparator();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (Iterator itr = _violations.iterator(); itr.hasNext();) {
|
||||
buf.append(itr.next());
|
||||
if (itr.hasNext())
|
||||
|
|
|
@ -623,7 +623,7 @@ public abstract class AbstractBrokerFactory
|
|||
if (log.isTraceEnabled()) {
|
||||
Map<String,Object> props = _conf.toProperties(true);
|
||||
String lineSep = J2DoPrivHelper.getLineSeparator();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Map.Entry<?,?> entry;
|
||||
for (Iterator<Map.Entry<String,Object>> itr = props.entrySet().iterator(); itr.hasNext();) {
|
||||
entry = itr.next();
|
||||
|
|
|
@ -917,7 +917,7 @@ public class FetchConfigurationImpl
|
|||
List<FetchConfigurationImpl> path = getPath();
|
||||
if (path.isEmpty())
|
||||
return "";
|
||||
StringBuffer buf = new StringBuffer().append (": ");
|
||||
StringBuilder buf = new StringBuilder().append (": ");
|
||||
for (Iterator<FetchConfigurationImpl> itr = path.iterator(); itr.hasNext();) {
|
||||
buf.append(itr.next().getTraversedFromField());
|
||||
if (itr.hasNext())
|
||||
|
|
|
@ -1772,7 +1772,7 @@ public class QueryImpl
|
|||
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
StringBuilder buf = new StringBuilder(255);
|
||||
buf.append("Query: ").append(super.toString());
|
||||
buf.append("; candidate class: ").append(_class);
|
||||
buf.append("; query: ").append(_query);
|
||||
|
|
|
@ -50,7 +50,7 @@ class Concat
|
|||
protected Object eval(Object candidate, Object orig,
|
||||
StoreContext ctx, Object[] params) {
|
||||
Object str = _val.eval(candidate, orig, ctx, params);
|
||||
StringBuffer cat = new StringBuffer(str.toString());
|
||||
StringBuilder cat = new StringBuilder(str.toString());
|
||||
|
||||
Object arg = _args.eval(candidate, orig, ctx, params);
|
||||
if (arg instanceof Object[]) {
|
||||
|
|
|
@ -327,7 +327,7 @@ public class JPQLExpressionBuilder
|
|||
* child, separated by the delimiter.
|
||||
*/
|
||||
private static String assemble(JPQLNode node, String delimiter, int last) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
StringBuilder result = new StringBuilder();
|
||||
JPQLNode[] parts = node.children;
|
||||
for (int i = 0; parts != null && i < parts.length - last; i++)
|
||||
result.append(result.length() > 0 ? delimiter : "").
|
||||
|
|
|
@ -1207,7 +1207,7 @@ public class FieldMetaData
|
|||
*/
|
||||
public String getOrderDeclaration() {
|
||||
if (_orderDec == null && _orders != null) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < _orders.length; i++) {
|
||||
if (i > 0)
|
||||
buf.append(", ");
|
||||
|
|
|
@ -573,7 +573,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
|||
* Return a string representation of the given mode flags.
|
||||
*/
|
||||
private static String toModeString(int mode) {
|
||||
StringBuffer buf = new StringBuffer(31);
|
||||
StringBuilder buf = new StringBuilder(31);
|
||||
if ((mode & MODE_META) != 0)
|
||||
buf.append("[META]");
|
||||
if ((mode & MODE_QUERY) != 0)
|
||||
|
|
|
@ -279,7 +279,7 @@ public class SequenceMetaData
|
|||
Class cls = Class.forName(clsName, true,
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(Seq.class)));
|
||||
StringBuffer props = new StringBuffer();
|
||||
StringBuilder props = new StringBuilder();
|
||||
if (plugin.getProperties() != null)
|
||||
props.append(plugin.getProperties());
|
||||
addStandardProperties(props);
|
||||
|
@ -343,7 +343,7 @@ public class SequenceMetaData
|
|||
/**
|
||||
* Add standard properties to the given properties buffer.
|
||||
*/
|
||||
protected void addStandardProperties(StringBuffer props) {
|
||||
protected void addStandardProperties(StringBuilder props) {
|
||||
appendProperty(props, PROP_SEQUENCE, wrapValue(_sequence));
|
||||
appendProperty(props, PROP_INITIAL_VALUE, _initial);
|
||||
appendProperty(props, PROP_ALLOCATE, _allocate);
|
||||
|
@ -367,7 +367,7 @@ public class SequenceMetaData
|
|||
* Add a string property to the buffer. Nothing will be added if value
|
||||
* is null or empty string.
|
||||
*/
|
||||
protected void appendProperty(StringBuffer props, String name, String val) {
|
||||
protected void appendProperty(StringBuilder props, String name, String val) {
|
||||
if (StringUtils.isEmpty(val))
|
||||
return;
|
||||
if (props.length() > 0)
|
||||
|
@ -378,7 +378,7 @@ public class SequenceMetaData
|
|||
/**
|
||||
* Add an int property to the buffer. Nothing will be added if value is -1.
|
||||
*/
|
||||
protected void appendProperty(StringBuffer props, String name, int val) {
|
||||
protected void appendProperty(StringBuilder props, String name, int val) {
|
||||
if (val == -1)
|
||||
return;
|
||||
if (props.length() > 0)
|
||||
|
|
|
@ -121,7 +121,7 @@ public class Exceptions {
|
|||
* Safely stringify the given objects.
|
||||
*/
|
||||
public static String toString(Collection failed) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[");
|
||||
for (Iterator itr = failed.iterator(); itr.hasNext();) {
|
||||
buf.append(Exceptions.toString(itr.next()));
|
||||
|
@ -137,7 +137,7 @@ public class Exceptions {
|
|||
*/
|
||||
public static String toString(ExceptionInfo e) {
|
||||
int type = e.getType();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<").
|
||||
append(OpenJPAVersion.VERSION_ID).
|
||||
append(' ').
|
||||
|
|
|
@ -916,7 +916,7 @@ public class ConfigurationImpl
|
|||
public static String toXMLName(String propName) {
|
||||
if (propName == null)
|
||||
return null;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
char c;
|
||||
for (int i = 0; i < propName.length(); i++) {
|
||||
c = propName.charAt(i);
|
||||
|
|
|
@ -527,7 +527,7 @@ public class Configurations {
|
|||
if (map == null || map.isEmpty())
|
||||
return null;
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Map.Entry entry;
|
||||
String val;
|
||||
for (Iterator itr = map.entrySet().iterator(); itr.hasNext();) {
|
||||
|
@ -584,7 +584,7 @@ public class Configurations {
|
|||
val = val.substring(1, val.length() - 1);
|
||||
else if (val.startsWith("\"") || val.startsWith("'")) {
|
||||
quote = val.charAt(0);
|
||||
StringBuffer buf = new StringBuffer(val.substring(1));
|
||||
StringBuilder buf = new StringBuilder(val.substring(1));
|
||||
int quotIdx;
|
||||
while (++i < props.length) {
|
||||
buf.append(",");
|
||||
|
|
|
@ -106,7 +106,7 @@ public class PluginListValue extends ObjectValue {
|
|||
if (_names.length == 0)
|
||||
return null;
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < _names.length; i++) {
|
||||
if (i > 0)
|
||||
buf.append(", ");
|
||||
|
@ -136,7 +136,7 @@ public class PluginListValue extends ObjectValue {
|
|||
// split up the string; each element might be a class name, or a
|
||||
// class name with properties settings
|
||||
List<String> plugins = new ArrayList<String>();
|
||||
StringBuffer plugin = new StringBuffer();
|
||||
StringBuilder plugin = new StringBuilder();
|
||||
boolean inParen = false;
|
||||
char c;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
|
@ -155,7 +155,7 @@ public class PluginListValue extends ObjectValue {
|
|||
plugin.append(c);
|
||||
else {
|
||||
plugins.add(plugin.toString());
|
||||
plugin = new StringBuffer();
|
||||
plugin = new StringBuilder();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -266,7 +266,7 @@ public class ProductDerivations {
|
|||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
ConfigurationProvider provider = null;
|
||||
StringBuffer errs = null;
|
||||
StringBuilder errs = null;
|
||||
// most specific to least
|
||||
Throwable err = null;
|
||||
for (int i = _derivations.length - 1; i >= 0; i--) {
|
||||
|
@ -276,7 +276,7 @@ public class ProductDerivations {
|
|||
return provider;
|
||||
} catch (Throwable t) {
|
||||
err = t;
|
||||
errs = (errs == null) ? new StringBuffer() : errs.append("\n");
|
||||
errs = (errs == null) ? new StringBuilder() : errs.append("\n");
|
||||
errs.append(_derivations[i].getClass().getName() + ":" + t);
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ public class ProductDerivations {
|
|||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
ConfigurationProvider provider = null;
|
||||
StringBuffer errs = null;
|
||||
StringBuilder errs = null;
|
||||
Throwable err = null;
|
||||
// most specific to least
|
||||
for (int i = _derivations.length - 1; i >= 0; i--) {
|
||||
|
@ -311,7 +311,7 @@ public class ProductDerivations {
|
|||
return provider;
|
||||
} catch (Throwable t) {
|
||||
err = t;
|
||||
errs = (errs == null) ? new StringBuffer() : errs.append("\n");
|
||||
errs = (errs == null) ? new StringBuilder() : errs.append("\n");
|
||||
errs.append(_derivations[i].getClass().getName() + ":" + t);
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ public class ProductDerivations {
|
|||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
ConfigurationProvider provider = null;
|
||||
StringBuffer errs = null;
|
||||
StringBuilder errs = null;
|
||||
String type = (globals) ? "globals" : "defaults";
|
||||
Throwable err = null;
|
||||
// most specific to least
|
||||
|
@ -360,7 +360,7 @@ public class ProductDerivations {
|
|||
return provider;
|
||||
} catch (Throwable t) {
|
||||
err = t;
|
||||
errs = (errs == null) ? new StringBuffer() : errs.append("\n");
|
||||
errs = (errs == null) ? new StringBuilder() : errs.append("\n");
|
||||
errs.append(_derivations[i].getClass().getName() + ":" + t);
|
||||
}
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ public class ProductDerivations {
|
|||
/**
|
||||
* Thrown proper exception for given errors.
|
||||
*/
|
||||
private static void reportErrors(StringBuffer errs, String resource,
|
||||
private static void reportErrors(StringBuilder errs, String resource,
|
||||
Throwable nested) {
|
||||
if (errs == null)
|
||||
return;
|
||||
|
@ -392,7 +392,7 @@ public class ProductDerivations {
|
|||
public static List<String> getFullyQualifiedAnchorsInPropertiesLocation(
|
||||
final String propertiesLocation) {
|
||||
List<String> fqAnchors = new ArrayList<String>();
|
||||
StringBuffer errs = null;
|
||||
StringBuilder errs = null;
|
||||
Throwable err = null;
|
||||
for (int i = _derivations.length - 1; i >= 0; i--) {
|
||||
try {
|
||||
|
@ -423,7 +423,7 @@ public class ProductDerivations {
|
|||
}
|
||||
} catch (Throwable t) {
|
||||
err = t;
|
||||
errs = (errs == null) ? new StringBuffer() : errs.append("\n");
|
||||
errs = (errs == null) ? new StringBuilder() : errs.append("\n");
|
||||
errs.append(_derivations[i].getClass().getName() + ":" + t);
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ public class ProductDerivations {
|
|||
* Return a message about the status of each product derivation.
|
||||
*/
|
||||
private static String derivationErrorsToString() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("ProductDerivations: ").append(_derivationNames.length);
|
||||
for (int i = 0; i < _derivationNames.length; i++) {
|
||||
buf.append("\n").append(i + 1).append(". ").
|
||||
|
|
|
@ -88,7 +88,7 @@ public class StringListValue extends Value {
|
|||
// canonical values. Also, catch any bad aliases.
|
||||
boolean found;
|
||||
String iString;
|
||||
StringBuffer retv = new StringBuffer();
|
||||
StringBuilder retv = new StringBuilder();
|
||||
String[] vals = str.split(",", 0);
|
||||
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
|
|
|
@ -132,7 +132,7 @@ public class DataSourceLogs {
|
|||
if (startTime != -1)
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
|
||||
StringBuffer buf = new StringBuffer(25 + msg.length());
|
||||
StringBuilder buf = new StringBuilder(25 + msg.length());
|
||||
buf.append("<t ").append(Thread.currentThread().hashCode());
|
||||
if (conn != null)
|
||||
buf.append(", ").append(conn);
|
||||
|
|
|
@ -85,7 +85,7 @@ public abstract class DelegatingDatabaseMetaData implements DatabaseMetaData {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer("metadata ").append(hashCode());
|
||||
StringBuilder buf = new StringBuilder("metadata ").append(hashCode());
|
||||
buf.append("[").append(_metaData.toString()).append("]");
|
||||
return buf.toString();
|
||||
}
|
||||
|
|
|
@ -1345,9 +1345,9 @@ public class LoggingConnectionDecorator implements ConnectionDecorator {
|
|||
buf.append(_sql);
|
||||
}
|
||||
|
||||
StringBuffer paramBuf = null;
|
||||
StringBuilder paramBuf = null;
|
||||
if (_params != null && !_params.isEmpty()) {
|
||||
paramBuf = new StringBuffer();
|
||||
paramBuf = new StringBuilder();
|
||||
for (Iterator<String> itr = _params.iterator(); itr
|
||||
.hasNext();) {
|
||||
paramBuf.append(itr.next());
|
||||
|
@ -1928,9 +1928,9 @@ public class LoggingConnectionDecorator implements ConnectionDecorator {
|
|||
buf.append(_sql);
|
||||
}
|
||||
|
||||
StringBuffer paramBuf = null;
|
||||
StringBuilder paramBuf = null;
|
||||
if (_params != null && !_params.isEmpty()) {
|
||||
paramBuf = new StringBuffer();
|
||||
paramBuf = new StringBuilder();
|
||||
for (Iterator<String> itr = _params.iterator(); itr
|
||||
.hasNext();) {
|
||||
paramBuf.append(itr.next());
|
||||
|
|
|
@ -136,8 +136,8 @@ public class SQLFormatter {
|
|||
if (!multiLine) {
|
||||
return prettyPrintLine(sqlObject);
|
||||
} else {
|
||||
StringBuffer sql = new StringBuffer(sqlObject.toString());
|
||||
StringBuffer buf = new StringBuffer(sql.length());
|
||||
StringBuilder sql = new StringBuilder(sqlObject.toString());
|
||||
StringBuilder buf = new StringBuilder(sql.length());
|
||||
|
||||
while (sql.length() > 0) {
|
||||
String line = null;
|
||||
|
@ -183,9 +183,9 @@ public class SQLFormatter {
|
|||
|
||||
int start = 0;
|
||||
int end = -1;
|
||||
StringBuffer clause;
|
||||
List<StringBuffer> clauses = new ArrayList<StringBuffer>();
|
||||
clauses.add(new StringBuffer());
|
||||
StringBuilder clause;
|
||||
List<StringBuilder> clauses = new ArrayList<StringBuilder>();
|
||||
clauses.add(new StringBuilder());
|
||||
for (int i = 0; i < separators.length; i++) {
|
||||
end = lowerCaseSql.indexOf(" " + separators[i].toLowerCase(),
|
||||
start);
|
||||
|
@ -195,7 +195,7 @@ public class SQLFormatter {
|
|||
clause = clauses.get(clauses.size() - 1);
|
||||
clause.append(sql.substring(start, end));
|
||||
|
||||
clause = new StringBuffer();
|
||||
clause = new StringBuilder();
|
||||
clauses.add(clause);
|
||||
clause.append(clauseIndent);
|
||||
clause.append(separators[i]);
|
||||
|
@ -206,8 +206,8 @@ public class SQLFormatter {
|
|||
clause = clauses.get(clauses.size() - 1);
|
||||
clause.append(sql.substring(start));
|
||||
|
||||
StringBuffer pp = new StringBuffer(sql.length());
|
||||
for (Iterator<StringBuffer> iter = clauses.iterator(); iter.hasNext();){
|
||||
StringBuilder pp = new StringBuilder(sql.length());
|
||||
for (Iterator<StringBuilder> iter = clauses.iterator(); iter.hasNext();){
|
||||
pp.append(wrapLine(iter.next().toString()));
|
||||
if (iter.hasNext())
|
||||
pp.append(newline);
|
||||
|
@ -217,7 +217,7 @@ public class SQLFormatter {
|
|||
}
|
||||
|
||||
private String wrapLine(String line) {
|
||||
StringBuffer lines = new StringBuffer(line.length());
|
||||
StringBuilder lines = new StringBuilder(line.length());
|
||||
|
||||
// ensure that any leading whitespace is preserved.
|
||||
for (int i = 0; i < line.length() &&
|
||||
|
|
|
@ -316,12 +316,12 @@ public class LogFactoryImpl
|
|||
*/
|
||||
protected String formatMessage(short level, String message,
|
||||
Throwable t) {
|
||||
// we write to a StringBuffer and then flush it all at
|
||||
// we write to a StringBuilder and then flush it all at
|
||||
// once as a single line, since some environments(e.g., JBoss)
|
||||
// override the System output stream to flush any calls
|
||||
// to write without regard to line breaks, making the
|
||||
// output incomprehensibe.
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
buf.append(getOffset());
|
||||
buf.append(" ");
|
||||
|
|
|
@ -338,14 +338,14 @@ public class ClassArgParser {
|
|||
// find the line with the package declaration
|
||||
in = new BufferedReader(new FileReader(file));
|
||||
String line;
|
||||
StringBuffer pack = null;
|
||||
StringBuilder pack = null;
|
||||
while ((line = in.readLine()) != null) {
|
||||
line = line.trim();
|
||||
if (line.startsWith("package ")) {
|
||||
line = line.substring(8).trim();
|
||||
|
||||
// strip off anything beyond the package declaration
|
||||
pack = new StringBuffer();
|
||||
pack = new StringBuilder();
|
||||
for (int i = 0; i < line.length(); i++) {
|
||||
if (Character.isJavaIdentifierPart(line.charAt(i))
|
||||
|| line.charAt(i) == '.')
|
||||
|
@ -579,7 +579,7 @@ public class ClassArgParser {
|
|||
* Read the current text value until the next element.
|
||||
*/
|
||||
private String readElementText(Reader in) throws IOException {
|
||||
StringBuffer buf = null;
|
||||
StringBuilder buf = null;
|
||||
int ch;
|
||||
while (true) {
|
||||
ch = in.read();
|
||||
|
@ -590,7 +590,7 @@ public class ClassArgParser {
|
|||
if (Character.isWhitespace((char) ch))
|
||||
continue;
|
||||
if (buf == null)
|
||||
buf = new StringBuffer();
|
||||
buf = new StringBuilder();
|
||||
buf.append((char) ch);
|
||||
}
|
||||
return (buf == null) ? "" : buf.toString();
|
||||
|
@ -612,7 +612,7 @@ public class ClassArgParser {
|
|||
* Return the current attribute value.
|
||||
*/
|
||||
private String readAttributeValue(Reader in) throws IOException {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
int ch;
|
||||
while (true) {
|
||||
ch = in.read();
|
||||
|
|
|
@ -43,7 +43,7 @@ public class SourceTrackers {
|
|||
* be provided.
|
||||
*/
|
||||
public static String getSourceLocationMessage(SourceTracker[] trackers) {
|
||||
StringBuffer buf = new StringBuffer(20 * (trackers.length + 1));
|
||||
StringBuilder buf = new StringBuilder(20 * (trackers.length + 1));
|
||||
buf.append(_loc.get("source-trackers-location-header")).append(SEP);
|
||||
String sourceFilePath;
|
||||
for (int i = 0; i < trackers.length; i++) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Base16Encoder {
|
|||
* Convert bytes to a base16 string.
|
||||
*/
|
||||
public static String encode(byte[] byteArray) {
|
||||
StringBuffer hexBuffer = new StringBuffer(byteArray.length * 2);
|
||||
StringBuilder hexBuffer = new StringBuilder(byteArray.length * 2);
|
||||
for (int i = 0; i < byteArray.length; i++)
|
||||
for (int j = 1; j >= 0; j--)
|
||||
hexBuffer.append(HEX[(byteArray[i] >> (j * 4)) & 0xF]);
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class CodeFormat implements Cloneable {
|
|||
if (tab == 0)
|
||||
_tab = "\t";
|
||||
else {
|
||||
StringBuffer tabs = new StringBuffer(tab);
|
||||
StringBuilder tabs = new StringBuilder(tab);
|
||||
for (int i = 0; i < tab; i++)
|
||||
tabs.append(" ");
|
||||
_tab = tabs.toString();
|
||||
|
@ -167,7 +167,7 @@ public final class CodeFormat implements Cloneable {
|
|||
if (num == 1)
|
||||
return _sep;
|
||||
|
||||
StringBuffer buf = new StringBuffer(_sep.length() * num);
|
||||
StringBuilder buf = new StringBuilder(_sep.length() * num);
|
||||
for (int i = 0; i < num; i++)
|
||||
buf.append(_sep);
|
||||
return buf.toString();
|
||||
|
@ -302,7 +302,7 @@ public final class CodeFormat implements Cloneable {
|
|||
if (tabLevel == 1)
|
||||
return _tab;
|
||||
|
||||
StringBuffer tabs = new StringBuffer(_tab.length() * tabLevel);
|
||||
StringBuilder tabs = new StringBuilder(_tab.length() * tabLevel);
|
||||
for (int i = 0; i < tabLevel; i++)
|
||||
tabs.append(_tab);
|
||||
return tabs.toString();
|
||||
|
@ -313,7 +313,7 @@ public final class CodeFormat implements Cloneable {
|
|||
* Returns parametrized type string for given type(s).
|
||||
*/
|
||||
public String getParametrizedType(String[] typenames) {
|
||||
StringBuffer buf = new StringBuffer ();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<");
|
||||
for (int i = 0; i < typenames.length; i++) {
|
||||
if (i > 0)
|
||||
|
|
|
@ -311,7 +311,7 @@ public class FormatPreservingProperties extends Properties {
|
|||
|| line.charAt(pos) == '#' || line.charAt(pos) == '!')
|
||||
continue;
|
||||
|
||||
StringBuffer key = new StringBuffer();
|
||||
StringBuilder key = new StringBuilder();
|
||||
while (pos < line.length() && !isSpace(c = line.charAt(pos++))
|
||||
&& c != '=' && c != ':') {
|
||||
if (c == '\\') {
|
||||
|
@ -341,7 +341,7 @@ public class FormatPreservingProperties extends Properties {
|
|||
pos++;
|
||||
}
|
||||
|
||||
StringBuffer element = new StringBuffer(line.length() - pos);
|
||||
StringBuilder element = new StringBuilder(line.length() - pos);
|
||||
|
||||
while (pos < line.length()) {
|
||||
c = line.charAt(pos++);
|
||||
|
@ -385,7 +385,7 @@ public class FormatPreservingProperties extends Properties {
|
|||
* @param value the value we are appending to
|
||||
* @return the position after the reading is done
|
||||
*/
|
||||
private static int readEscape(String source, int pos, StringBuffer value) {
|
||||
private static int readEscape(String source, int pos, StringBuilder value) {
|
||||
char c = source.charAt(pos++);
|
||||
switch (c) {
|
||||
case 'n':
|
||||
|
@ -485,7 +485,7 @@ public class FormatPreservingProperties extends Properties {
|
|||
|
||||
private boolean writeProperty(String key, PrintWriter writer,
|
||||
boolean needsNewline) {
|
||||
StringBuffer s = new StringBuffer();
|
||||
StringBuilder s = new StringBuilder();
|
||||
|
||||
if (key == null)
|
||||
return false;
|
||||
|
@ -517,7 +517,7 @@ public class FormatPreservingProperties extends Properties {
|
|||
* @param isKey if true, then the string is a Property key, otherwise
|
||||
* it is a value
|
||||
*/
|
||||
private static void formatValue(String str, StringBuffer buf,
|
||||
private static void formatValue(String str, StringBuilder buf,
|
||||
boolean isKey) {
|
||||
if (isKey) {
|
||||
buf.setLength(0);
|
||||
|
@ -569,7 +569,7 @@ public class FormatPreservingProperties extends Properties {
|
|||
*/
|
||||
private class PropertyLine implements Serializable {
|
||||
|
||||
private final StringBuffer line = new StringBuffer();
|
||||
private final StringBuilder line = new StringBuilder();
|
||||
private String propertyKey;
|
||||
private String propertyValue;
|
||||
|
||||
|
|
|
@ -199,14 +199,14 @@ public class ParameterTemplate {
|
|||
if (_buf.length() == 0 || _params.isEmpty())
|
||||
return _buf.toString();
|
||||
|
||||
StringBuffer copy = new StringBuffer();
|
||||
StringBuffer param = null;
|
||||
StringBuilder copy = new StringBuilder();
|
||||
StringBuilder param = null;
|
||||
char ch, last = 0;
|
||||
for (int i = 0; i < _buf.length(); i++) {
|
||||
ch = _buf.charAt(i);
|
||||
if (last == '$' && ch == '{') {
|
||||
copy.deleteCharAt(copy.length() - 1);
|
||||
param = new StringBuffer();
|
||||
param = new StringBuilder();
|
||||
} else if (ch == '}' && param != null) {
|
||||
if (_params.containsKey(param.toString()))
|
||||
copy.append(_params.get(param.toString()));
|
||||
|
|
|
@ -434,11 +434,11 @@ public class PersistenceMetaDataFactory
|
|||
* Ensure all fields have declared a strategy.
|
||||
*/
|
||||
private void validateStrategies(ClassMetaData meta) {
|
||||
StringBuffer buf = null;
|
||||
StringBuilder buf = null;
|
||||
for (FieldMetaData fmd : meta.getDeclaredFields()) {
|
||||
if (!fmd.isExplicit()) {
|
||||
if (buf == null)
|
||||
buf = new StringBuffer();
|
||||
buf = new StringBuilder();
|
||||
else
|
||||
buf.append(", ");
|
||||
buf.append(fmd);
|
||||
|
|
|
@ -398,7 +398,7 @@ public class PersistenceUnitInfoImpl
|
|||
Properties metaFactoryProps = new Properties();
|
||||
if (info.getManagedClassNames() != null
|
||||
&& !info.getManagedClassNames().isEmpty()) {
|
||||
StringBuffer types = new StringBuffer();
|
||||
StringBuilder types = new StringBuilder();
|
||||
for (String type : info.getManagedClassNames()) {
|
||||
if (types.length() > 0)
|
||||
types.append(';');
|
||||
|
@ -409,7 +409,7 @@ public class PersistenceUnitInfoImpl
|
|||
if (info.getJarFileUrls() != null && !info.getJarFileUrls().isEmpty()
|
||||
|| (!info.excludeUnlistedClasses()
|
||||
&& info.getPersistenceUnitRootUrl() != null)) {
|
||||
StringBuffer jars = new StringBuffer();
|
||||
StringBuilder jars = new StringBuilder();
|
||||
String file = null;
|
||||
if (!info.excludeUnlistedClasses()
|
||||
&& info.getPersistenceUnitRootUrl() != null) {
|
||||
|
@ -431,7 +431,7 @@ public class PersistenceUnitInfoImpl
|
|||
}
|
||||
if (info.getMappingFileNames() != null
|
||||
&& !info.getMappingFileNames().isEmpty()) {
|
||||
StringBuffer rsrcs = new StringBuffer();
|
||||
StringBuilder rsrcs = new StringBuilder();
|
||||
for (String rsrc : info.getMappingFileNames()) {
|
||||
if (rsrcs.length() > 0)
|
||||
rsrcs.append(';');
|
||||
|
|
|
@ -363,7 +363,7 @@ public class MetamodelImpl implements Metamodel, Resolver {
|
|||
}
|
||||
ParameterizedType pType = (ParameterizedType)type;
|
||||
java.lang.reflect.Type[] args = pType.getActualTypeArguments();
|
||||
StringBuffer tmp = new StringBuffer(pType.getRawType().toString());
|
||||
StringBuilder tmp = new StringBuilder(pType.getRawType().toString());
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
tmp.append((i == 0) ? "<" : ",");
|
||||
tmp.append(toTypeName(args[i]));
|
||||
|
|
|
@ -450,7 +450,7 @@ public class SourceAnnotationHandler
|
|||
|
||||
String toDetails(Element e) {
|
||||
TypeMirror mirror = e.asType();
|
||||
return new StringBuffer(e.getKind().toString()).append(" ")
|
||||
return new StringBuilder(e.getKind().toString()).append(" ")
|
||||
.append(e.toString())
|
||||
.append("Mirror ")
|
||||
.append(mirror.getKind().toString())
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ArrayExpression extends ExpressionImpl {
|
|||
|
||||
@Override
|
||||
public String asExpression(AliasContext ctx) {
|
||||
StringBuffer tmp = new StringBuffer(OPEN_BRACE);
|
||||
StringBuilder tmp = new StringBuilder(OPEN_BRACE);
|
||||
for (int i = 0; i < _values.length; i++) {
|
||||
Object v = _values[i];
|
||||
tmp.append((v instanceof Visitable ?
|
||||
|
|
|
@ -49,7 +49,7 @@ public class JoinPath extends AbstractDomainObject implements DomainObject {
|
|||
|
||||
@Override
|
||||
public String asJoinable(AliasContext ctx) {
|
||||
return new StringBuffer(getOperator().toString())
|
||||
return new StringBuilder(getOperator().toString())
|
||||
.append(getParent().asProjection(ctx))
|
||||
.append(NAVIGATION)
|
||||
.append(getLastSegment())
|
||||
|
|
|
@ -55,7 +55,7 @@ public class LocateExpression extends BinaryOperatorExpression {
|
|||
public String asExpression(AliasContext ctx) {
|
||||
String start = _start == null ? EMPTY : COMMA +
|
||||
((Visitable)_start).asExpression(ctx);
|
||||
return new StringBuffer(_op.toString())
|
||||
return new StringBuilder(_op.toString())
|
||||
.append(OPEN_BRACE)
|
||||
.append(((Visitable)_e1).asExpression(ctx))
|
||||
.append(COMMA)
|
||||
|
|
|
@ -48,7 +48,7 @@ public class NewInstance extends AbstractVisitable
|
|||
|
||||
|
||||
public String asProjection(AliasContext ctx) {
|
||||
StringBuffer tmp = new StringBuffer("NEW ").append(_cls.getName())
|
||||
StringBuilder tmp = new StringBuilder("NEW ").append(_cls.getName())
|
||||
.append("(");
|
||||
if (_args == null || _args.isEmpty())
|
||||
return tmp.append(")").toString();
|
||||
|
|
|
@ -354,7 +354,7 @@ public class QueryDefinitionImpl extends ExpressionImpl
|
|||
@Override
|
||||
public String asExpression(AliasContext ctx) {
|
||||
ctx.push(this);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
registerDomains(ctx);
|
||||
String select = _distinct ? "SELECT DISTINCT " : "SELECT ";
|
||||
fillBuffer(select, buffer, ctx, getProjections(), Visit.PROJECTION);
|
||||
|
@ -371,7 +371,7 @@ public class QueryDefinitionImpl extends ExpressionImpl
|
|||
return asExpression(ctx);
|
||||
}
|
||||
|
||||
public void fillBuffer(String header, StringBuffer buffer, AliasContext ctx,
|
||||
public void fillBuffer(String header, StringBuilder buffer, AliasContext ctx,
|
||||
List list, Visit visit) {
|
||||
if (list == null || list.isEmpty())
|
||||
return;
|
||||
|
@ -392,7 +392,7 @@ public class QueryDefinitionImpl extends ExpressionImpl
|
|||
}
|
||||
}
|
||||
|
||||
public void fillBuffer(String header, StringBuffer buffer, AliasContext ctx,
|
||||
public void fillBuffer(String header, StringBuilder buffer, AliasContext ctx,
|
||||
Predicate p) {
|
||||
if (p == null)
|
||||
return;
|
||||
|
|
|
@ -35,7 +35,7 @@ public class VarArgsExpression extends ExpressionImpl {
|
|||
|
||||
@Override
|
||||
public String asExpression(AliasContext ctx) {
|
||||
StringBuffer tmp = new StringBuffer();
|
||||
StringBuilder tmp = new StringBuilder();
|
||||
for (int i = 0; i < _values.length; i++) {
|
||||
Visitable v = (Visitable)_values[i];
|
||||
tmp.append(v.asExpression(ctx))
|
||||
|
|
|
@ -47,7 +47,7 @@ public class WhenClause {
|
|||
}
|
||||
|
||||
public String toJPQL(AliasContext ctx) {
|
||||
StringBuffer tmp = new StringBuffer();
|
||||
StringBuilder tmp = new StringBuilder();
|
||||
tmp.append(" WHEN ").append(JPQLHelper.toJPQL(ctx, when))
|
||||
.append(" THEN ").append(JPQLHelper.toJPQL(ctx, then));
|
||||
return tmp.toString();
|
||||
|
|
|
@ -190,7 +190,7 @@ public class SourceCode {
|
|||
public static String[] wrap(String longLine, int width) {
|
||||
String[] words = longLine.split("\\ ");
|
||||
List<String> lines = new ArrayList<String>();
|
||||
StringBuffer line = new StringBuffer();
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
String w = words[i];
|
||||
if (line.length() + w.length() < width) {
|
||||
|
@ -680,7 +680,7 @@ public class SourceCode {
|
|||
}
|
||||
|
||||
public Annotation addArgument(String key, String[] vs) {
|
||||
StringBuffer tmp = new StringBuffer(BLOCK_DELIMITER.start);
|
||||
StringBuilder tmp = new StringBuilder(BLOCK_DELIMITER.start);
|
||||
for (int i=0; i < vs.length; i++) {
|
||||
tmp.append(quote(vs[i]));
|
||||
tmp.append(i != vs.length-1 ? COMMA : BLANK);
|
||||
|
|
|
@ -373,7 +373,7 @@ public final class ObjectData
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Class: (" + _meta.getDescribedType().getName() + ")\n");
|
||||
buf.append("Object Id: (" + _oid + ")\n");
|
||||
buf.append("Version: (" + _version + ")\n");
|
||||
|
|
Loading…
Reference in New Issue