Browse Source

remove more uses of Character.toUpperCase

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1815988 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_4_0_0_FINAL
PJ Fanning 6 years ago
parent
commit
d0ddfa9402
1 changed files with 3 additions and 7 deletions
  1. 3
    7
      src/java/org/apache/poi/ss/format/CellDateFormatter.java

+ 3
- 7
src/java/org/apache/poi/ss/format/CellDateFormatter.java View File

@@ -181,7 +181,6 @@ public class CellDateFormatter extends CellFormatter {
boolean doneAm = false;
boolean doneMillis = false;

it.first();
for (char ch = it.first();
ch != CharacterIterator.DONE;
ch = it.next()) {
@@ -189,12 +188,9 @@ public class CellDateFormatter extends CellFormatter {
if (!doneMillis) {
Date dateObj = (Date) value;
int pos = toAppendTo.length();
Formatter formatter = new Formatter(toAppendTo, Locale.ROOT);
try {
try (Formatter formatter = new Formatter(toAppendTo, Locale.ROOT)) {
long msecs = dateObj.getTime() % 1000;
formatter.format(locale, sFmt, msecs / 1000.0);
} finally {
formatter.close();
}
toAppendTo.delete(pos, pos + 2);
doneMillis = true;
@@ -203,11 +199,11 @@ public class CellDateFormatter extends CellFormatter {
if (!doneAm) {
if (showAmPm) {
if (amPmUpper) {
toAppendTo.append(Character.toUpperCase(ch));
toAppendTo.append(Character.toString(ch).toUpperCase(LocaleUtil.getUserLocale()));
if (showM)
toAppendTo.append('M');
} else {
toAppendTo.append(Character.toLowerCase(ch));
toAppendTo.append(Character.toString(ch).toLowerCase(LocaleUtil.getUserLocale()));
if (showM)
toAppendTo.append('m');
}

Loading…
Cancel
Save