aboutsummaryrefslogtreecommitdiffstats
path: root/poi/src
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2021-11-07 15:00:03 +0000
committerDominik Stadler <centic@apache.org>2021-11-07 15:00:03 +0000
commit761a78b49f37b9bc4d75468bf3d07e25d4800023 (patch)
treefea56b3dd912b57c52941f58c1e01322f2581634 /poi/src
parent92de062c21b7953c9381870e6b3b2074320ad5d3 (diff)
downloadpoi-761a78b49f37b9bc4d75468bf3d07e25d4800023.tar.gz
poi-761a78b49f37b9bc4d75468bf3d07e25d4800023.zip
Use append(char) instead of string where possible
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894814 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/record/SupBookRecord.java2
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java4
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java4
-rw-r--r--poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java4
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/CellEvaluationFrame.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java4
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/NameIdentifier.java4
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/SheetIdentifier.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/SheetRangeIdentifier.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/Averageifs.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java4
-rw-r--r--poi/src/test/java/org/apache/poi/hpsf/basic/TestMetaDataIPI.java10
14 files changed, 24 insertions, 24 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/record/SupBookRecord.java b/poi/src/main/java/org/apache/poi/hssf/record/SupBookRecord.java
index 8c79429e8c..0bb9814f35 100644
--- a/poi/src/main/java/org/apache/poi/hssf/record/SupBookRecord.java
+++ b/poi/src/main/java/org/apache/poi/hssf/record/SupBookRecord.java
@@ -228,7 +228,7 @@ public final class SupBookRecord extends StandardRecord {
case CH_ALT_STARTUP_DIR:
case CH_LIB_DIR:
LOG.atWarn().log("EXCEL.EXE path unknown - using this directory instead: .");
- sb.append(".").append(PATH_SEPERATOR);
+ sb.append('.').append(PATH_SEPERATOR);
break;
default:
sb.append(c);
diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
index a9e0ed0a79..9c989004b9 100644
--- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
+++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
@@ -1653,10 +1653,10 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
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.setNameDefinition(HSSFFormulaParser.parse(sb.toString(), this, FormulaType.NAMEDRANGE, sheetIndex));
diff --git a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
index 60487e1e8e..2c68c8d610 100644
--- a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
+++ b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
@@ -203,10 +203,10 @@ public class POIFSReader
sb.setLength(0);
int pathLength = path.length();
for (int k = 0; k < pathLength; k++) {
- sb.append("/").append(path.getComponent(k));
+ sb.append('/').append(path.getComponent(k));
}
byte[] data = IOUtils.toByteArray(istream);
- sb.append("/").append(event.getName()).append(": ").append(data.length).append(" bytes read");
+ sb.append('/').append(event.getName()).append(": ").append(data.length).append(" bytes read");
System.out.println(sb);
} catch (IOException ignored) {
}
diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java
index 7cfe6cc17c..7cbffa13a3 100644
--- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java
+++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java
@@ -415,10 +415,10 @@ public class CellFormatPart {
boolean special = type.isSpecial(ch.charAt(0));
if (special)
- sb.append("'");
+ sb.append('\'');
sb.append(ch);
if (special)
- sb.append("'");
+ sb.append('\'');
}
return sb.toString();
}
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/CellEvaluationFrame.java b/poi/src/main/java/org/apache/poi/ss/formula/CellEvaluationFrame.java
index 378aa589f7..45afa2eb8a 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/CellEvaluationFrame.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/CellEvaluationFrame.java
@@ -42,7 +42,7 @@ final class CellEvaluationFrame {
public String toString() {
StringBuilder sb = new StringBuilder(64);
sb.append(getClass().getName()).append(" [");
- sb.append("]");
+ sb.append(']');
return sb.toString();
}
/**
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java b/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
index 65ef78c205..1e2387b4ce 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
@@ -187,9 +187,9 @@ public final class CollaboratingWorkbooksEnvironment {
if (count++>0) {
sb.append(", ");
}
- sb.append("'").append(i.next()).append("'");
+ sb.append('\'').append(i.next()).append("'");
}
- sb.append(")");
+ sb.append(')');
}
throw new WorkbookNotFoundException(sb.toString());
}
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/NameIdentifier.java b/poi/src/main/java/org/apache/poi/ss/formula/NameIdentifier.java
index 4245afff18..5e007c9f39 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/NameIdentifier.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/NameIdentifier.java
@@ -36,11 +36,11 @@ public class NameIdentifier {
sb.append(getClass().getName());
sb.append(" [");
if (_isQuoted) {
- sb.append("'").append(_name).append("'");
+ sb.append('\'').append(_name).append("'");
} else {
sb.append(_name);
}
- sb.append("]");
+ sb.append(']');
return sb.toString();
}
} \ No newline at end of file
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/SheetIdentifier.java b/poi/src/main/java/org/apache/poi/ss/formula/SheetIdentifier.java
index 69f6f99501..fd8bc0618b 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/SheetIdentifier.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/SheetIdentifier.java
@@ -36,7 +36,7 @@ public class SheetIdentifier {
sb.append(" [").append(_sheetIdentifier.getName()).append("]");
}
if (_sheetIdentifier.isQuoted()) {
- sb.append("'").append(_sheetIdentifier.getName()).append("'");
+ sb.append('\'').append(_sheetIdentifier.getName()).append("'");
} else {
sb.append(_sheetIdentifier.getName());
}
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/SheetRangeIdentifier.java b/poi/src/main/java/org/apache/poi/ss/formula/SheetRangeIdentifier.java
index 88c91991b9..e29022c78c 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/SheetRangeIdentifier.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/SheetRangeIdentifier.java
@@ -34,7 +34,7 @@ public class SheetRangeIdentifier extends SheetIdentifier {
super.asFormulaString(sb);
sb.append(':');
if (_lastSheetIdentifier.isQuoted()) {
- sb.append("'").append(_lastSheetIdentifier.getName()).append("'");
+ sb.append('\'').append(_lastSheetIdentifier.getName()).append("'");
} else {
sb.append(_lastSheetIdentifier.getName());
}
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Averageifs.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Averageifs.java
index 6aa87b4101..8bed857202 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Averageifs.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Averageifs.java
@@ -67,7 +67,7 @@ public final class Averageifs extends Baseifs {
public void addValue(ValueEval value) {
if(!(value instanceof NumberEval)) return;
- double d = ((NumberEval) value).getNumberValue();;
+ double d = ((NumberEval) value).getNumberValue();
sum += d;
count++;
diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java b/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java
index af02fa954a..71efe9d0e4 100644
--- a/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java
+++ b/poi/src/main/java/org/apache/poi/ss/usermodel/FractionFormat.java
@@ -132,7 +132,7 @@ public class FractionFormat extends Format {
StringBuilder sb = new StringBuilder();
if (isNeg){
- sb.append("-");
+ sb.append('-');
}
sb.append(wholePart);
return sb.toString();
diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java b/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java
index 1aabd9efe2..4d4d8af62a 100644
--- a/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java
+++ b/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java
@@ -93,7 +93,7 @@ public class CellRangeAddress extends CellRangeAddressBase {
StringBuilder sb = new StringBuilder();
if (sheetName != null) {
sb.append(SheetNameFormatter.format(sheetName));
- sb.append("!");
+ sb.append('!');
}
CellReference cellRefFrom = new CellReference(getFirstRow(), getFirstColumn(),
useAbsoluteAddress, useAbsoluteAddress);
diff --git a/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java b/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java
index a06ee43fba..2c80e25f1c 100644
--- a/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java
+++ b/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java
@@ -247,9 +247,9 @@ final class NormalisedDecimal {
sb.append(ws.substring(1));
sb.append(' ');
sb.append(getFractionalDigits());
- sb.append("E");
+ sb.append('E');
sb.append(getDecimalExponent());
- sb.append("]");
+ sb.append(']');
return sb.toString();
}
}
diff --git a/poi/src/test/java/org/apache/poi/hpsf/basic/TestMetaDataIPI.java b/poi/src/test/java/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
index b5691200a6..0767691879 100644
--- a/poi/src/test/java/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
+++ b/poi/src/test/java/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
@@ -551,7 +551,7 @@ final class TestMetaDataIPI {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 10000; i++) {
sb.append(s);
- sb.append(" ");
+ sb.append(' ');
}
return sb.toString();
}
@@ -586,14 +586,14 @@ final class TestMetaDataIPI {
Random rand = new Random(0); // TODO - no Random - tests should be completely deterministic
for (int i = 0; i < 5; i++) {
sb.append(s);
- sb.append(" ");
+ sb.append(' ');
char j = (char) rand.nextInt(220);
j += 33;
- sb.append(">");
+ sb.append('>');
sb.append(Character.valueOf(j));
- sb.append("=");
+ sb.append('=');
sb.append(umlaute[rand.nextInt(umlaute.length)]);
- sb.append("<");
+ sb.append('<');
}
return sb;
}