JDK 10 RFR of 8186157: (scanner) Modify java/util/Scanner/ScanTest.java to fail if Engilsh Locale unavailable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JDK 10 RFR of 8186157: (scanner) Modify java/util/Scanner/ScanTest.java to fail if Engilsh Locale unavailable

Brian Burkhalter-2
https://bugs.openjdk.java.net/browse/JDK-8186157

This change is intended to put a branch in the test which will fail if the English Locale is unavailable on the system with a view toward detecting a configuration problem as opposed to an actual test failure.

Thanks,

Brian

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -59,7 +59,14 @@
                 !"ja".equals(lang)) {
                 //Before we have resource to improve the test to be ready for
                 //arbitrary locale, force the default locale to be "English"
-                //for now.
+                //for now. First we check whether the "English" locale is
+                //available on the system as it could be absent due to varying
+                //configurations.
+                if (!Arrays.asList(Locale.getAvailableLocales())
+                    .contains(Locale.ENGLISH)) {
+                    throw new RuntimeException
+                       ("The \"English\" Locale is unavailable on this system");
+                }
                 Locale.setDefault(Locale.ENGLISH);
             }
             skipTest();

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDK 10 RFR of 8186157: (scanner) Modify java/util/Scanner/ScanTest.java to fail if Engilsh Locale unavailable

Brian Burkhalter-2
Subject: s/Engilsh/English/

On Aug 11, 2017, at 2:22 PM, Brian Burkhalter <[hidden email]> wrote:

> https://bugs.openjdk.java.net/browse/JDK-8186157
>
> This change is intended to put a branch in the test which will fail if the English Locale is unavailable on the system with a view toward detecting a configuration problem as opposed to an actual test failure.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JDK 10 RFR of 8186157: (scanner) Modify java/util/Scanner/ScanTest.java to fail if Engilsh Locale unavailable

Lance Andersen
+1

--

Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
[hidden email]

Sent from my iPhone

> On Aug 11, 2017, at 5:25 PM, Brian Burkhalter <[hidden email]> wrote:
>
> Subject: s/Engilsh/English/
>
>> On Aug 11, 2017, at 2:22 PM, Brian Burkhalter <[hidden email]> wrote:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8186157
>>
>> This change is intended to put a branch in the test which will fail if the English Locale is unavailable on the system with a view toward detecting a configuration problem as opposed to an actual test failure.
>
Loading...