aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java2
-rw-r--r--src/resources/devtools/forbidden-signatures.txt4
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java36
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java4
4 files changed, 32 insertions, 14 deletions
diff --git a/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java b/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java
index 8b90d8589d..2efbb3ff03 100644
--- a/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java
+++ b/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java
@@ -46,7 +46,7 @@ public class ExcelGeneralNumberFormat extends Format {
private final DecimalFormat scientificFormat;
public ExcelGeneralNumberFormat(final Locale locale) {
- decimalSymbols = new DecimalFormatSymbols(locale);
+ decimalSymbols = DecimalFormatSymbols.getInstance(locale);
scientificFormat = new DecimalFormat("0.#####E0", decimalSymbols);
DataFormatter.setExcelStyleRoundingMode(scientificFormat);
integerFormat = new DecimalFormat("#", decimalSymbols);
diff --git a/src/resources/devtools/forbidden-signatures.txt b/src/resources/devtools/forbidden-signatures.txt
index 481c9b83f9..dabcb7691c 100644
--- a/src/resources/devtools/forbidden-signatures.txt
+++ b/src/resources/devtools/forbidden-signatures.txt
@@ -30,8 +30,8 @@ java.util.Date#toString() @ Do not use methods that depend on the current Local,
java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[], boolean) @ Reflection usage fails with SecurityManagers and likely will not work any more in Java 9
java.lang.reflect.AccessibleObject#setAccessible(boolean) @ Reflection usage fails with SecurityManagers and likely will not work any more in Java 9
-java.text.DecimalFormatSymbols#DecimalFormatSymbols() @ use DecimalFormatSymbols.getInstance()
-java.text.DecimalFormatSymbols#DecimalFormatSymbols(Locale) @ use DecimalFormatSymbols.getInstance()
+java.text.DecimalFormatSymbols#<init>() @ use DecimalFormatSymbols.getInstance()
+java.text.DecimalFormatSymbols#<init>(java.util.Locale) @ use DecimalFormatSymbols.getInstance()
# the following are taken from the Elasticsearch source at https://github.com/elastic/elasticsearch/tree/master/buildSrc/src/main/resources/forbidden
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
index e95cdfd29c..c6d1589d07 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
@@ -17,6 +17,8 @@
package org.apache.poi.hslf.model.textproperties;
+import java.util.Locale;
+
/**
* Definition of a property of some text, or its paragraph. Defines
* how to find out if it's present (via the mask on the paragraph or
@@ -111,16 +113,32 @@ public class TextProp implements Cloneable {
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
TextProp other = (TextProp) obj;
- if (dataValue != other.dataValue) return false;
- if (maskInHeader != other.maskInHeader) return false;
+ if (dataValue != other.dataValue) {
+ return false;
+ }
+ if (maskInHeader != other.maskInHeader) {
+ return false;
+ }
if (propName == null) {
- if (other.propName != null) return false;
- } else if (!propName.equals(other.propName)) return false;
- if (sizeOfDataBlock != other.sizeOfDataBlock) return false;
+ if (other.propName != null) {
+ return false;
+ }
+ } else if (!propName.equals(other.propName)) {
+ return false;
+ }
+ if (sizeOfDataBlock != other.sizeOfDataBlock) {
+ return false;
+ }
return true;
}
@@ -132,6 +150,6 @@ public class TextProp implements Cloneable {
case 2: len = 6; break;
default: len = 10; break;
}
- return String.format("%s = %d (%0#"+len+"X mask / %d bytes)", propName, dataValue, maskInHeader, sizeOfDataBlock);
+ return String.format(Locale.ROOT, "%s = %d (%0#"+len+"X mask / %d bytes)", propName, dataValue, maskInHeader, sizeOfDataBlock);
}
} \ No newline at end of file
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
index f42074e99d..7008524824 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
@@ -290,7 +290,7 @@ public final class TestHSSFDataFormatter {
HSSFCell cell = (HSSFCell) it.next();
log(formatter.formatCellValue(cell));
// in some locales the the decimal delimiter is a comma, not a dot
- char decimalSeparator = new DecimalFormatSymbols(LocaleUtil.getUserLocale()).getDecimalSeparator();
+ char decimalSeparator = DecimalFormatSymbols.getInstance(LocaleUtil.getUserLocale()).getDecimalSeparator();
assertEquals("12345678" + decimalSeparator + "9", formatter.formatCellValue(cell));
}
@@ -336,7 +336,7 @@ public final class TestHSSFDataFormatter {
// now with a formula evaluator
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
log(formatter.formatCellValue(cell, evaluator) + "\t\t\t (with evaluator)");
- char decimalSeparator = new DecimalFormatSymbols(LocaleUtil.getUserLocale()).getDecimalSeparator();
+ char decimalSeparator = DecimalFormatSymbols.getInstance(LocaleUtil.getUserLocale()).getDecimalSeparator();
assertEquals("24" + decimalSeparator + "50%", formatter.formatCellValue(cell,evaluator));
}