aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ss/util
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/java/org/apache/poi/ss/util
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/java/org/apache/poi/ss/util')
-rw-r--r--src/java/org/apache/poi/ss/util/AreaReference.java14
-rw-r--r--src/java/org/apache/poi/ss/util/CellReference.java4
2 files changed, 11 insertions, 7 deletions
diff --git a/src/java/org/apache/poi/ss/util/AreaReference.java b/src/java/org/apache/poi/ss/util/AreaReference.java
index 7cf3b73c41..821413af11 100644
--- a/src/java/org/apache/poi/ss/util/AreaReference.java
+++ b/src/java/org/apache/poi/ss/util/AreaReference.java
@@ -295,8 +295,8 @@ public class AreaReference {
+ ":" +
CellReference.convertNumToColString(_lastCell.getCol());
}
-
- StringBuffer sb = new StringBuffer(32);
+
+ StringBuilder sb = new StringBuilder(32);
sb.append(_firstCell.formatAsString());
if(!_isSingleCell) {
sb.append(CELL_DELIMITER);
@@ -311,10 +311,14 @@ public class AreaReference {
}
public String toString() {
- StringBuffer sb = new StringBuffer(64);
+ StringBuilder sb = new StringBuilder(64);
sb.append(getClass().getName()).append(" [");
- sb.append(formatAsString());
- sb.append("]");
+ try {
+ sb.append(formatAsString());
+ } catch(Exception e) {
+ sb.append(e.toString());
+ }
+ sb.append(']');
return sb.toString();
}
diff --git a/src/java/org/apache/poi/ss/util/CellReference.java b/src/java/org/apache/poi/ss/util/CellReference.java
index b6be13936d..d14670221f 100644
--- a/src/java/org/apache/poi/ss/util/CellReference.java
+++ b/src/java/org/apache/poi/ss/util/CellReference.java
@@ -484,7 +484,7 @@ public class CellReference {
* @return the text representation of this cell reference as it would appear in a formula.
*/
public String formatAsString() {
- StringBuffer sb = new StringBuffer(32);
+ StringBuilder sb = new StringBuilder(32);
if(_sheetName != null) {
SheetNameFormatter.appendFormat(sb, _sheetName);
sb.append(SHEET_NAME_DELIMITER);
@@ -523,7 +523,7 @@ public class CellReference {
* Appends cell reference with '$' markers for absolute values as required.
* Sheet name is not included.
*/
- /* package */ void appendCellReference(StringBuffer sb) {
+ /* package */ void appendCellReference(StringBuilder sb) {
if (_colIndex != -1) {
if(_isColAbs) {
sb.append(ABSOLUTE_REFERENCE_MARKER);