From: PJ Fanning Date: Thu, 21 Nov 2019 16:04:37 +0000 (+0000) Subject: replace some more StringBuffers X-Git-Tag: REL_4_1_2~129 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f82a1ffe6a362252a9a5deee4db59e615954cc6c;p=poi.git replace some more StringBuffers git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870096 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java b/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java index 2a4d714980..a582a45ab3 100644 --- a/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java +++ b/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java @@ -48,10 +48,10 @@ public abstract class BuildFileTest extends TestCase { protected Project project; - private StringBuffer logBuffer; - private StringBuffer fullLogBuffer; - private StringBuffer outBuffer; - private StringBuffer errBuffer; + private StringBuilder logBuffer; + private StringBuilder fullLogBuffer; + private StringBuilder outBuffer; + private StringBuilder errBuffer; private BuildException buildException; /** @@ -265,8 +265,8 @@ public abstract class BuildFileTest extends TestCase { return buildException; } - private String cleanBuffer(StringBuffer buffer) { - StringBuffer cleanedBuffer = new StringBuffer(); + private String cleanBuffer(StringBuilder buffer) { + StringBuilder cleanedBuffer = new StringBuilder(); for (int i = 0; i < buffer.length(); i++) { char ch = buffer.charAt(i); if (ch != '\r') { @@ -292,8 +292,8 @@ public abstract class BuildFileTest extends TestCase { */ public void configureProject(String filename, int logLevel) throws BuildException { - logBuffer = new StringBuffer(); - fullLogBuffer = new StringBuffer(); + logBuffer = new StringBuilder(); + fullLogBuffer = new StringBuilder(); project = new Project(); project.init(); project.setNewProperty("data.dir.name", getDataDir()); @@ -315,14 +315,14 @@ public abstract class BuildFileTest extends TestCase { try { sysOut.flush(); sysErr.flush(); - outBuffer = new StringBuffer(); + outBuffer = new StringBuilder(); PrintStream out = new PrintStream(new AntOutputStream(outBuffer)); System.setOut(out); - errBuffer = new StringBuffer(); + errBuffer = new StringBuilder(); PrintStream err = new PrintStream(new AntOutputStream(errBuffer)); System.setErr(err); - logBuffer = new StringBuffer(); - fullLogBuffer = new StringBuffer(); + logBuffer = new StringBuilder(); + fullLogBuffer = new StringBuilder(); buildException = null; project.executeTarget(targetName); } finally { @@ -483,9 +483,9 @@ public abstract class BuildFileTest extends TestCase { * an output stream which saves stuff to our buffer. */ 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; } diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java b/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java index c3963cced7..fa9cc42442 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java @@ -71,7 +71,7 @@ public final class TestNpv extends TestCase { HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("IrrNpvTestCaseData.xls"); HSSFSheet sheet = wb.getSheet("IRR-NPV"); HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); - StringBuffer failures = new StringBuffer(); + StringBuilder failures = new StringBuilder(); int failureCount = 0; // 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)"