aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2017-10-31 09:48:23 +0000
committerPJ Fanning <fanningpj@apache.org>2017-10-31 09:48:23 +0000
commitd6f261473df936372cf9cd48a9d0ace1cb897778 (patch)
tree5402c25fb346c2ab093da7e654333d5a71d9180a /src/ooxml/java/org/apache/poi
parentb3cb1211a47dad4b0d6287b0da62d6cdbe15e734 (diff)
downloadpoi-d6f261473df936372cf9cd48a9d0ace1cb897778.tar.gz
poi-d6f261473df936372cf9cd48a9d0ace1cb897778.zip
add test case for bug 61701 and use StringBuilder in more places
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1813863 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi')
-rw-r--r--src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java2
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java6
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java2
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java2
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java6
5 files changed, 9 insertions, 9 deletions
diff --git a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java b/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
index 954feb80ef..26b2cd84c2 100644
--- a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
+++ b/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
@@ -104,7 +104,7 @@ public abstract class POIXMLTextExtractor extends POITextExtractor {
super.close();
}
- protected void checkMaxTextSize(StringBuffer text, String string) {
+ protected void checkMaxTextSize(CharSequence text, String string) {
if(string == null) {
return;
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java b/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java
index bb095c78d5..81b93ab463 100644
--- a/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java
+++ b/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java
@@ -135,7 +135,7 @@ public class XSSFExcelExtractor extends POIXMLTextExtractor
formatter = new DataFormatter(locale);
}
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder(64);
for(Sheet sh : workbook) {
XSSFSheet sheet = (XSSFSheet) sh;
if(includeSheetNames) {
@@ -229,13 +229,13 @@ public class XSSFExcelExtractor extends POIXMLTextExtractor
return text.toString();
}
- private void handleStringCell(StringBuffer text, Cell cell) {
+ private void handleStringCell(StringBuilder text, Cell cell) {
String contents = cell.getRichStringCellValue().getString();
checkMaxTextSize(text, contents);
text.append(contents);
}
- private void handleNonStringCell(StringBuffer text, Cell cell, DataFormatter formatter) {
+ private void handleNonStringCell(StringBuilder text, Cell cell, DataFormatter formatter) {
CellType type = cell.getCellType();
if (type == CellType.FORMULA) {
type = cell.getCachedFormulaResultType();
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
index 711cd48945..c8d2f7674f 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
@@ -121,7 +121,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
{
return createCell(column, CellType.BLANK);
}
-
+
/**
* Use this to create new cells within the row and return it.
* <p>
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java
index 575b01c994..e56af69d9a 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java
@@ -283,7 +283,7 @@ public final class XSSFName implements Name {
* Get the sheets name which this named range is referenced to
*
* @return sheet name, which this named range referred to.
- * Empty string if the referenced sheet name weas not found.
+ * Empty string if the referenced sheet name was not found.
*/
public String getSheetName() {
if (_ctName.isSetLocalSheetId()) {
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index 67a82510de..1916ef50b7 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -1490,13 +1490,13 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
//short externSheetIndex = getWorkbook().checkExternSheet(sheetIndex);
//name.setExternSheetNumber(externSheetIndex);
String[] parts = COMMA_PATTERN.split(reference);
- StringBuffer sb = new StringBuffer(32);
+ StringBuilder sb = new StringBuilder(32);
for (int i = 0; i < parts.length; i++) {
if(i>0) {
- sb.append(",");
+ sb.append(',');
}
SheetNameFormatter.appendFormat(sb, getSheetName(sheetIndex));
- sb.append("!");
+ sb.append('!');
sb.append(parts[i]);
}
name.setRefersToFormula(sb.toString());