replace some more StringBuffers

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2019-11-21 16:04:37 +00:00
parent cd3f373c44
commit f82a1ffe6a
2 changed files with 15 additions and 15 deletions

View File

@ -48,10 +48,10 @@ public abstract class BuildFileTest extends TestCase {
protected Project project; protected Project project;
private StringBuffer logBuffer; private StringBuilder logBuffer;
private StringBuffer fullLogBuffer; private StringBuilder fullLogBuffer;
private StringBuffer outBuffer; private StringBuilder outBuffer;
private StringBuffer errBuffer; private StringBuilder errBuffer;
private BuildException buildException; private BuildException buildException;
/** /**
@ -265,8 +265,8 @@ public abstract class BuildFileTest extends TestCase {
return buildException; return buildException;
} }
private String cleanBuffer(StringBuffer buffer) { private String cleanBuffer(StringBuilder buffer) {
StringBuffer cleanedBuffer = new StringBuffer(); StringBuilder cleanedBuffer = new StringBuilder();
for (int i = 0; i < buffer.length(); i++) { for (int i = 0; i < buffer.length(); i++) {
char ch = buffer.charAt(i); char ch = buffer.charAt(i);
if (ch != '\r') { if (ch != '\r') {
@ -292,8 +292,8 @@ public abstract class BuildFileTest extends TestCase {
*/ */
public void configureProject(String filename, int logLevel) public void configureProject(String filename, int logLevel)
throws BuildException { throws BuildException {
logBuffer = new StringBuffer(); logBuffer = new StringBuilder();
fullLogBuffer = new StringBuffer(); fullLogBuffer = new StringBuilder();
project = new Project(); project = new Project();
project.init(); project.init();
project.setNewProperty("data.dir.name", getDataDir()); project.setNewProperty("data.dir.name", getDataDir());
@ -315,14 +315,14 @@ public abstract class BuildFileTest extends TestCase {
try { try {
sysOut.flush(); sysOut.flush();
sysErr.flush(); sysErr.flush();
outBuffer = new StringBuffer(); outBuffer = new StringBuilder();
PrintStream out = new PrintStream(new AntOutputStream(outBuffer)); PrintStream out = new PrintStream(new AntOutputStream(outBuffer));
System.setOut(out); System.setOut(out);
errBuffer = new StringBuffer(); errBuffer = new StringBuilder();
PrintStream err = new PrintStream(new AntOutputStream(errBuffer)); PrintStream err = new PrintStream(new AntOutputStream(errBuffer));
System.setErr(err); System.setErr(err);
logBuffer = new StringBuffer(); logBuffer = new StringBuilder();
fullLogBuffer = new StringBuffer(); fullLogBuffer = new StringBuilder();
buildException = null; buildException = null;
project.executeTarget(targetName); project.executeTarget(targetName);
} finally { } finally {
@ -483,9 +483,9 @@ public abstract class BuildFileTest extends TestCase {
* an output stream which saves stuff to our buffer. * an output stream which saves stuff to our buffer.
*/ */
protected static class AntOutputStream extends java.io.OutputStream { protected static class AntOutputStream extends java.io.OutputStream {
private StringBuffer buffer; private StringBuilder buffer;
public AntOutputStream(StringBuffer buffer) { public AntOutputStream(StringBuilder buffer) {
this.buffer = buffer; this.buffer = buffer;
} }

View File

@ -71,7 +71,7 @@ public final class TestNpv extends TestCase {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("IrrNpvTestCaseData.xls"); HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("IrrNpvTestCaseData.xls");
HSSFSheet sheet = wb.getSheet("IRR-NPV"); HSSFSheet sheet = wb.getSheet("IRR-NPV");
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
StringBuffer failures = new StringBuffer(); StringBuilder failures = new StringBuilder();
int failureCount = 0; int failureCount = 0;
// TODO YK: Formulas in rows 16 and 17 operate with ArrayPtg which isn't yet supported // TODO YK: Formulas in rows 16 and 17 operate with ArrayPtg which isn't yet supported
// FormulaEvaluator as of r1041407 throws "Unexpected ptg class (org.apache.poi.ss.formula.ptg.ArrayPtg)" // FormulaEvaluator as of r1041407 throws "Unexpected ptg class (org.apache.poi.ss.formula.ptg.ArrayPtg)"