summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native
diff options
context:
space:
mode:
authorFredrik Roubert <roubert@google.com>2015-03-10 22:45:06 +0100
committerFredrik Roubert <roubert@google.com>2015-03-11 19:09:37 +0100
commit4a308520182e7c87ef5a1fb0814a16638d8cd427 (patch)
tree72dc5e287a39bf987cd564cd275e4aceec80ef35 /luni/src/main/native
parent649f614e72e4e4cd378a1ec40688128334b5b1b4 (diff)
downloadlibcore-4a308520182e7c87ef5a1fb0814a16638d8cd427.zip
libcore-4a308520182e7c87ef5a1fb0814a16638d8cd427.tar.gz
libcore-4a308520182e7c87ef5a1fb0814a16638d8cd427.tar.bz2
Replace work-around with proper DecimalFormatSymbols helper function.
The helper function createWithLastResortData() was introduced in ICU 4.8 and eliminates the need to call the private default constructor: http://bugs.icu-project.org/trac/ticket/7392 Change-Id: I6d615b23c28c449442aeab6d37b7d92e844a7ae8
Diffstat (limited to 'luni/src/main/native')
-rw-r--r--luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp b/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
index 2811c37..8c4a411 100644
--- a/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
+++ b/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
@@ -62,7 +62,12 @@ static icu::DecimalFormatSymbols* makeDecimalFormatSymbols(JNIEnv* env,
ScopedJavaUnicodeString percent(env, percent0);
icu::UnicodeString groupingSeparator(groupingSeparator0);
- icu::DecimalFormatSymbols* result = new icu::DecimalFormatSymbols;
+ UErrorCode status = U_ZERO_ERROR;
+ std::unique_ptr<icu::DecimalFormatSymbols> result(icu::DecimalFormatSymbols::createWithLastResortData(status));
+ if (maybeThrowIcuException(env, "DecimalFormatSymbols::createWithLastResortData", status)) {
+ return NULL;
+ }
+
result->setSymbol(icu::DecimalFormatSymbols::kCurrencySymbol, currencySymbol.unicodeString());
result->setSymbol(icu::DecimalFormatSymbols::kDecimalSeparatorSymbol, icu::UnicodeString(decimalSeparator));
result->setSymbol(icu::DecimalFormatSymbols::kDigitSymbol, icu::UnicodeString(digit));
@@ -89,7 +94,7 @@ static icu::DecimalFormatSymbols* makeDecimalFormatSymbols(JNIEnv* env,
result->setSymbol(icu::DecimalFormatSymbols::kSevenDigitSymbol, icu::UnicodeString(zeroDigit + 7));
result->setSymbol(icu::DecimalFormatSymbols::kEightDigitSymbol, icu::UnicodeString(zeroDigit + 8));
result->setSymbol(icu::DecimalFormatSymbols::kNineDigitSymbol, icu::UnicodeString(zeroDigit + 9));
- return result;
+ return result.release();
}
static void NativeDecimalFormat_setDecimalFormatSymbols(JNIEnv* env, jclass, jlong addr,