< prev index next >

test/sun/util/locale/provider/Bug8038436.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -21,37 +21,39 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 8038436
+ * @bug 8038436 8158504
  * @summary Test for changes in 8038436
  * @modules java.base/sun.util.locale.provider
  *          java.base/sun.util.spi
  * @compile -XDignore.symbol.file Bug8038436.java
- * @run main/othervm Bug8038436 -Djava.ext.dirs=foo security
- * @run main/othervm Bug8038436 -Djava.locale.providers=JRE availlocs
+ * @run main/othervm  -limitmods java.base           Bug8038436  security
+ * @run main/othervm  -Djava.locale.providers=COMPAT Bug8038436  availlocs
  */
 
 import java.security.*;
-import java.text.*;
 import java.util.*;
 import java.util.stream.*;
 import sun.util.locale.provider.*;
 
 public class Bug8038436 {
     public static void main(String[] args) {
-        switch (args[1]) {
+                
+        switch (args[0]) {
+
         case "security":
             securityTests();
             break;
         case "availlocs":
             availableLocalesTests();
             break;
         default:
             throw new RuntimeException("no test was specified.");
         }
+                
     }
 
     private static void securityTests() {
         Policy.setPolicy(new MyPolicy());
         System.setSecurityManager(new SecurityManager());

@@ -65,16 +67,18 @@
         System.out.println(new Formatter(Locale.JAPAN).format("%1$tB %1$te, %1$tY",
                            new GregorianCalendar()));
 
         /*
          * Check only English/ROOT locales are returned if the jdk.localedata
-         * module is not installed (implied by "java.ext.dirs" set to "foo").
+         * module is not loaded (implied by "-limitmods java.base").
          */
-        if (Arrays.asList(Locale.getAvailableLocales())
-                .stream()
-                .anyMatch(l -> l != Locale.ROOT && l.getLanguage() != "en")) {
-            throw new RuntimeException("non English locale(s) included in available locales");
+       List<Locale> nonEnglishLocales= (Arrays.stream(Locale.getAvailableLocales())
+                .filter(l -> l != Locale.ROOT && l.getLanguage() != "en")
+                .collect(Collectors.toList()));
+       
+       if (nonEnglishLocales.size() > 0) {
+           throw new RuntimeException("non English locale(s)" + nonEnglishLocales +" included in available locales");
         }
     }
 
 
     static class MyPolicy extends Policy {
< prev index next >