<i18n dev> 8028734: test/java/util/Locale/InternationalBAT.java changes does not restore the default TimeZone

Naoto Sato naoto.sato at oracle.com
Wed Nov 20 09:32:41 PST 2013


Looks good to me.

Naoto

On 13-11-20 上午9:08, Alan Bateman wrote:
>
> We have a number of test failures in agentvm mode that appear to be
> caused by tests changing the default TimeZone and not restoring it.
> These failures become very intermittently when running with concurrency
> as it is unpredictable as to the sequence of tests that a specific agent
> VM will execute from run to run.
>
> As part of tracking down these issues, I hacked on jtreg to error tests
> that complete with a different TimeZone that they were run with. This
> lead me to InternationalBAT.java which sets the TimeZone to GMT but
> doesn't restore it.
>
> I'd like to fix this test to restore the time zone, the proposed patch
> is attached.
>
> Thanks,
>
> -Alan.
>
>
> diff --git a/test/java/util/Locale/InternationalBAT.java
> b/test/java/util/Locale/InternationalBAT.java
> --- a/test/java/util/Locale/InternationalBAT.java
> +++ b/test/java/util/Locale/InternationalBAT.java
> @@ -39,11 +39,13 @@
>
> public static void main(String[] args) {
> boolean pass = true;
> - if (!testRequiredLocales()) {
> - pass = false;
> - }
> - if (!testRequiredEncodings()) {
> - pass = false;
> +
> + TimeZone tz = TimeZone.getDefault();
> + try {
> + pass &= testRequiredLocales();
> + pass &= testRequiredEncodings();
> + } finally {
> + TimeZone.setDefault(tz);
> }
>
> if (!pass) {


More information about the i18n-dev mailing list