BATCH-2407 Use StringBuilder instead of StringBuffer

With Java 1.5 StringBuilder is preferred over StringBuffer for single
threaded access as is has less overhead.

This is evidenced by the class comment of StringBuffer and Effective
Java 2nd Edition Item 67: Avoid excessive synchronization.

> The StringBuilder class should generally be used in preference to
> this one, as it supports all of the same operations but it is faster,
> as it performs no synchronization.

 - replace StringBuffer with StringBuilder where possible

Issue: BATCH-2407
This commit is contained in:
Philippe Marschall
2015-07-29 22:08:31 +02:00
committed by Michael Minella
parent 7092102748
commit dcc9da8273
18 changed files with 33 additions and 33 deletions

View File

@@ -156,10 +156,10 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean {
}
private String stripComments(List<String> list) {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
for (String line : list) {
if (!line.startsWith("//") && !line.startsWith("--")) {
buffer.append(line + "\n");
buffer.append(line).append("\n");
}
}
return buffer.toString();

View File

@@ -36,7 +36,7 @@ public class LogAdvice {
*/
public void doBasicLogging(JoinPoint pjp) throws Throwable {
Object[] args = pjp.getArgs();
StringBuffer output = new StringBuffer();
StringBuilder output = new StringBuilder();
output.append(pjp.getTarget().getClass().getName()).append(": ");
output.append(pjp.toShortString()).append(": ");