You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/12/10 15:16:27 UTC
[Bug 62996] Unit tests fail in TestExcelStyleDateFormatter for
locale zh_CN (Zulu JDK)
https://bz.apache.org/bugzilla/show_bug.cgi?id=62996
--- Comment #1 from Axel Howind <ax...@dua3.com> ---
Created attachment 36318
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36318&action=edit
Fix for compilation on JDK 11 without tweaking locale properties
I have now tested with Zulu, Oracle's OpenJDK build and Oracle JDK. Test fails
with all three different JDKs in version 11.0.1. The exact version is actually
11.0.1+13 for all three JDKs.
The test code already accounts for different characters to be used in chinese.
It is done using this check:
/**
* Depending on the JRE version, the provider setting and the locale, a
different result
* is expected and selected via an index
*/
private int localeIndex(Locale locale) {
final String provider = System.getProperty("java.locale.providers");
return jreVersion < 12 ||
!locale.equals (Locale.CHINESE) ||
(provider != null && provider.startsWith("JRE"))
? 0 : 1;
}
I have also seen in the Jenkins
[logs](https://builds.apache.org/view/P/view/POI/job/POI-DSL-1.11/19/consoleFull)
that the locale providers are overridden:
-Djava.locale.providers=JRE,CLDR
Now consider the description of the
[LocaleServiceProvider](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/spi/LocaleServiceProvider.html):
> Java Runtime Environment provides the following four locale providers:
>
> "CLDR": A provider based on Unicode Consortium's CLDR Project.
> "COMPAT": represents the locale sensitive services that is compatible with the prior JDK releases up to JDK8 (same as JDK8's "JRE").
> "SPI": represents the locale sensitive services implementing the subclasses of this LocaleServiceProvider class.
> "HOST": A provider that reflects the user's custom settings in the underlying operating system. This provider may not be available, depending on the Java Runtime Environment implementation.
> "JRE": represents a synonym to "COMPAT". This name is deprecated and will be removed in the future release of JDK.
What happens is that the Jenkins build explicitly tells (by means of -D...) the
LocaleProvider to be consistent with prior Java versions (i.e. before JDK 8).
This patch should fix JDK 11 builds (and hopefully not break any others)
without setting `java.locale.providers`.
**Note:** Depending on current build options, the
`-Djava.locale.providers=...`has to be removed from the build.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org