fix forbidden apis issues
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1719778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad89fdcaf5
commit
3e8b58e356
@ -46,7 +46,7 @@ public class ExcelGeneralNumberFormat extends Format {
|
|||||||
private final DecimalFormat scientificFormat;
|
private final DecimalFormat scientificFormat;
|
||||||
|
|
||||||
public ExcelGeneralNumberFormat(final Locale locale) {
|
public ExcelGeneralNumberFormat(final Locale locale) {
|
||||||
decimalSymbols = new DecimalFormatSymbols(locale);
|
decimalSymbols = DecimalFormatSymbols.getInstance(locale);
|
||||||
scientificFormat = new DecimalFormat("0.#####E0", decimalSymbols);
|
scientificFormat = new DecimalFormat("0.#####E0", decimalSymbols);
|
||||||
DataFormatter.setExcelStyleRoundingMode(scientificFormat);
|
DataFormatter.setExcelStyleRoundingMode(scientificFormat);
|
||||||
integerFormat = new DecimalFormat("#", decimalSymbols);
|
integerFormat = new DecimalFormat("#", decimalSymbols);
|
||||||
|
@ -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(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.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#<init>() @ use DecimalFormatSymbols.getInstance()
|
||||||
java.text.DecimalFormatSymbols#DecimalFormatSymbols(Locale) @ 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
|
# the following are taken from the Elasticsearch source at https://github.com/elastic/elasticsearch/tree/master/buildSrc/src/main/resources/forbidden
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.model.textproperties;
|
package org.apache.poi.hslf.model.textproperties;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition of a property of some text, or its paragraph. Defines
|
* 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
|
* 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
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) {
|
||||||
if (obj == null) return false;
|
return true;
|
||||||
if (getClass() != obj.getClass()) return false;
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
TextProp other = (TextProp) obj;
|
TextProp other = (TextProp) obj;
|
||||||
if (dataValue != other.dataValue) return false;
|
if (dataValue != other.dataValue) {
|
||||||
if (maskInHeader != other.maskInHeader) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (maskInHeader != other.maskInHeader) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (propName == null) {
|
if (propName == null) {
|
||||||
if (other.propName != null) return false;
|
if (other.propName != null) {
|
||||||
} else if (!propName.equals(other.propName)) return false;
|
return false;
|
||||||
if (sizeOfDataBlock != other.sizeOfDataBlock) return false;
|
}
|
||||||
|
} else if (!propName.equals(other.propName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (sizeOfDataBlock != other.sizeOfDataBlock) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +150,6 @@ public class TextProp implements Cloneable {
|
|||||||
case 2: len = 6; break;
|
case 2: len = 6; break;
|
||||||
default: len = 10; 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -290,7 +290,7 @@ public final class TestHSSFDataFormatter {
|
|||||||
HSSFCell cell = (HSSFCell) it.next();
|
HSSFCell cell = (HSSFCell) it.next();
|
||||||
log(formatter.formatCellValue(cell));
|
log(formatter.formatCellValue(cell));
|
||||||
// in some locales the the decimal delimiter is a comma, not a dot
|
// 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));
|
assertEquals("12345678" + decimalSeparator + "9", formatter.formatCellValue(cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ public final class TestHSSFDataFormatter {
|
|||||||
// now with a formula evaluator
|
// now with a formula evaluator
|
||||||
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
|
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
|
||||||
log(formatter.formatCellValue(cell, evaluator) + "\t\t\t (with evaluator)");
|
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));
|
assertEquals("24" + decimalSeparator + "50%", formatter.formatCellValue(cell,evaluator));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user