8135114: sun/security/krb5/auto tests failed on machine with TR locale
authorakosarev
Wed, 06 Jul 2016 09:54:07 -0700
changeset 39484 3cf8b2fa2b9e
parent 39483 3a7e016ba204
child 39485 20e796053f68
8135114: sun/security/krb5/auto tests failed on machine with TR locale Reviewed-by: xuelei
jdk/test/sun/security/krb5/auto/KDC.java
jdk/test/sun/security/krb5/auto/NewSalt.java
jdk/test/sun/security/krb5/auto/OneKDC.java
jdk/test/sun/security/krb5/auto/SSL.java
jdk/test/sun/security/krb5/auto/SaslBasic.java
jdk/test/sun/security/krb5/auto/SaslGSS.java
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Wed Jul 06 17:10:36 2016 +0200
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Wed Jul 06 09:54:07 2016 -0700
@@ -246,7 +246,7 @@
      * @throws java.io.IOException for any socket creation error
      */
     public static KDC create(String realm) throws IOException {
-        return create(realm, "kdc." + realm.toLowerCase(), 0, true);
+        return create(realm, "kdc." + realm.toLowerCase(Locale.US), 0, true);
     }
 
     public static KDC existing(String realm, String kdc, int port) {
--- a/jdk/test/sun/security/krb5/auto/NewSalt.java	Wed Jul 06 17:10:36 2016 +0200
+++ b/jdk/test/sun/security/krb5/auto/NewSalt.java	Wed Jul 06 09:54:07 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -30,6 +30,7 @@
  * @run main/othervm -Donlyonepreauth NewSalt
  */
 
+import java.util.Locale;
 import sun.security.jgss.GSSUtil;
 import sun.security.krb5.Config;
 
@@ -51,9 +52,9 @@
         }
 
         // Use a different case of name. KDC will return correct salt
-        Context c1 = Context.fromUserPass(OneKDC.USER.toUpperCase(),
+        Context c1 = Context.fromUserPass(OneKDC.USER.toUpperCase(Locale.US),
                 OneKDC.PASS, true);
-        Context c2 = Context.fromUserPass(OneKDC.USER2.toUpperCase(),
+        Context c2 = Context.fromUserPass(OneKDC.USER2.toUpperCase(Locale.US),
                 OneKDC.PASS2, true);
 
         c1.startAsClient(OneKDC.USER2, GSSUtil.GSS_KRB5_MECH_OID);
--- a/jdk/test/sun/security/krb5/auto/OneKDC.java	Wed Jul 06 17:10:36 2016 +0200
+++ b/jdk/test/sun/security/krb5/auto/OneKDC.java	Wed Jul 06 09:54:07 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -25,6 +25,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.security.Security;
+import java.util.Locale;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.NameCallback;
@@ -52,9 +53,10 @@
     public static final String KTAB = "localkdc.ktab";
     public static final String JAAS_CONF = "localkdc-jaas.conf";
     public static final String REALM = "RABBIT.HOLE";
-    public static String SERVER = "server/host." + REALM.toLowerCase();
-    public static String BACKEND = "backend/host." + REALM.toLowerCase();
-    public static String KDCHOST = "kdc." + REALM.toLowerCase();
+    public static final String REALM_LOWER_CASE = REALM.toLowerCase(Locale.US);
+    public static String SERVER = "server/host." + REALM_LOWER_CASE;
+    public static String BACKEND = "backend/host." + REALM_LOWER_CASE;
+    public static String KDCHOST = "kdc." + REALM_LOWER_CASE;
     /**
      * Creates the KDC and starts it.
      * @param etype Encryption type, null if not specified
--- a/jdk/test/sun/security/krb5/auto/SSL.java	Wed Jul 06 17:10:36 2016 +0200
+++ b/jdk/test/sun/security/krb5/auto/SSL.java	Wed Jul 06 09:54:07 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -78,7 +78,8 @@
         ServicePermission p = (ServicePermission)perm;
         // ServicePermissions required to create GSSName are ignored
         if (!p.getActions().isEmpty()) {
-            permChecks = permChecks + p.getActions().toUpperCase().charAt(0);
+            permChecks = permChecks
+                + p.getActions().toUpperCase(Locale.US).charAt(0);
         }
     }
 
@@ -94,7 +95,7 @@
         System.setSecurityManager(new SSL());
 
         KDC kdc = KDC.create(OneKDC.REALM);
-        server = "host." + OneKDC.REALM.toLowerCase(Locale.US);
+        server = "host." + OneKDC.REALM_LOWER_CASE;
 
         if (args.length > 2) {
             sniHostname = "test." + server;
--- a/jdk/test/sun/security/krb5/auto/SaslBasic.java	Wed Jul 06 17:10:36 2016 +0200
+++ b/jdk/test/sun/security/krb5/auto/SaslBasic.java	Wed Jul 06 09:54:07 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -34,7 +34,6 @@
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Locale;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
@@ -46,7 +45,7 @@
     public static void main(String[] args) throws Exception {
 
         boolean bound = args[0].equals("bound");
-        String name = "host." + OneKDC.REALM.toLowerCase(Locale.US);
+        String name = "host." + OneKDC.REALM_LOWER_CASE;
 
         new OneKDC(null).writeJAASConf();
         System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
--- a/jdk/test/sun/security/krb5/auto/SaslGSS.java	Wed Jul 06 17:10:36 2016 +0200
+++ b/jdk/test/sun/security/krb5/auto/SaslGSS.java	Wed Jul 06 09:54:07 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -41,7 +41,6 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.HashMap;
-import java.util.Locale;
 import java.util.logging.ConsoleHandler;
 import java.util.logging.Handler;
 import java.util.logging.Level;
@@ -54,7 +53,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        String name = "host." + OneKDC.REALM.toLowerCase(Locale.US);
+        String name = "host." + OneKDC.REALM_LOWER_CASE;
 
         new OneKDC(null).writeJAASConf();
         System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");