aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/ss/usermodel/DataFormatter.java9
-rw-r--r--src/java/org/apache/poi/ss/usermodel/ExcelStyleDateFormatter.java13
-rw-r--r--src/java/org/apache/poi/ss/util/CellReference.java3
3 files changed, 16 insertions, 9 deletions
diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
index 766ded18fe..6cb9d4d71c 100644
--- a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
+++ b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
@@ -440,8 +440,8 @@ public class DataFormatter {
Matcher dateMatcher = daysAsText.matcher(formatStr);
if (dateMatcher.find()) {
- String match = dateMatcher.group(0);
- formatStr = dateMatcher.replaceAll(match.toUpperCase().replaceAll("D", "E"));
+ String match = dateMatcher.group(0).toUpperCase(Locale.ROOT).replaceAll("D", "E");
+ formatStr = dateMatcher.replaceAll(match);
}
// Convert excel date format to SimpleDateFormat.
@@ -903,8 +903,9 @@ public class DataFormatter {
/**
* @return a <tt>DecimalFormat</tt> with parseIntegerOnly set <code>true</code>
*/
- /* package */ static DecimalFormat createIntegerOnlyFormat(String fmt) {
- DecimalFormat result = new DecimalFormat(fmt);
+ private static DecimalFormat createIntegerOnlyFormat(String fmt) {
+ DecimalFormatSymbols dsf = DecimalFormatSymbols.getInstance(Locale.ROOT);
+ DecimalFormat result = new DecimalFormat(fmt, dsf);
result.setParseIntegerOnly(true);
return result;
}
diff --git a/src/java/org/apache/poi/ss/usermodel/ExcelStyleDateFormatter.java b/src/java/org/apache/poi/ss/usermodel/ExcelStyleDateFormatter.java
index 22c8b541ac..fd2b61da34 100644
--- a/src/java/org/apache/poi/ss/usermodel/ExcelStyleDateFormatter.java
+++ b/src/java/org/apache/poi/ss/usermodel/ExcelStyleDateFormatter.java
@@ -40,13 +40,18 @@ public class ExcelStyleDateFormatter extends SimpleDateFormat {
public static final char L_BRACKET_SYMBOL = '\ue016';
public static final char LL_BRACKET_SYMBOL = '\ue017';
- private DecimalFormat format1digit = new DecimalFormat("0");
- private DecimalFormat format2digits = new DecimalFormat("00");
+ private final DecimalFormat format1digit;
+ private final DecimalFormat format2digits;
- private DecimalFormat format3digit = new DecimalFormat("0");
- private DecimalFormat format4digits = new DecimalFormat("00");
+ private final DecimalFormat format3digit;
+ private final DecimalFormat format4digits;
{
+ DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(Locale.ROOT);
+ format1digit = new DecimalFormat("0", dfs);
+ format2digits = new DecimalFormat("00", dfs);
+ format3digit = new DecimalFormat("0", dfs);
+ format4digits = new DecimalFormat("00", dfs);
DataFormatter.setExcelStyleRoundingMode(format1digit, RoundingMode.DOWN);
DataFormatter.setExcelStyleRoundingMode(format2digits, RoundingMode.DOWN);
DataFormatter.setExcelStyleRoundingMode(format3digit);
diff --git a/src/java/org/apache/poi/ss/util/CellReference.java b/src/java/org/apache/poi/ss/util/CellReference.java
index e2c98d6ef0..b4fa2b3ce1 100644
--- a/src/java/org/apache/poi/ss/util/CellReference.java
+++ b/src/java/org/apache/poi/ss/util/CellReference.java
@@ -17,6 +17,7 @@
package org.apache.poi.ss.util;
+import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -86,7 +87,7 @@ public class CellReference {
* delimited and escaped as per normal syntax rules for formulas.
*/
public CellReference(String cellRef) {
- if(cellRef.toUpperCase().endsWith("#REF!")) {
+ if(cellRef.toUpperCase(Locale.ROOT).endsWith("#REF!")) {
throw new IllegalArgumentException("Cell reference invalid: " + cellRef);
}