mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8219890: Calendar.getDisplayName() returns empty string for new Japanese Era on some locales
Reviewed-by: lancea
This commit is contained in:
parent
29d842b5a0
commit
c12d6ac1a7
2 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1022,9 +1022,11 @@ class JapaneseImperialCalendar extends Calendar {
|
|||
|
||||
String name = CalendarDataUtility.retrieveFieldValueName(getCalendarType(), field,
|
||||
fieldValue, style, locale);
|
||||
// If the ERA value is null, then
|
||||
// If the ERA value is null or empty, then
|
||||
// try to get its name or abbreviation from the Era instance.
|
||||
if (name == null && field == ERA && fieldValue < eras.length) {
|
||||
if ((name == null || name.isEmpty()) &&
|
||||
field == ERA &&
|
||||
fieldValue < eras.length) {
|
||||
Era era = eras[fieldValue];
|
||||
name = (style == SHORT) ? era.getAbbreviation() : era.getName();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue