Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/com/ziclix/python/sql/Procedure.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public String toSql() throws SQLException {
}
}

StringBuffer sql = new StringBuffer("{");
StringBuilder sql = new StringBuilder("{");

if (colReturn > 0) {
PyList list = new PyList();
Expand Down Expand Up @@ -376,7 +376,7 @@ protected PyObject getDefault() {
*/
protected String getProcedureName() {

StringBuffer proc = new StringBuffer();
StringBuilder proc = new StringBuilder();

if (this.procedureCatalog.__nonzero__()) {
proc.append(this.procedureCatalog.toString()).append(".");
Expand Down
2 changes: 1 addition & 1 deletion src/com/ziclix/python/sql/connect/Connectx.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public String toString() {
*/
protected void invoke(Object src, String methodName, Object value) {
Method method = null;
StringBuffer exceptionMsg = new StringBuffer("method [");
StringBuilder exceptionMsg = new StringBuilder("method [");
exceptionMsg.append(methodName).append("] using arg type [");
exceptionMsg.append(value.getClass()).append("], value [");
exceptionMsg.append(value.toString()).append("]");
Expand Down
2 changes: 1 addition & 1 deletion src/com/ziclix/python/sql/pipe/db/DBSink.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected void createSql(PyObject row) {

int index = 0, len = row.__len__();
PyObject entry = Py.None, col = Py.None, pyIndex = Py.None;
StringBuffer sb = new StringBuffer("insert into ").append(this.tableName).append(" (");
StringBuilder sb = new StringBuilder("insert into ").append(this.tableName).append(" (");

/*
* Iterate through the columns and pull out the names for use in the insert
Expand Down
2 changes: 1 addition & 1 deletion src/com/ziclix/python/sql/pipe/db/DBSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public DBSource(PyConnection connection, Class dataHandler, String tableName, St
protected String createSql(String where) {

// create the sql statement, using the columns if available
StringBuffer sb = new StringBuffer("select ");
StringBuilder sb = new StringBuilder("select ");

if ((this.include == Py.None) || (this.include.__len__() == 0)) {
sb.append("*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected PyObject getDefault() {

protected String getProcedureName() {

StringBuffer proc = new StringBuffer();
StringBuilder proc = new StringBuilder();

if (this.procedureSchema.__nonzero__()) {
proc.append(this.procedureSchema.toString()).append(".");
Expand Down
10 changes: 5 additions & 5 deletions src/com/ziclix/python/sql/zxJDBC.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public static String getString(String key) {
}
} else {
String sep = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (i = 0; i < lines.size() - 1; i++) {
sb.append(lines.get(i)).append(sep);
}
Expand Down Expand Up @@ -393,15 +393,15 @@ public static PyException makeException(PyObject type, Throwable t, int rowIndex
return (PyException) t;
} else if (t instanceof SQLException) {
SQLException sqlException = (SQLException) t;
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
do {
buffer.append(sqlException.getMessage());
buffer.append(" [SQLCode: " + sqlException.getErrorCode() + "]");
buffer.append(" [SQLCode: ").append(sqlException.getErrorCode()).append("]");
if (sqlException.getSQLState() != null) {
buffer.append(", [SQLState: " + sqlException.getSQLState() + "]");
buffer.append(", [SQLState: ").append(sqlException.getSQLState()).append("]");
}
if (rowIndex >= 0) {
buffer.append(", [Row number: " + rowIndex + "]");
buffer.append(", [Row number: ").append(rowIndex).append("]");
}
sqlException = sqlException.getNextException();
if (sqlException != null) {
Expand Down
6 changes: 2 additions & 4 deletions src/org/python/antlr/GrammarActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public void setErrorHandler(ErrorHandler eh) {
}

String makeFromText(List dots, List<Name> names) {
StringBuilder d = new StringBuilder();
d.append(PythonTree.dottedNameListToString(names));
return d.toString();
return PythonTree.dottedNameListToString(names);
}

List<Name> makeModuleNameNode(List dots, List<Name> names) {
Expand Down Expand Up @@ -461,7 +459,7 @@ boolean isUnicode() {
PyString extractStrings(List s, String encoding, boolean unicodeLiterals) {
boolean ustring = false;
Token last = null;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
Iterator iter = s.iterator();
while (iter.hasNext()) {
last = (Token)iter.next();
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/antlr/PythonTokenSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ protected int findPreviousIndent(int i, Token t) {
}

public String stackString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (int j = sp; j >= 0; j--) {
buf.append(" ");
buf.append(indentStack[j]);
Expand Down
4 changes: 2 additions & 2 deletions src/org/python/antlr/PythonTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public String toStringTree() {
if (children == null || children.size() == 0) {
return this.toString();// + "[" + this.info() + "]";
}
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
if (!isNil()) {
buf.append("(");
buf.append(this.toString());// + "[" + this.info() + "]");
Expand Down Expand Up @@ -256,7 +256,7 @@ protected String dumpThis(Object o) {
}

protected String dumpThis(Object[] s) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (s == null) {
sb.append("null");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/compiler/ArgListCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Object visitName(Name node) throws Exception {

@Override
public Object visitTuple(Tuple node) throws Exception {
StringBuffer name = new StringBuffer("(");
StringBuilder name = new StringBuilder("(");
int n = node.getInternalElts().size();
for (int i = 0; i < n-1; i++) {
name.append(visit(node.getInternalElts().get(i)));
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/compiler/ProxyCodeHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static String mapClass(Class<?> c) {
if (index == -1) {
return name;
}
StringBuffer buf = new StringBuffer(name.length());
StringBuilder buf = new StringBuilder(name.length());
int last_index = 0;
while (index != -1) {
buf.append(name.substring(last_index, index));
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/compiler/ProxyMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public void addConstructorMethodCode(String pyName,
}

private String methodString(Method m) {
StringBuffer buf = new StringBuffer(m.getName());
StringBuilder buf = new StringBuilder(m.getName());
buf.append(":");
Class<?>[] params = m.getParameterTypes();
for (Class<?> param : params) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/compiler/ScopeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void dump() { // for debugging
for (int i = 0; i < level; i++) {
m.append(' ');
}
m.append(((kind != CLASSSCOPE) ? scope_name : "class " + scope_name) + ": ");
m.append((kind != CLASSSCOPE) ? scope_name : "class " + scope_name).append(": ");
for (Map.Entry<String, SymInfo> entry : tbl.entrySet()) {
String name = entry.getKey();
SymInfo info = entry.getValue();
Expand Down
4 changes: 1 addition & 3 deletions src/org/python/core/PyBytecode.java
Original file line number Diff line number Diff line change
Expand Up @@ -1595,9 +1595,7 @@ private String upto(String x) {
private String upto(String x, int n) {
x = x.replace('\n', '|');
if (x.length() > n) {
StringBuilder item = new StringBuilder(x.substring(0, n));
item.append("...");
return item.toString();
return x.substring(0, n) + "...";
} else {
return x;
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/core/PyTraceback.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void dumpStack(StringBuilder buf) {
if (tb_next != null && tb_next != this) {
((PyTraceback)tb_next).dumpStack(buf);
} else if (tb_next == this) {
buf.append("circularity detected!"+this+tb_next);
buf.append("circularity detected!").append(this).append(tb_next);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/org/python/core/ReflectedArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,13 @@ public int compareTo(ReflectedArgs other) {

@Override
public String toString() {
String s = declaringClass + ", static=" + isStatic + ", varargs=" + isVarArgs + ",flags="
+ flags + ", " + method + "\n";
s = s + "\t(";
StringBuilder s = new StringBuilder(declaringClass + ", static=" + isStatic + ", varargs=" + isVarArgs + ",flags="
+ flags + ", " + method + "\n");
s.append("\t(");
for (Class<?> arg : args) {
s += arg.getName() + ", ";
s.append(arg.getName()).append(", ");
}
s += ")";
return s;
s.append(")");
return s.toString();
}
}
6 changes: 3 additions & 3 deletions src/org/python/core/SyspathJavaLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ static PyObject replacePathItem(PySystemState sys, int idx, PyList paths) {
}

private File getFile(String dir, String name) {
String accum = "";
StringBuilder accum = new StringBuilder();
boolean first = true;
for (StringTokenizer t = new StringTokenizer(name, "."); t
.hasMoreTokens();) {
String token = t.nextToken();
if (!first) {
accum += File.separator;
accum.append(File.separator);
}
accum += token;
accum.append(token);
first = false;
}
return new RelativeFile(dir, accum + ".class");
Expand Down
19 changes: 9 additions & 10 deletions src/org/python/indexer/Indexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,15 @@ private void duplicateBindingFailure(NBinding newb, NBinding oldb) {
return;
}

StringBuilder sb = new StringBuilder();
sb.append("Error creating binding ");
sb.append(newb);
sb.append(" in file ");
sb.append(newb.getFirstFile());
sb.append(": qname already bound to ");
sb.append(oldb);
sb.append(" in file ");
sb.append(oldb.getFirstFile());
reportFailedAssertion(sb.toString());
String sb = "Error creating binding " +
newb +
" in file " +
newb.getFirstFile() +
": qname already bound to " +
oldb +
" in file " +
oldb.getFirstFile();
reportFailedAssertion(sb);
}

public void putProblem(NNode loc, String msg) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/python/indexer/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static String moduleQname(String file) {
}

public static String arrayToString(Collection<String> strings) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (String s : strings) {
sb.append(s).append("\n");
}
Expand Down
6 changes: 2 additions & 4 deletions src/org/python/jsr223/PyScriptEngineFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ public String getMethodCallSyntax(String obj, String m, String... args) {

// presumably a unicode string
public String getOutputStatement(String toDisplay) {
StringBuilder buffer = new StringBuilder(toDisplay.length() + 8);
buffer.append("print ");
buffer.append(Py.newUnicode(toDisplay).__repr__());
return buffer.toString();
return "print " +
Py.newUnicode(toDisplay).__repr__();
}

public String getProgram(String... statements) {
Expand Down
Loading