Merge "javax.security: update classes in javax.security.auth.x500"
diff --git a/ojluni/src/main/java/javax/security/auth/x500/X500Principal.java b/ojluni/src/main/java/javax/security/auth/x500/X500Principal.java
index 5636856..77292b0 100644
--- a/ojluni/src/main/java/javax/security/auth/x500/X500Principal.java
+++ b/ojluni/src/main/java/javax/security/auth/x500/X500Principal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -33,8 +33,8 @@
import sun.security.util.*;
/**
- * <p> This class represents an X.500 <code>Principal</code>.
- * <code>X500Principal</code>s are represented by distinguished names such as
+ * <p> This class represents an X.500 {@code Principal}.
+ * {@code X500Principal}s are represented by distinguished names such as
* "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US".
*
* <p> This class can be instantiated by using a string representation
@@ -50,12 +50,12 @@
* <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280: Internet X.509
* Public Key Infrastructure Certificate and CRL Profile</a>.
*
- * <p> The string representation for this <code>X500Principal</code>
- * can be obtained by calling the <code>getName</code> methods.
+ * <p> The string representation for this {@code X500Principal}
+ * can be obtained by calling the {@code getName} methods.
*
- * <p> Note that the <code>getSubjectX500Principal</code> and
- * <code>getIssuerX500Principal</code> methods of
- * <code>X509Certificate</code> return X500Principals representing the
+ * <p> Note that the {@code getSubjectX500Principal} and
+ * {@code getIssuerX500Principal} methods of
+ * {@code X509Certificate} return X500Principals representing the
* issuer and subject fields of the certificate.
*
* @see java.security.cert.X509Certificate
@@ -97,7 +97,7 @@
}
/**
- * Creates an <code>X500Principal</code> from a string representation of
+ * Creates an {@code X500Principal} from a string representation of
* an X.500 distinguished name (ex:
* "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US").
* The distinguished name must be specified using the grammar defined in
@@ -107,22 +107,29 @@
* defined in RFC 1779 and RFC 2253
* (and listed in {@link #getName(String format) getName(String format)}),
* as well as the T, DNQ or DNQUALIFIER, SURNAME, GIVENNAME, INITIALS,
- * GENERATION, EMAILADDRESS, and SERIALNUMBER keywords whose OIDs are
- * defined in RFC 3280 and its successor.
+ * GENERATION, EMAILADDRESS, and SERIALNUMBER keywords whose Object
+ * Identifiers (OIDs) are defined in RFC 3280 and its successor.
* Any other attribute type must be specified as an OID.
*
+ * <p>This implementation enforces a more restrictive OID syntax than
+ * defined in RFC 1779 and 2253. It uses the more correct syntax defined in
+ * <a href="http://www.ietf.org/rfc/rfc4512.txt">RFC 4512</a>, which
+ * specifies that OIDs contain at least 2 digits:
+ *
+ * <p>{@code numericoid = number 1*( DOT number ) }
+ *
* @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
- * @exception NullPointerException if the <code>name</code>
- * is <code>null</code>
- * @exception IllegalArgumentException if the <code>name</code>
+ * @exception NullPointerException if the {@code name}
+ * is {@code null}
+ * @exception IllegalArgumentException if the {@code name}
* is improperly specified
*/
public X500Principal(String name) {
- this(name, (Map<String, String>) Collections.EMPTY_MAP);
+ this(name, Collections.<String, String>emptyMap());
}
/**
- * Creates an <code>X500Principal</code> from a string representation of
+ * Creates an {@code X500Principal} from a string representation of
* an X.500 distinguished name (ex:
* "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US").
* The distinguished name must be specified using the grammar defined in
@@ -130,24 +137,31 @@
*
* <p> This constructor recognizes the attribute type keywords specified
* in {@link #X500Principal(String)} and also recognizes additional
- * keywords that have entries in the <code>keywordMap</code> parameter.
+ * keywords that have entries in the {@code keywordMap} parameter.
* Keyword entries in the keywordMap take precedence over the default
- * keywords recognized by <code>X500Principal(String)</code>. Keywords
+ * keywords recognized by {@code X500Principal(String)}. Keywords
* MUST be specified in all upper-case, otherwise they will be ignored.
* Improperly specified keywords are ignored; however if a keyword in the
- * name maps to an improperly specified OID, an
- * <code>IllegalArgumentException</code> is thrown. It is permissible to
+ * name maps to an improperly specified Object Identifier (OID), an
+ * {@code IllegalArgumentException} is thrown. It is permissible to
* have 2 different keywords that map to the same OID.
*
+ * <p>This implementation enforces a more restrictive OID syntax than
+ * defined in RFC 1779 and 2253. It uses the more correct syntax defined in
+ * <a href="http://www.ietf.org/rfc/rfc4512.txt">RFC 4512</a>, which
+ * specifies that OIDs contain at least 2 digits:
+ *
+ * <p>{@code numericoid = number 1*( DOT number ) }
+ *
* @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
* @param keywordMap an attribute type keyword map, where each key is a
* keyword String that maps to a corresponding object identifier in String
* form (a sequence of nonnegative integers separated by periods). The map
- * may be empty but never <code>null</code>.
- * @exception NullPointerException if <code>name</code> or
- * <code>keywordMap</code> is <code>null</code>
- * @exception IllegalArgumentException if the <code>name</code> is
- * improperly specified or a keyword in the <code>name</code> maps to an
+ * may be empty but never {@code null}.
+ * @exception NullPointerException if {@code name} or
+ * {@code keywordMap} is {@code null}
+ * @exception IllegalArgumentException if the {@code name} is
+ * improperly specified or a keyword in the {@code name} maps to an
* OID that is not in the correct form
* @since 1.6
*/
@@ -174,10 +188,10 @@
}
/**
- * Creates an <code>X500Principal</code> from a distinguished name in
+ * Creates an {@code X500Principal} from a distinguished name in
* ASN.1 DER encoded form. The ASN.1 notation for this structure is as
* follows.
- * <pre><code>
+ * <pre>{@code
* Name ::= CHOICE {
* RDNSequence }
*
@@ -200,7 +214,7 @@
* universalString UniversalString (SIZE (1..MAX)),
* utf8String UTF8String (SIZE (1.. MAX)),
* bmpString BMPString (SIZE (1..MAX)) }
- * </code></pre>
+ * }</pre>
*
* @param name a byte array containing the distinguished name in ASN.1
* DER encoded form
@@ -219,7 +233,7 @@
}
/**
- * Creates an <code>X500Principal</code> from an <code>InputStream</code>
+ * Creates an {@code X500Principal} from an {@code InputStream}
* containing the distinguished name in ASN.1 DER encoded form.
* The ASN.1 notation for this structure is supplied in the
* documentation for
@@ -228,11 +242,11 @@
* <p> The read position of the input stream is positioned
* to the next available byte after the encoded distinguished name.
*
- * @param is an <code>InputStream</code> containing the distinguished
+ * @param is an {@code InputStream} containing the distinguished
* name in ASN.1 DER encoded form
*
- * @exception NullPointerException if the <code>InputStream</code>
- * is <code>null</code>
+ * @exception NullPointerException if the {@code InputStream}
+ * is {@code null}
* @exception IllegalArgumentException if an encoding error occurs
* (incorrect form for DN)
*/
@@ -270,9 +284,9 @@
* the format defined in RFC 2253.
*
* <p>This method is equivalent to calling
- * <code>getName(X500Principal.RFC2253)</code>.
+ * {@code getName(X500Principal.RFC2253)}.
*
- * @return the distinguished name of this <code>X500Principal</code>
+ * @return the distinguished name of this {@code X500Principal}
*/
public String getName() {
return getName(X500Principal.RFC2253);
@@ -300,7 +314,7 @@
* this method returns an RFC 2253 conformant string representation
* with the following additional canonicalizations:
*
- * <p><ol>
+ * <ol>
* <li> Leading zeros are removed from attribute types
* that are encoded as dotted decimal OIDs
* <li> DirectoryString attribute values of type
@@ -324,9 +338,9 @@
* those which section 2.4 of RFC 2253 states must be escaped
* (they are escaped using a preceding backslash character)
* <li> The entire name is converted to upper case
- * using <code>String.toUpperCase(Locale.US)</code>
+ * using {@code String.toUpperCase(Locale.US)}
* <li> The entire name is converted to lower case
- * using <code>String.toLowerCase(Locale.US)</code>
+ * using {@code String.toLowerCase(Locale.US)}
* <li> The name is finally normalized using normalization form KD,
* as described in the Unicode Standard and UAX #15
* </ol>
@@ -335,7 +349,7 @@
*
* @param format the format to use
*
- * @return a string representation of this <code>X500Principal</code>
+ * @return a string representation of this {@code X500Principal}
* using the specified format
* @throws IllegalArgumentException if the specified format is invalid
* or null
@@ -357,16 +371,16 @@
* Returns a string representation of the X.500 distinguished name
* using the specified format. Valid values for the format are
* "RFC1779" and "RFC2253" (case insensitive). "CANONICAL" is not
- * permitted and an <code>IllegalArgumentException</code> will be thrown.
+ * permitted and an {@code IllegalArgumentException} will be thrown.
*
* <p>This method returns Strings in the format as specified in
* {@link #getName(String)} and also emits additional attribute type
- * keywords for OIDs that have entries in the <code>oidMap</code>
+ * keywords for OIDs that have entries in the {@code oidMap}
* parameter. OID entries in the oidMap take precedence over the default
- * OIDs recognized by <code>getName(String)</code>.
+ * OIDs recognized by {@code getName(String)}.
* Improperly specified OIDs are ignored; however if an OID
* in the name maps to an improperly specified keyword, an
- * <code>IllegalArgumentException</code> is thrown.
+ * {@code IllegalArgumentException} is thrown.
*
* <p> Additional standard formats may be introduced in the future.
*
@@ -379,12 +393,12 @@
* @param oidMap an OID map, where each key is an object identifier in
* String form (a sequence of nonnegative integers separated by periods)
* that maps to a corresponding attribute type keyword String.
- * The map may be empty but never <code>null</code>.
- * @return a string representation of this <code>X500Principal</code>
+ * The map may be empty but never {@code null}.
+ * @return a string representation of this {@code X500Principal}
* using the specified format
* @throws IllegalArgumentException if the specified format is invalid,
* null, or an OID in the name maps to an improperly specified keyword
- * @throws NullPointerException if <code>oidMap</code> is <code>null</code>
+ * @throws NullPointerException if {@code oidMap} is {@code null}
* @since 1.6
*/
public String getName(String format, Map<String, String> oidMap) {
@@ -424,31 +438,31 @@
/**
* Return a user-friendly string representation of this
- * <code>X500Principal</code>.
+ * {@code X500Principal}.
*
- * @return a string representation of this <code>X500Principal</code>
+ * @return a string representation of this {@code X500Principal}
*/
public String toString() {
return thisX500Name.toString();
}
/**
- * Compares the specified <code>Object</code> with this
- * <code>X500Principal</code> for equality.
+ * Compares the specified {@code Object} with this
+ * {@code X500Principal} for equality.
*
- * <p> Specifically, this method returns <code>true</code> if
- * the <code>Object</code> <i>o</i> is an <code>X500Principal</code>
+ * <p> Specifically, this method returns {@code true} if
+ * the {@code Object} <i>o</i> is an {@code X500Principal}
* and if the respective canonical string representations
- * (obtained via the <code>getName(X500Principal.CANONICAL)</code> method)
+ * (obtained via the {@code getName(X500Principal.CANONICAL)} method)
* of this object and <i>o</i> are equal.
*
* <p> This implementation is compliant with the requirements of RFC 3280.
*
* @param o Object to be compared for equality with this
- * <code>X500Principal</code>
+ * {@code X500Principal}
*
- * @return <code>true</code> if the specified <code>Object</code> is equal
- * to this <code>X500Principal</code>, <code>false</code> otherwise
+ * @return {@code true} if the specified {@code Object} is equal
+ * to this {@code X500Principal}, {@code false} otherwise
*/
public boolean equals(Object o) {
if (this == o) {
@@ -462,12 +476,12 @@
}
/**
- * Return a hash code for this <code>X500Principal</code>.
+ * Return a hash code for this {@code X500Principal}.
*
* <p> The hash code is calculated via:
- * <code>getName(X500Principal.CANONICAL).hashCode()</code>
+ * {@code getName(X500Principal.CANONICAL).hashCode()}
*
- * @return a hash code for this <code>X500Principal</code>
+ * @return a hash code for this {@code X500Principal}
*/
public int hashCode() {
return thisX500Name.hashCode();
@@ -476,9 +490,9 @@
/**
* Save the X500Principal object to a stream.
*
- * @serialData this <code>X500Principal</code> is serialized
+ * @serialData this {@code X500Principal} is serialized
* by writing out its DER-encoded form
- * (the value of <code>getEncoded</code> is serialized).
+ * (the value of {@code getEncoded} is serialized).
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException {
diff --git a/ojluni/src/main/java/javax/security/auth/x500/package-info.java b/ojluni/src/main/java/javax/security/auth/x500/package-info.java
new file mode 100644
index 0000000..12f8a53
--- /dev/null
+++ b/ojluni/src/main/java/javax/security/auth/x500/package-info.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2000, 2013, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/**
+ * This package contains the classes that should be used to store
+ * X500 Principal and X500 Private Credentials in a
+ * <i>Subject</i>.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li><a href="http://www.ietf.org/rfc/rfc1779.txt">
+ * RFC 1779: A String Representation of Distinguished Names</a></li>
+ * <li><a href="http://www.ietf.org/rfc/rfc2253.txt">
+ * RFC 2253: Lightweight Directory Access Protocol (v3):
+ * UTF-8 String Representation of Distinguished Names</a></li>
+ * <li><a href="http://www.ietf.org/rfc/rfc3280.txt">
+ * RFC 3280: Internet X.509 Public Key Infrastructure
+ * Certificate and Certificate Revocation List (CRL) Profile</a></li>
+ * <li><a href="http://www.ietf.org/rfc/rfc4512.txt">
+ * RFC 4512: Lightweight Directory Access Protocol (LDAP):
+ * Directory Information Models</a></li>
+ * </ul>
+ *
+ * @since JDK1.4
+ */
+package javax.security.auth.x500;
diff --git a/ojluni/src/main/java/javax/security/auth/x500/package.html b/ojluni/src/main/java/javax/security/auth/x500/package.html
deleted file mode 100755
index 508380f..0000000
--- a/ojluni/src/main/java/javax/security/auth/x500/package.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 2000, 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. Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-
-</head>
-<body bgcolor="white">
-
- This package contains the classes that should be used to store
- X500 Principal and X500 Private Crendentials in a
- <i>Subject</i>.
-
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
--->
-
-@since JDK1.4
-</body>
-</html>
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index 0f40c7e..04e4b5f 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -1112,6 +1112,7 @@
ojluni/src/main/java/javax/security/auth/SubjectDomainCombiner.java \
ojluni/src/main/java/javax/security/auth/Subject.java \
ojluni/src/main/java/javax/security/auth/x500/X500Principal.java \
+ ojluni/src/main/java/javax/security/auth/x500/package-info.java \
ojluni/src/main/java/javax/security/cert/CertificateEncodingException.java \
ojluni/src/main/java/javax/security/cert/CertificateException.java \
ojluni/src/main/java/javax/security/cert/CertificateExpiredException.java \