https://bz.apache.org/bugzilla/show_bug.cgi?id=60040
Bug ID: 60040
Summary: CellNumberFormatter wrong formating for Locale pt_BR
Product: POI
Version: 3.14-FINAL
Hardware: PC
OS: Linux
Status: NEW
Severity: major
Priority: P2
Component: SS Common
Assignee: [email protected]
Reporter: [email protected]
After the commit 91e6a646 by Andreas Beeker 2015-09-07 22:34:21, the Locale
used to formatting is not fixed to Locale.US anymore.
But on Locales where DecimalFormat symbols are different from US, like in
Brazil:
'.' => ',' and ',' => '.'
the code is formatting wrong, mainly because the code uses this symbols fixed
in char format like in this code:
private void writeFractional(StringBuffer result, StringBuffer output) {
int digit;
int strip;
ListIterator<Special> it;
if (fractionalSpecials.size() > 0) {
digit = result.indexOf(".") + 1; // <===== HERE
if (exponent != null)
strip = result.indexOf("e") - 1;
else
strip = result.length() - 1;
while (strip > digit && result.charAt(strip) == '0')
strip--;
it = fractionalSpecials.listIterator();
while (it.hasNext()) {
Special s = it.next();
char resultCh = result.charAt(digit);
if (resultCh != '0' || s.ch == '0' || digit < strip)
output.setCharAt(s.pos, resultCh);
else if (s.ch == '?') {
// This is when we're in trailing zeros, and the format is
'?'. We still strip out remaining '#'s later
output.setCharAt(s.pos, ' ');
}
digit++;
}
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]