# HG changeset patch # User bpb # Date 1502491484 25200 # Node ID d3385f62b9e85b65db40c1fab241f876fbd0c1ab # Parent b515ebc3db981dc2532f3d062d9a3db98c1a6ef2 8186157: (scanner) Modify java/util/Scanner/ScanTest.java to fail if Engilsh Locale unavailable Summary: Fail if the English locale is not available on the system Reviewed-by: lancea diff -r b515ebc3db98 -r d3385f62b9e8 jdk/test/java/util/Scanner/ScanTest.java --- a/jdk/test/java/util/Scanner/ScanTest.java Fri Aug 11 14:07:14 2017 -0700 +++ b/jdk/test/java/util/Scanner/ScanTest.java Fri Aug 11 15:44:44 2017 -0700 @@ -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();