Merge
authormichaelm
Tue, 30 Aug 2011 14:41:12 +0100
changeset 10418 1d57022fdb6e
parent 10417 947e9a7bf244 (current diff)
parent 10416 61d6ccadbfa2 (diff)
child 10419 12c063b39232
Merge
--- a/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java	Tue Aug 30 14:41:12 2011 +0100
@@ -25,6 +25,7 @@
 
 package com.sun.jndi.ldap;
 
+import java.util.Locale;
 import java.util.Arrays; // JDK 1.2
 import java.io.OutputStream;
 import javax.naming.ldap.Control;
@@ -71,7 +72,7 @@
     ClientId(int version, String hostname, int port, String protocol,
             Control[] bindCtls, OutputStream trace, String socketFactory) {
         this.version = version;
-        this.hostname = hostname.toLowerCase();  // ignore case
+        this.hostname = hostname.toLowerCase(Locale.ENGLISH);  // ignore case
         this.port = port;
         this.protocol = protocol;
         this.bindCtls = (bindCtls != null ? bindCtls.clone() : null);
@@ -83,13 +84,15 @@
         if ((socketFactory != null) &&
              !socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
             try {
-                Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
+                Class<?> socketFactoryClass =
+                        Obj.helper.loadClass(socketFactory);
                 Class<?> objClass = Class.forName("java.lang.Object");
                 this.sockComparator = socketFactoryClass.getMethod(
                                 "compare", new Class<?>[]{objClass, objClass});
-                Method getDefault =
-                    socketFactoryClass.getMethod("getDefault", new Class<?>[]{});
-                this.factory = (SocketFactory) getDefault.invoke(null, new Object[]{});
+                Method getDefault = socketFactoryClass.getMethod(
+                                            "getDefault", new Class<?>[]{});
+                this.factory =
+                        (SocketFactory)getDefault.invoke(null, new Object[]{});
             } catch (Exception e) {
                 // Ignore it here, the same exceptions are/will be handled by
                 // LdapPoolManager and Connection classes.
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java	Tue Aug 30 14:41:12 2011 +0100
@@ -26,6 +26,7 @@
 package com.sun.jndi.ldap;
 
 import java.io.*;
+import java.util.Locale;
 import java.util.Vector;
 import java.util.Hashtable;
 
@@ -738,14 +739,15 @@
         if (hasBinaryValues) {
             la.add(ber.parseOctetString(ber.peekByte(), len));
         } else {
-            la.add(ber.parseStringWithTag(Ber.ASN_SIMPLE_STRING, isLdapv3, len));
+            la.add(ber.parseStringWithTag(
+                                    Ber.ASN_SIMPLE_STRING, isLdapv3, len));
         }
         return len[0];
     }
 
     private boolean isBinaryValued(String attrid,
                                    Hashtable<String, Boolean> binaryAttrs) {
-        String id = attrid.toLowerCase();
+        String id = attrid.toLowerCase(Locale.ENGLISH);
 
         return ((id.indexOf(";binary") != -1) ||
             defaultBinaryAttrs.containsKey(id) ||
@@ -753,8 +755,8 @@
     }
 
     // package entry point; used by Connection
-    static void parseResult(BerDecoder replyBer, LdapResult res, boolean isLdapv3)
-        throws IOException {
+    static void parseResult(BerDecoder replyBer, LdapResult res,
+            boolean isLdapv3) throws IOException {
 
         res.status = replyBer.parseEnumeration();
         res.matchedDN = replyBer.parseString(isLdapv3);
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java	Tue Aug 30 14:41:12 2011 +0100
@@ -33,6 +33,7 @@
 import javax.naming.ldap.LdapName;
 import javax.naming.ldap.Rdn;
 
+import java.util.Locale;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.List;
@@ -2597,7 +2598,7 @@
         } else {
             binaryAttrs = new Hashtable<>(11, 0.75f);
             StringTokenizer tokens =
-                new StringTokenizer(attrIds.toLowerCase(), " ");
+                new StringTokenizer(attrIds.toLowerCase(Locale.ENGLISH), " ");
 
             while (tokens.hasMoreTokens()) {
                 binaryAttrs.put(tokens.nextToken(), Boolean.TRUE);
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java	Tue Aug 30 14:41:12 2011 +0100
@@ -28,6 +28,7 @@
 
 import java.util.Enumeration;
 import java.util.Vector;
+import java.util.Locale;
 
 import javax.naming.*;
 import javax.naming.directory.Attributes;
@@ -707,7 +708,7 @@
 
             TypeAndValue that = (TypeAndValue)obj;
 
-            int diff = type.toUpperCase().compareTo(that.type.toUpperCase());
+            int diff = type.compareToIgnoreCase(that.type);
             if (diff != 0) {
                 return diff;
             }
@@ -730,7 +731,7 @@
 
         public int hashCode() {
             // If two objects are equal, their hash codes must match.
-            return (type.toUpperCase().hashCode() +
+            return (type.toUpperCase(Locale.ENGLISH).hashCode() +
                     getValueComparable().hashCode());
         }
 
@@ -764,11 +765,12 @@
 
             // cache result
             if (binary) {
-                comparable = value.toUpperCase();
+                comparable = value.toUpperCase(Locale.ENGLISH);
             } else {
                 comparable = (String)unescapeValue(value);
                 if (!valueCaseSensitive) {
-                    comparable = comparable.toUpperCase(); // ignore case
+                    // ignore case
+                    comparable = comparable.toUpperCase(Locale.ENGLISH);
                 }
             }
             return comparable;
@@ -836,7 +838,7 @@
                 buf.append(Character.forDigit(0xF & b, 16));
             }
 
-            return (new String(buf)).toUpperCase();
+            return (new String(buf)).toUpperCase(Locale.ENGLISH);
         }
 
         /*
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Tue Aug 30 14:41:12 2011 +0100
@@ -28,6 +28,7 @@
 import java.io.PrintStream;
 import java.io.OutputStream;
 import java.util.Hashtable;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 import javax.naming.ldap.Control;
@@ -133,7 +134,7 @@
         String mech;
         int p;
         for (int i = 0; i < count; i++) {
-            mech = parser.nextToken().toLowerCase();
+            mech = parser.nextToken().toLowerCase(Locale.ENGLISH);
             if (mech.equals("anonymous")) {
                 mech = "none";
             }
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java	Tue Aug 30 14:41:12 2011 +0100
@@ -910,7 +910,7 @@
     public int hashCode() {
         if (hashValue == -1) {
 
-            String name = toString().toUpperCase();
+            String name = toString().toUpperCase(Locale.ENGLISH);
             int len = name.length();
             int off = 0;
             char val[] = new char[len];
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Tue Aug 30 14:41:12 2011 +0100
@@ -29,6 +29,7 @@
 import java.util.Enumeration;
 import java.util.StringTokenizer;
 import java.util.Vector;
+import java.util.Locale;
 
 /**
   * A class for parsing LDAP search filters (defined in RFC 1960, 2254)
@@ -395,19 +396,21 @@
 
             // do we need to begin with the first token?
             if(proto.charAt(0) != WILDCARD_TOKEN &&
-               !value.toString().toLowerCase().startsWith(
-                      subStrs.nextToken().toLowerCase())) {
-                if(debug) {System.out.println("faild initial test");}
+                    !value.toString().toLowerCase(Locale.ENGLISH).startsWith(
+                        subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
+                if(debug) {
+                    System.out.println("faild initial test");
+                }
                 return false;
             }
 
-
             while(subStrs.hasMoreTokens()) {
                 String currentStr = subStrs.nextToken();
                 if (debug) {System.out.println("looking for \"" +
                                                currentStr +"\"");}
-                currentPos = value.toLowerCase().indexOf(
-                       currentStr.toLowerCase(), currentPos);
+                currentPos = value.toLowerCase(Locale.ENGLISH).indexOf(
+                       currentStr.toLowerCase(Locale.ENGLISH), currentPos);
+
                 if(currentPos == -1) {
                     return false;
                 }
--- a/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	Tue Aug 30 14:41:12 2011 +0100
@@ -33,6 +33,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
 import java.util.Arrays;
+import java.util.Locale;
 import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;
 import javax.crypto.IllegalBlockSizeException;
@@ -410,7 +411,8 @@
 
     static byte[] getP1(char[] password) {
         try {
-            return new String(password).toUpperCase().getBytes("ISO8859_1");
+            return new String(password).toUpperCase(
+                                    Locale.ENGLISH).getBytes("ISO8859_1");
         } catch (UnsupportedEncodingException ex) {
             return null;
         }
--- a/jdk/src/share/classes/java/security/KeyRep.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/java/security/KeyRep.java	Tue Aug 30 14:41:12 2011 +0100
@@ -26,6 +26,7 @@
 package java.security;
 
 import java.io.*;
+import java.util.Locale;
 
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.security.spec.X509EncodedKeySpec;
@@ -137,7 +138,7 @@
 
         this.type = type;
         this.algorithm = algorithm;
-        this.format = format.toUpperCase();
+        this.format = format.toUpperCase(Locale.ENGLISH);
         this.encoded = encoded.clone();
     }
 
--- a/jdk/src/share/classes/java/security/Security.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/java/security/Security.java	Tue Aug 30 14:41:12 2011 +0100
@@ -1087,8 +1087,10 @@
             // Check the keys for each provider.
             for (Enumeration<Object> e = providers[i].keys();
                                                 e.hasMoreElements(); ) {
-                String currentKey = ((String)e.nextElement()).toUpperCase();
-                if (currentKey.startsWith(serviceName.toUpperCase())) {
+                String currentKey =
+                        ((String)e.nextElement()).toUpperCase(Locale.ENGLISH);
+                if (currentKey.startsWith(
+                        serviceName.toUpperCase(Locale.ENGLISH))) {
                     // We should skip the currentKey if it contains a
                     // whitespace. The reason is: such an entry in the
                     // provider property contains attributes for the
@@ -1096,7 +1098,8 @@
                     // in entries which lead to the implementation
                     // classes.
                     if (currentKey.indexOf(" ") < 0) {
-                        result.add(currentKey.substring(serviceName.length() + 1));
+                        result.add(currentKey.substring(
+                                                serviceName.length() + 1));
                     }
                 }
             }
--- a/jdk/src/share/classes/javax/naming/NameImpl.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/javax/naming/NameImpl.java	Tue Aug 30 14:41:12 2011 +0100
@@ -25,6 +25,7 @@
 
 package javax.naming;
 
+import java.util.Locale;
 import java.util.Vector;
 import java.util.Enumeration;
 import java.util.Properties;
@@ -216,7 +217,8 @@
     }
 
     private static boolean toBoolean(String name) {
-        return ((name != null) && name.toLowerCase().equals("true"));
+        return ((name != null) &&
+            name.toLowerCase(Locale.ENGLISH).equals("true"));
     }
 
     private final void recordNamingConvention(Properties p) {
@@ -526,11 +528,14 @@
                 comp1 = comp1.trim();
                 comp2 = comp2.trim();
             }
+
+            int local;
             if (syntaxCaseInsensitive) {
-                comp1 = comp1.toLowerCase();
-                comp2 = comp2.toLowerCase();
+                local = comp1.compareToIgnoreCase(comp2);
+            } else {
+                local = comp1.compareTo(comp2);
             }
-            int local = comp1.compareTo(comp2);
+
             if (local != 0) {
                 return local;
             }
@@ -696,7 +701,7 @@
                 comp = comp.trim();
             }
             if (syntaxCaseInsensitive) {
-                comp = comp.toLowerCase();
+                comp = comp.toLowerCase(Locale.ENGLISH);
             }
 
             hash += comp.hashCode();
--- a/jdk/src/share/classes/javax/naming/directory/BasicAttributes.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/javax/naming/directory/BasicAttributes.java	Tue Aug 30 14:41:12 2011 +0100
@@ -28,6 +28,7 @@
 
 import java.util.Hashtable;
 import java.util.Enumeration;
+import java.util.Locale;
 
 import javax.naming.NamingException;
 import javax.naming.NamingEnumeration;
@@ -160,7 +161,7 @@
 
     public Attribute get(String attrID) {
         Attribute attr = attrs.get(
-                ignoreCase ? attrID.toLowerCase() : attrID);
+                ignoreCase ? attrID.toLowerCase(Locale.ENGLISH) : attrID);
         return (attr);
     }
 
@@ -179,13 +180,13 @@
     public Attribute put(Attribute attr) {
         String id = attr.getID();
         if (ignoreCase) {
-            id = id.toLowerCase();
+            id = id.toLowerCase(Locale.ENGLISH);
         }
         return attrs.put(id, attr);
     }
 
     public Attribute remove(String attrID) {
-        String id = (ignoreCase ? attrID.toLowerCase() : attrID);
+        String id = (ignoreCase ? attrID.toLowerCase(Locale.ENGLISH) : attrID);
         return attrs.remove(id);
     }
 
--- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Tue Aug 30 14:41:12 2011 +0100
@@ -28,6 +28,7 @@
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.Collections;
 
 import javax.naming.InvalidNameException;
@@ -434,8 +435,7 @@
         }
 
         public int compareTo(RdnEntry that) {
-            int diff = type.toUpperCase().compareTo(
-                        that.type.toUpperCase());
+            int diff = type.compareToIgnoreCase(that.type);
             if (diff != 0) {
                 return diff;
             }
@@ -462,7 +462,7 @@
         }
 
         public int hashCode() {
-            return (type.toUpperCase().hashCode() +
+            return (type.toUpperCase(Locale.ENGLISH).hashCode() +
                 getValueComparable().hashCode());
         }
 
@@ -479,7 +479,7 @@
             if (value instanceof byte[]) {
                 comparable = escapeBinaryValue((byte[]) value);
             } else {
-                comparable = ((String) value).toUpperCase();
+                comparable = ((String) value).toUpperCase(Locale.ENGLISH);
             }
             return comparable;
         }
@@ -569,7 +569,6 @@
             builder.append(Character.forDigit(0xF & b, 16));
         }
         return builder.toString();
-        // return builder.toString().toUpperCase();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java	Tue Aug 30 14:41:12 2011 +0100
@@ -35,6 +35,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.security.Provider;
+import java.util.Locale;
 
 /**
  * Implements the GSSNameSpi for the krb5 mechanism.
@@ -184,7 +185,7 @@
             } catch (UnknownHostException e) {
                 // use hostname as it is
             }
-            hostName = hostName.toLowerCase();
+            hostName = hostName.toLowerCase(Locale.ENGLISH);
 
             temp = temp.append('/').append(hostName);
             return temp.toString();
--- a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java	Tue Aug 30 14:41:12 2011 +0100
@@ -35,6 +35,7 @@
 import sun.security.util.*;
 import java.net.*;
 import java.util.Vector;
+import java.util.Locale;
 import java.io.IOException;
 import java.math.BigInteger;
 import sun.security.krb5.internal.ccache.CCacheOutputStream;
@@ -389,14 +390,14 @@
                     // Looks if canonicalized is a longer format of hostName,
                     // we accept cases like
                     //     bunny -> bunny.rabbit.hole
-                    if (canonicalized.toLowerCase()
-                            .startsWith(hostName.toLowerCase()+".")) {
+                    if (canonicalized.toLowerCase(Locale.ENGLISH).startsWith(
+                                hostName.toLowerCase(Locale.ENGLISH)+".")) {
                         hostName = canonicalized;
                     }
                 } catch (UnknownHostException e) {
                     // no canonicalization, use old
                 }
-                nameParts[1] = hostName.toLowerCase();
+                nameParts[1] = hostName.toLowerCase(Locale.ENGLISH);
             }
             nameStrings = nameParts;
             nameType = type;
--- a/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Tue Aug 30 14:41:12 2011 +0100
@@ -219,7 +219,7 @@
     public Key engineGetKey(String alias, char[] password)
         throws NoSuchAlgorithmException, UnrecoverableKeyException
     {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         Key key = null;
 
         if (entry == null) {
@@ -296,7 +296,7 @@
      * <i>key entry</i> without a certificate chain).
      */
     public Certificate[] engineGetCertificateChain(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             if (entry.chain == null) {
                 return null;
@@ -324,7 +324,7 @@
      * does not contain a certificate.
      */
     public Certificate engineGetCertificate(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             if (entry.chain == null) {
                 return null;
@@ -345,7 +345,7 @@
      * not exist
      */
     public Date engineGetCreationDate(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             return new Date(entry.date.getTime());
         } else {
@@ -409,10 +409,10 @@
             // set the keyId to current date
             entry.keyId = ("Time " + (entry.date).getTime()).getBytes("UTF8");
             // set the alias
-            entry.alias = alias.toLowerCase();
+            entry.alias = alias.toLowerCase(Locale.ENGLISH);
 
             // add the entry
-            entries.put(alias.toLowerCase(), entry);
+            entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
         } catch (Exception nsae) {
             throw new KeyStoreException("Key protection " +
                        " algorithm not found: " + nsae, nsae);
@@ -465,7 +465,7 @@
             // Won't happen
         }
         // set the alias
-        entry.alias = alias.toLowerCase();
+        entry.alias = alias.toLowerCase(Locale.ENGLISH);
 
         entry.protectedPrivKey = key.clone();
         if (chain != null) {
@@ -473,7 +473,7 @@
         }
 
         // add the entry
-        entries.put(alias.toLowerCase(), entry);
+        entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
     }
 
 
@@ -618,7 +618,7 @@
     public synchronized void engineSetCertificateEntry(String alias,
         Certificate cert) throws KeyStoreException
     {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             throw new KeyStoreException("Cannot overwrite own certificate");
         } else
@@ -635,7 +635,7 @@
     public synchronized void engineDeleteEntry(String alias)
         throws KeyStoreException
     {
-        entries.remove(alias.toLowerCase());
+        entries.remove(alias.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -655,7 +655,7 @@
      * @return true if the alias exists, false otherwise
      */
     public boolean engineContainsAlias(String alias) {
-        return entries.containsKey(alias.toLowerCase());
+        return entries.containsKey(alias.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -675,7 +675,7 @@
      * <i>key entry</i>, false otherwise.
      */
     public boolean engineIsKeyEntry(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             return true;
         } else {
@@ -1274,7 +1274,8 @@
         if (password != null && s.available() > 0) {
            MacData macData = new MacData(s);
            try {
-                String algName = macData.getDigestAlgName().toUpperCase();
+                String algName =
+                        macData.getDigestAlgName().toUpperCase(Locale.ENGLISH);
                 if (algName.equals("SHA")  ||
                     algName.equals("SHA1") ||
                     algName.equals("SHA-1")) {
@@ -1479,7 +1480,7 @@
                 if (alias == null)
                    alias = getUnfriendlyName();
                 entry.alias = alias;
-                entries.put(alias.toLowerCase(), entry);
+                entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
             } else if (bagItem instanceof X509Certificate) {
                 X509Certificate cert = (X509Certificate)bagItem;
                 // Insert a localKeyID for the corresponding cert
--- a/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java	Tue Aug 30 14:41:12 2011 +0100
@@ -54,7 +54,7 @@
     // regular JKS
     public static final class JKS extends JavaKeyStore {
         String convertAlias(String alias) {
-            return alias.toLowerCase();
+            return alias.toLowerCase(Locale.ENGLISH);
         }
     }
 
--- a/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Tue Aug 30 14:41:12 2011 +0100
@@ -879,7 +879,8 @@
             if (hashCode == 0) {
                 int result = 17;
                 result = 37*result + getPort();
-                result = 37*result + getServerName().toLowerCase().hashCode();
+                result = 37*result +
+                    getServerName().toLowerCase(Locale.ENGLISH).hashCode();
                 hashCode = result;
             }
             return hashCode;
--- a/jdk/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java	Tue Aug 30 14:41:12 2011 +0100
@@ -33,6 +33,7 @@
 import java.util.Hashtable;
 import java.util.NoSuchElementException;
 import java.util.Vector;
+import java.util.Locale;
 
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSessionContext;
@@ -166,7 +167,8 @@
     }
 
     private String getKey(String hostname, int port) {
-        return (hostname + ":" + String.valueOf(port)).toLowerCase();
+        return (hostname + ":" +
+            String.valueOf(port)).toLowerCase(Locale.ENGLISH);
     }
 
     // cache a SSLSession
--- a/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	Tue Aug 30 14:41:12 2011 +0100
@@ -25,6 +25,8 @@
 
 package sun.security.tools;
 
+import java.util.Locale;
+
 /**
  * <p> This class provides several utilities to <code>KeyStore</code>.
  *
@@ -63,7 +65,7 @@
         } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
             return "Windows-ROOT";
         } else {
-            return storetype.toUpperCase();
+            return storetype.toUpperCase(Locale.ENGLISH);
         }
     }
 }
--- a/jdk/src/share/classes/sun/security/util/HostnameChecker.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/util/HostnameChecker.java	Tue Aug 30 14:41:12 2011 +0100
@@ -266,8 +266,8 @@
      */
     private static boolean matchAllWildcards(String name,
          String template) {
-        name = name.toLowerCase();
-        template = template.toLowerCase();
+        name = name.toLowerCase(Locale.ENGLISH);
+        template = template.toLowerCase(Locale.ENGLISH);
         StringTokenizer nameSt = new StringTokenizer(name, ".");
         StringTokenizer templateSt = new StringTokenizer(template, ".");
 
@@ -296,8 +296,8 @@
      */
     private static boolean matchLeftmostWildcard(String name,
                          String template) {
-        name = name.toLowerCase();
-        template = template.toLowerCase();
+        name = name.toLowerCase(Locale.ENGLISH);
+        template = template.toLowerCase(Locale.ENGLISH);
 
         // Retreive leftmost component
         int templateIdx = template.indexOf(".");
--- a/jdk/src/share/classes/sun/security/x509/AVA.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/x509/AVA.java	Tue Aug 30 14:41:12 2011 +0100
@@ -42,7 +42,7 @@
  * X.500 Attribute-Value-Assertion (AVA):  an attribute, as identified by
  * some attribute ID, has some particular value.  Values are as a rule ASN.1
  * printable strings.  A conventional set of type IDs is recognized when
- * parsing (and generating) RFC 1779 or RFC 2253 syntax strings.
+ * parsing (and generating) RFC 1779, 2253 or 4514 syntax strings.
  *
  * <P>AVAs are components of X.500 relative names.  Think of them as being
  * individual fields of a database record.  The attribute ID is how you
@@ -92,18 +92,20 @@
      * Leading and trailing spaces, also multiple internal spaces, also
      * call for quoting the whole string.
      */
-    private static final String specialChars = ",+=\n<>#;";
+    private static final String specialChars1779 = ",=\n+<>#;\\\"";
 
     /*
      * In RFC2253, if the value has any of these characters in it, it
      * must be quoted by a preceding \.
      */
-    private static final String specialChars2253 = ",+\"\\<>;";
+    private static final String specialChars2253 = ",=+<>#;\\\"";
 
     /*
-     * includes special chars from RFC1779 and RFC2253, as well as ' '
+     * includes special chars from RFC1779 and RFC2253, as well as ' ' from
+     * RFC 4514.
      */
-    private static final String specialCharsAll = ",=\n+<>#;\\\" ";
+    private static final String specialCharsDefault = ",=\n+<>#;\\\" ";
+    private static final String escapedDefault = ",+<>;\"";
 
     /*
      * Values that aren't printable strings are emitted as BER-encoded
@@ -120,26 +122,26 @@
     }
 
     /**
-     * Parse an RFC 1779 or RFC 2253 style AVA string:  CN=fee fie foe fum
+     * Parse an RFC 1779, 2253 or 4514 style AVA string:  CN=fee fie foe fum
      * or perhaps with quotes.  Not all defined AVA tags are supported;
      * of current note are X.400 related ones (PRMD, ADMD, etc).
      *
      * This terminates at unescaped AVA separators ("+") or RDN
-     * separators (",", ";"), or DN terminators (">"), and removes
-     * cosmetic whitespace at the end of values.
+     * separators (",", ";"), and removes cosmetic whitespace at the end of
+     * values.
      */
     AVA(Reader in) throws IOException {
         this(in, DEFAULT);
     }
 
     /**
-     * Parse an RFC 1779 or RFC 2253 style AVA string:  CN=fee fie foe fum
+     * Parse an RFC 1779, 2253 or 4514 style AVA string:  CN=fee fie foe fum
      * or perhaps with quotes. Additional keywords can be specified in the
      * keyword/OID map.
      *
      * This terminates at unescaped AVA separators ("+") or RDN
-     * separators (",", ";"), or DN terminators (">"), and removes
-     * cosmetic whitespace at the end of values.
+     * separators (",", ";"), and removes cosmetic whitespace at the end of
+     * values.
      */
     AVA(Reader in, Map<String, String> keywordMap) throws IOException {
         this(in, DEFAULT, keywordMap);
@@ -147,9 +149,6 @@
 
     /**
      * Parse an AVA string formatted according to format.
-     *
-     * XXX format RFC1779 should only allow RFC1779 syntax but is
-     * actually DEFAULT with RFC1779 keywords.
      */
     AVA(Reader in, int format) throws IOException {
         this(in, format, Collections.<String, String>emptyMap());
@@ -158,9 +157,6 @@
     /**
      * Parse an AVA string formatted according to format.
      *
-     * XXX format RFC1779 should only allow RFC1779 syntax but is
-     * actually DEFAULT with RFC1779 keywords.
-     *
      * @param in Reader containing AVA String
      * @param format parsing format
      * @param keywordMap a Map where a keyword String maps to a corresponding
@@ -168,11 +164,11 @@
      *   If an entry does not exist, it will fallback to the builtin
      *   keyword/OID mapping.
      * @throws IOException if the AVA String is not valid in the specified
-     *   standard or an OID String from the keywordMap is improperly formatted
+     *   format or an OID String from the keywordMap is improperly formatted
      */
     AVA(Reader in, int format, Map<String, String> keywordMap)
         throws IOException {
-        // assume format is one of DEFAULT, RFC1779, RFC2253
+        // assume format is one of DEFAULT or RFC2253
 
         StringBuilder   temp = new StringBuilder();
         int             c;
@@ -193,7 +189,7 @@
 
         /*
          * Now parse the value.  "#hex", a quoted string, or a string
-         * terminated by "+", ",", ";", ">".  Whitespace before or after
+         * terminated by "+", ",", ";".  Whitespace before or after
          * the value is stripped away unless format is RFC2253.
          */
         temp.setLength(0);
@@ -202,7 +198,7 @@
             c = in.read();
             if (c == ' ') {
                 throw new IOException("Incorrect AVA RFC2253 format - " +
-                                        "leading space must be escaped");
+                                      "leading space must be escaped");
             }
         } else {
             // read next character skipping whitespace
@@ -331,8 +327,7 @@
                     continue;
                 }
 
-                if (c != '\\' && c != '"' &&
-                    specialChars.indexOf((char)c) < 0) {
+                if (specialChars1779.indexOf((char)c) < 0) {
                     throw new IOException
                         ("Invalid escaped character in AVA: " +
                         (char)c);
@@ -386,7 +381,7 @@
     private DerValue parseString
         (Reader in, int c, int format, StringBuilder temp) throws IOException {
 
-        List<Byte> embeddedHex = new ArrayList<Byte>();
+        List<Byte> embeddedHex = new ArrayList<>();
         boolean isPrintableString = true;
         boolean escape = false;
         boolean leadingChar = true;
@@ -413,24 +408,19 @@
                 }
 
                 // check if character was improperly escaped
-                if ((format == DEFAULT &&
-                        specialCharsAll.indexOf((char)c) == -1) ||
-                    (format == RFC1779  &&
-                        specialChars.indexOf((char)c) == -1 &&
-                        c != '\\' && c != '\"')) {
-
+                if (format == DEFAULT &&
+                       specialCharsDefault.indexOf((char)c) == -1) {
                     throw new IOException
                         ("Invalid escaped character in AVA: '" +
                         (char)c + "'");
-
                 } else if (format == RFC2253) {
                     if (c == ' ') {
                         // only leading/trailing space can be escaped
                         if (!leadingChar && !trailingSpace(in)) {
-                                throw new IOException
-                                        ("Invalid escaped space character " +
-                                        "in AVA.  Only a leading or trailing " +
-                                        "space character can be escaped.");
+                            throw new IOException
+                                    ("Invalid escaped space character " +
+                                    "in AVA.  Only a leading or trailing " +
+                                    "space character can be escaped.");
                         }
                     } else if (c == '#') {
                         // only leading '#' can be escaped
@@ -443,18 +433,20 @@
                         throw new IOException
                                 ("Invalid escaped character in AVA: '" +
                                 (char)c + "'");
-
                     }
                 }
-
             } else {
                 // check if character should have been escaped
                 if (format == RFC2253) {
                     if (specialChars2253.indexOf((char)c) != -1) {
                         throw new IOException
                                 ("Character '" + (char)c +
-                                "' in AVA appears without escape");
+                                 "' in AVA appears without escape");
                     }
+                } else if (escapedDefault.indexOf((char)c) != -1) {
+                    throw new IOException
+                            ("Character '" + (char)c +
+                            "' in AVA appears without escape");
                 }
             }
 
@@ -551,7 +543,6 @@
         case ',':
             return true;
         case ';':
-        case '>':
             return format != RFC2253;
         default:
             return false;
@@ -1204,18 +1195,6 @@
      * Get an object identifier representing the specified keyword (or
      * string encoded object identifier) in the given standard.
      *
-     * @throws IOException If the keyword is not valid in the specified standard
-     */
-    static ObjectIdentifier getOID(String keyword, int standard)
-            throws IOException {
-        return getOID
-            (keyword, standard, Collections.<String, String>emptyMap());
-    }
-
-    /**
-     * Get an object identifier representing the specified keyword (or
-     * string encoded object identifier) in the given standard.
-     *
      * @param keywordMap a Map where a keyword String maps to a corresponding
      *   OID String. Each AVA keyword will be mapped to the corresponding OID.
      *   If an entry does not exist, it will fallback to the builtin
@@ -1249,19 +1228,11 @@
             return new ObjectIdentifier(oidString);
         }
 
-        // no keyword found or not standard compliant, check if OID string
+        // no keyword found, check if OID string
+        if (standard == AVA.DEFAULT && keyword.startsWith("OID.")) {
+            keyword = keyword.substring(4);
+        }
 
-        // RFC1779 requires, DEFAULT allows OID. prefix
-        if (standard == AVA.RFC1779) {
-            if (keyword.startsWith("OID.") == false) {
-                throw new IOException("Invalid RFC1779 keyword: " + keyword);
-            }
-            keyword = keyword.substring(4);
-        } else if (standard == AVA.DEFAULT) {
-            if (keyword.startsWith("OID.")) {
-                keyword = keyword.substring(4);
-            }
-        }
         boolean number = false;
         if (keyword.length() != 0) {
             char ch = keyword.charAt(0);
--- a/jdk/src/share/classes/sun/security/x509/DNSName.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/x509/DNSName.java	Tue Aug 30 14:41:12 2011 +0100
@@ -159,7 +159,7 @@
      * @return a hash code value for this object.
      */
     public int hashCode() {
-        return name.toUpperCase().hashCode();
+        return name.toUpperCase(Locale.ENGLISH).hashCode();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/x509/RFC822Name.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/x509/RFC822Name.java	Tue Aug 30 14:41:12 2011 +0100
@@ -153,7 +153,7 @@
      * @return a hash code value for this object.
      */
     public int hashCode() {
-        return name.toUpperCase().hashCode();
+        return name.toUpperCase(Locale.ENGLISH).hashCode();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/x509/X500Name.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/src/share/classes/sun/security/x509/X500Name.java	Tue Aug 30 14:41:12 2011 +0100
@@ -142,9 +142,9 @@
     /**
      * Constructs a name from a conventionally formatted string, such
      * as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
-     * (RFC 1779 or RFC 2253 style).
+     * (RFC 1779, 2253, or 4514 style).
      *
-     * @param DN X.500 Distinguished Name
+     * @param dname the X.500 Distinguished Name
      */
     public X500Name(String dname) throws IOException {
         this(dname, Collections.<String, String>emptyMap());
@@ -153,9 +153,9 @@
     /**
      * Constructs a name from a conventionally formatted string, such
      * as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
-     * (RFC 1779 or RFC 2253 style).
+     * (RFC 1779, 2253, or 4514 style).
      *
-     * @param DN X.500 Distinguished Name
+     * @param dname the X.500 Distinguished Name
      * @param keywordMap an additional keyword/OID map
      */
     public X500Name(String dname, Map<String, String> keywordMap)
@@ -167,10 +167,11 @@
      * Constructs a name from a string formatted according to format.
      * Currently, the formats DEFAULT and RFC2253 are supported.
      * DEFAULT is the default format used by the X500Name(String)
-     * constructor. RFC2253 is format strictly according to RFC2253
+     * constructor. RFC2253 is the format strictly according to RFC2253
      * without extensions.
      *
-     * @param DN X.500 Distinguished Name
+     * @param dname the X.500 Distinguished Name
+     * @param format the specified format of the String DN
      */
     public X500Name(String dname, String format) throws IOException {
         if (dname == null) {
@@ -865,8 +866,8 @@
      *     O="Sue, Grabbit and Runn" or
      *     O=Sue\, Grabbit and Runn
      *
-     * This method can parse 1779 or 2253 DNs and non-standard 3280 keywords.
-     * Additional keywords can be specified in the keyword/OID map.
+     * This method can parse RFC 1779, 2253 or 4514 DNs and non-standard 3280
+     * keywords. Additional keywords can be specified in the keyword/OID map.
      */
     private void parseDN(String input, Map<String, String> keywordMap)
         throws IOException {
@@ -875,7 +876,7 @@
             return;
         }
 
-        List<RDN> dnVector = new ArrayList<RDN>();
+        List<RDN> dnVector = new ArrayList<>();
         int dnOffset = 0;
         int rdnEnd;
         String rdnString;
@@ -945,52 +946,51 @@
         if (dnString.length() == 0) {
             names = new RDN[0];
             return;
-        }
-
-        List<RDN> dnVector = new ArrayList<RDN>();
-        int dnOffset = 0;
-        String rdnString;
+         }
 
-        int searchOffset = 0;
-        int rdnEnd = dnString.indexOf(',');
-        while (rdnEnd >=0) {
-            /*
-             * We have encountered an RDN delimiter (comma).
-             * If the comma in the RDN under consideration is
-             * preceded by a backslash (escape), it
-             * is part of the RDN. Otherwise, it is used as a separator, to
-             * delimit the RDN under consideration from any subsequent RDNs.
-             */
-            if (rdnEnd > 0 && !escaped(rdnEnd, searchOffset, dnString)) {
+         List<RDN> dnVector = new ArrayList<>();
+         int dnOffset = 0;
+         String rdnString;
+         int searchOffset = 0;
+         int rdnEnd = dnString.indexOf(',');
+         while (rdnEnd >=0) {
+             /*
+              * We have encountered an RDN delimiter (comma).
+              * If the comma in the RDN under consideration is
+              * preceded by a backslash (escape), it
+              * is part of the RDN. Otherwise, it is used as a separator, to
+              * delimit the RDN under consideration from any subsequent RDNs.
+              */
+             if (rdnEnd > 0 && !escaped(rdnEnd, searchOffset, dnString)) {
 
-                /*
-                 * Comma is a separator
-                 */
-                rdnString = dnString.substring(dnOffset, rdnEnd);
+                 /*
+                  * Comma is a separator
+                  */
+                 rdnString = dnString.substring(dnOffset, rdnEnd);
 
-                // Parse RDN, and store it in vector
-                RDN rdn = new RDN(rdnString, "RFC2253");
-                dnVector.add(rdn);
+                 // Parse RDN, and store it in vector
+                 RDN rdn = new RDN(rdnString, "RFC2253");
+                 dnVector.add(rdn);
 
-                // Increase the offset
-                dnOffset = rdnEnd + 1;
-            }
+                 // Increase the offset
+                 dnOffset = rdnEnd + 1;
+             }
 
-            searchOffset = rdnEnd + 1;
-            rdnEnd = dnString.indexOf(',', searchOffset);
-        }
+             searchOffset = rdnEnd + 1;
+             rdnEnd = dnString.indexOf(',', searchOffset);
+         }
 
-        // Parse last or only RDN, and store it in vector
-        rdnString = dnString.substring(dnOffset);
-        RDN rdn = new RDN(rdnString, "RFC2253");
-        dnVector.add(rdn);
+         // Parse last or only RDN, and store it in vector
+         rdnString = dnString.substring(dnOffset);
+         RDN rdn = new RDN(rdnString, "RFC2253");
+         dnVector.add(rdn);
 
-        /*
-         * Store the vector elements as an array of RDNs
-         * NOTE: It's only on output that little-endian ordering is used.
-         */
-        Collections.reverse(dnVector);
-        names = dnVector.toArray(new RDN[dnVector.size()]);
+         /*
+          * Store the vector elements as an array of RDNs
+          * NOTE: It's only on output that little-endian ordering is used.
+          */
+         Collections.reverse(dnVector);
+         names = dnVector.toArray(new RDN[dnVector.size()]);
     }
 
     /*
--- a/jdk/test/Makefile	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/test/Makefile	Tue Aug 30 14:41:12 2011 +0100
@@ -535,7 +535,7 @@
 # Stable othervm testruns (minus items from PROBLEM_LIST)
 #   Using samevm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_security2
-jdk_security2: $(call TestDirs, javax/crypto com/sun/crypto)
+jdk_security2: $(call TestDirs, javax/crypto javax/xml/crypto com/sun/crypto)
 	$(call RunSamevmBatch)
 
 # Stable othervm testruns (minus items from PROBLEM_LIST)
--- a/jdk/test/javax/naming/ldap/LdapName/CompareToEqualsTests.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/test/javax/naming/ldap/LdapName/CompareToEqualsTests.java	Tue Aug 30 14:41:12 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -23,12 +23,14 @@
 
 /*
  * @test
- * @bug 4635618
+ * @bug 4635618 7059542
  * @summary Support for manipulating LDAP Names
+ *          JNDI name operations should be locale independent
  */
 
 import javax.naming.ldap.*;
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.List;
 import javax.naming.InvalidNameException;
 
@@ -39,52 +41,61 @@
 
     public static void main(String args[])
                 throws Exception {
-
-        /**
-         * Test cases:
-         * 1) Same RDNs.
-         * 2) same RDN sequence with an AVA ordered differently.
-         * 3) RDN sequences of a differing AVA.
-         * 4) RDN sequence of different length.
-         * 5) RDN sequence of different Case.
-         * 6) Matching binary return values.
-         * 7) Binary values that don't match.
-         */
-        String names1[] = new String [] {
+         Locale reservedLocale = Locale.getDefault();
+         try {
+            /**
+             * Test cases:
+             * 1) Same RDNs.
+             * 2) same RDN sequence with an AVA ordered differently.
+             * 3) RDN sequences of a differing AVA.
+             * 4) RDN sequence of different length.
+             * 5) RDN sequence of different Case.
+             * 6) Matching binary return values.
+             * 7) Binary values that don't match.
+             */
+            String names1[] = new String [] {
                 "ou=Sales+cn=Bob", "ou=Sales+cn=Bob", "ou=Sales+cn=Bob",
                 "ou=Sales+cn=Scott+c=US", "cn=config"};
 
-        String names2[] = new String [] {
+            String names2[] = new String [] {
                 "ou=Sales+cn=Bob", "cn=Bob+ou=Sales", "ou=Sales+cn=Scott",
                 "ou=Sales+cn=Scott", "Cn=COnFIG"};
 
-        int expectedResults[] = {0, 0, -1, -1, 0};
-
+            int expectedResults[] = {0, 0, -1, -1, 0};
 
-        for (int i = 0; i < names1.length; i++) {
-            checkResults(new LdapName(names1[i]),
+            for (Locale locale : Locale.getAvailableLocales()) {
+                // reset the default locale
+                Locale.setDefault(locale);
+
+                for (int i = 0; i < names1.length; i++) {
+                    checkResults(new LdapName(names1[i]),
                         new LdapName(names2[i]), expectedResults[i]);
-        }
+                }
 
-        byte[] value = "abcxyz".getBytes();
-        Rdn rdn1 = new Rdn("binary", value);
-        ArrayList rdns1 = new ArrayList();
-        rdns1.add(rdn1);
-        LdapName l1 = new LdapName(rdns1);
+                byte[] value = "abcxyz".getBytes();
+                Rdn rdn1 = new Rdn("binary", value);
+                ArrayList rdns1 = new ArrayList();
+                rdns1.add(rdn1);
+                LdapName l1 = new LdapName(rdns1);
 
-        Rdn rdn2 = new Rdn("binary", value);
-        ArrayList rdns2 = new ArrayList();
-        rdns2.add(rdn2);
-        LdapName l2 = new LdapName(rdns2);
-        checkResults(l1, l2, 0);
+                Rdn rdn2 = new Rdn("binary", value);
+                ArrayList rdns2 = new ArrayList();
+                rdns2.add(rdn2);
+                LdapName l2 = new LdapName(rdns2);
+                checkResults(l1, l2, 0);
+
+                l2 = new LdapName("binary=#61626378797A");
+                checkResults(l1, l2, 0);
 
-        l2 = new LdapName("binary=#61626378797A");
-        checkResults(l1, l2, 0);
+                l2 = new LdapName("binary=#61626378797B");
+                checkResults(l1, l2, -1);
 
-        l2 = new LdapName("binary=#61626378797B");
-        checkResults(l1, l2, -1);
-
-        System.out.println("Tests passed");
+                System.out.println("Tests passed");
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/x500/X500Principal/Parse.java	Tue Aug 30 14:41:12 2011 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7024771
+ * @summary various X500Principal DN parsing tests
+ */
+
+import javax.security.auth.x500.X500Principal;
+
+public class Parse {
+
+    private static TestCase[] testCases = {
+        new TestCase("CN=prefix\\<>suffix", false)
+    };
+
+    public static void main(String args[]) throws Exception {
+        for (int i = 0; i < testCases.length; i++) {
+            testCases[i].run();
+        }
+        System.out.println("Test completed ok.");
+    }
+}
+
+class TestCase {
+
+     private String name;
+     private boolean expectedResult;
+
+     TestCase(String name, boolean expectedResult) {
+         this.name = name;
+         this.expectedResult = expectedResult;
+     }
+
+     void run() throws Exception {
+         Exception f = null;
+         try {
+             System.out.println("Parsing: \"" + name + "\"");
+             new X500Principal(name);
+             if (expectedResult == false) {
+                 f = new Exception("Successfully parsed invalid name");
+             }
+         } catch (IllegalArgumentException e) {
+             if (expectedResult == true) {
+                 throw e;
+             }
+         }
+         if (f != null) {
+             throw f;
+         }
+     }
+}
--- a/jdk/test/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java	Tue Aug 30 14:40:05 2011 +0100
+++ b/jdk/test/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java	Tue Aug 30 14:41:12 2011 +0100
@@ -26,6 +26,7 @@
  * @bug 6436919 6460930
  * @summary check that XML Signatures can be generated and validated with
  *  SecurityManager enabled and default policy
+ * @run main/othervm XMLDSigWithSecMgr
  * @author Sean Mullan
  */
 import java.io.*;