Merge "java.security.spec: update classes in java.security.spec"
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ThreadLocalTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ThreadLocalTest.java
index 400ff01..dd03a80 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ThreadLocalTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ThreadLocalTest.java
@@ -18,6 +18,7 @@
 package org.apache.harmony.tests.java.lang;
 
 import junit.framework.TestCase;
+import java.util.concurrent.atomic.AtomicReference;
 
 public class ThreadLocalTest extends TestCase {
 
@@ -147,4 +148,43 @@
                 THREADVALUE.result);
 
     }
+
+    /**
+     * java.lang.ThreadLocal#withInitial()
+     */
+    public void test_withInitial() {
+        // The ThreadLocal has to run once for each thread that touches the
+        // ThreadLocal
+        final String INITIAL_VALUE = "'foo'";
+        final String OTHER_VALUE = "'bar'";
+        final ThreadLocal<String> l1 = ThreadLocal.withInitial(() -> INITIAL_VALUE);
+
+        assertSame(INITIAL_VALUE, l1.get());
+
+        l1.set(OTHER_VALUE);
+        assertSame(OTHER_VALUE, l1.get());
+
+        assertTrue("ThreadLocal's value should be " + OTHER_VALUE
+                + " but is " + l1.get(), l1.get() == OTHER_VALUE);
+
+        AtomicReference<String> threadValue = new AtomicReference<String>();
+
+        Thread t = new Thread() {
+            @Override
+            public void run() {
+                threadValue.set(l1.get());
+            }
+        };
+
+        // Wait for the other Thread assign what it observes as the value of the
+        // variable
+        t.start();
+        try {
+            t.join();
+        } catch (InterruptedException ie) {
+            fail("Interrupted!!");
+        }
+
+        assertSame(INITIAL_VALUE, threadValue.get());
+    }
 }
diff --git a/luni/src/main/native/NetworkUtilities.cpp b/luni/src/main/native/NetworkUtilities.cpp
index b285a01..bf438fa 100644
--- a/luni/src/main/native/NetworkUtilities.cpp
+++ b/luni/src/main/native/NetworkUtilities.cpp
@@ -140,8 +140,12 @@
         jbyte* dst = reinterpret_cast<jbyte*>(&sin6.sin6_addr.s6_addr);
         env->GetByteArrayRegion(addressBytes.get(), 0, 16, dst);
         // ...and set the scope id...
-        static jfieldID scopeFid = env->GetFieldID(JniConstants::inet6AddressClass, "scope_id", "I");
-        sin6.sin6_scope_id = env->GetIntField(inetAddress, scopeFid);
+        static jfieldID holder6Fid = env->GetFieldID(JniConstants::inet6AddressClass,
+                                                     "holder6",
+                                                     "Ljava/net/Inet6Address$Inet6AddressHolder;");
+        ScopedLocalRef<jobject> holder6(env, env->GetObjectField(inetAddress, holder6Fid));
+        static jfieldID scopeFid = env->GetFieldID(JniConstants::inet6AddressHolderClass, "scope_id", "I");
+        sin6.sin6_scope_id = env->GetIntField(holder6.get(), scopeFid);
         sa_len = sizeof(sockaddr_in6);
         return true;
     }
diff --git a/ojluni/src/main/java/java/lang/Process.java b/ojluni/src/main/java/java/lang/Process.java
index 0f93702..4e94538 100644
--- a/ojluni/src/main/java/java/lang/Process.java
+++ b/ojluni/src/main/java/java/lang/Process.java
@@ -57,6 +57,10 @@
  * to promptly write the input stream or read the output stream of
  * the subprocess may cause the subprocess to block, or even deadlock.
  *
+ * <p>Where desired, <a href="ProcessBuilder.html#redirect-input">
+ * subprocess I/O can also be redirected</a>
+ * using methods of the {@link ProcessBuilder} class.
+ *
  * <p>The subprocess is not killed when there are no more references to
  * the {@code Process} object, but rather the subprocess
  * continues executing asynchronously.
@@ -76,6 +80,12 @@
      * subprocess.  Output to the stream is piped into the standard
      * input of the process represented by this {@code Process} object.
      *
+     * <p>If the standard input of the subprocess has been redirected using
+     * {@link ProcessBuilder#redirectInput(Redirect)
+     * ProcessBuilder.redirectInput}
+     * then this method will return a
+     * <a href="ProcessBuilder.html#redirect-input">null output stream</a>.
+     *
      * <p>Implementation note: It is a good idea for the returned
      * output stream to be buffered.
      *
@@ -89,6 +99,19 @@
      * subprocess.  The stream obtains data piped from the standard
      * output of the process represented by this {@code Process} object.
      *
+     * <p>If the standard output of the subprocess has been redirected using
+     * {@link ProcessBuilder#redirectOutput(Redirect)
+     * ProcessBuilder.redirectOutput}
+     * then this method will return a
+     * <a href="ProcessBuilder.html#redirect-output">null input stream</a>.
+     *
+     * <p>Otherwise, if the standard error of the subprocess has been
+     * redirected using
+     * {@link ProcessBuilder#redirectErrorStream(boolean)
+     * ProcessBuilder.redirectErrorStream}
+     * then the input stream returned by this method will receive the
+     * merged standard output and the standard error of the subprocess.
+     *
      * <p>Implementation note: It is a good idea for the returned
      * input stream to be buffered.
      *
@@ -102,6 +125,14 @@
      * subprocess.  The stream obtains data piped from the error output
      * of the process represented by this {@code Process} object.
      *
+     * <p>If the standard error of the subprocess has been redirected using
+     * {@link ProcessBuilder#redirectError(Redirect)
+     * ProcessBuilder.redirectError} or
+     * {@link ProcessBuilder#redirectErrorStream(boolean)
+     * ProcessBuilder.redirectErrorStream}
+     * then this method will return a
+     * <a href="ProcessBuilder.html#redirect-output">null input stream</a>.
+     *
      * <p>Implementation note: It is a good idea for the returned
      * input stream to be buffered.
      *
diff --git a/ojluni/src/main/java/java/lang/ProcessBuilder.java b/ojluni/src/main/java/java/lang/ProcessBuilder.java
index dd61e53..0c892c2 100644
--- a/ojluni/src/main/java/java/lang/ProcessBuilder.java
+++ b/ojluni/src/main/java/java/lang/ProcessBuilder.java
@@ -64,6 +64,65 @@
  * working directory of the current process, usually the directory
  * named by the system property {@code user.dir}.
  *
+ * <li><a name="redirect-input">a source of <i>standard input</i>.
+ * By default, the subprocess reads input from a pipe.  Java code
+ * can access this pipe via the output stream returned by
+ * {@link Process#getOutputStream()}.  However, standard input may
+ * be redirected to another source using
+ * {@link #redirectInput(Redirect) redirectInput}.
+ * In this case, {@link Process#getOutputStream()} will return a
+ * <i>null output stream</i>, for which:
+ *
+ * <ul>
+ * <li>the {@link OutputStream#write(int) write} methods always
+ * throw {@code IOException}
+ * <li>the {@link OutputStream#close() close} method does nothing
+ * </ul>
+ *
+ * <li><a name="redirect-output">a destination for <i>standard output</i>
+ * and <i>standard error</i>.  By default, the subprocess writes standard
+ * output and standard error to pipes.  Java code can access these pipes
+ * via the input streams returned by {@link Process#getInputStream()} and
+ * {@link Process#getErrorStream()}.  However, standard output and
+ * standard error may be redirected to other destinations using
+ * {@link #redirectOutput(Redirect) redirectOutput} and
+ * {@link #redirectError(Redirect) redirectError}.
+ * In this case, {@link Process#getInputStream()} and/or
+ * {@link Process#getErrorStream()} will return a <i>null input
+ * stream</i>, for which:
+ *
+ * <ul>
+ * <li>the {@link InputStream#read() read} methods always return
+ * {@code -1}
+ * <li>the {@link InputStream#available() available} method always returns
+ * {@code 0}
+ * <li>the {@link InputStream#close() close} method does nothing
+ * </ul>
+ *
+ * <li>a <i>redirectErrorStream</i> property.  Initially, this property
+ * is {@code false}, meaning that the standard output and error
+ * output of a subprocess are sent to two separate streams, which can
+ * be accessed using the {@link Process#getInputStream()} and {@link
+ * Process#getErrorStream()} methods.
+ *
+ * <p>If the value is set to {@code true}, then:
+ *
+ * <ul>
+ * <li>standard error is merged with the standard output and always sent
+ * to the same destination (this makes it easier to correlate error
+ * messages with the corresponding output)
+ * <li>the common destination of standard error and standard output can be
+ * redirected using
+ * {@link #redirectOutput(Redirect) redirectOutput}
+ * <li>any redirection set by the
+ * {@link #redirectError(Redirect) redirectError}
+ * method is ignored when creating a subprocess
+ * <li>the stream returned from {@link Process#getErrorStream()} will
+ * always be a <a href="#redirect-output">null input stream</a>
+ * </ul>
+ *
+ * </ul>
+ *
  * <p>Modifying a process builder's attributes will affect processes
  * subsequently started by that object's {@link #start()} method, but
  * will never affect previously started processes or the Java process
@@ -88,7 +147,8 @@
  * }</pre>
  *
  * <p>Here is an example that starts a process with a modified working
- * directory and environment:
+ * directory and environment, and redirects standard output and error
+ * to be appended to a log file:
  *
  * <pre> {@code
  * ProcessBuilder pb =
@@ -98,7 +158,13 @@
  * env.remove("OTHERVAR");
  * env.put("VAR2", env.get("VAR1") + "suffix");
  * pb.directory(new File("myDir"));
+ * File log = new File("log");
+ * pb.redirectErrorStream(true);
+ * pb.redirectOutput(Redirect.appendTo(log));
  * Process p = pb.start();
+ * assert pb.redirectInput() == Redirect.PIPE;
+ * assert pb.redirectOutput().file() == log;
+ * assert p.getInputStream().read() == -1;
  * }</pre>
  *
  * <p>To start a process with an explicit set of environment
@@ -389,8 +455,6 @@
      * {@link Type Type}.
      *
      * @since 1.7
-     *
-     * @hide
      */
     public static abstract class Redirect {
         /**
@@ -632,8 +696,6 @@
      *         {@link Redirect.Type#WRITE WRITE} or
      *         {@link Redirect.Type#APPEND APPEND}
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder redirectInput(Redirect source) {
         if (source.type() == Redirect.Type.WRITE ||
@@ -665,8 +727,6 @@
      *         destination of data, that is, has type
      *         {@link Redirect.Type#READ READ}
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder redirectOutput(Redirect destination) {
         if (destination.type() == Redirect.Type.READ)
@@ -701,8 +761,6 @@
      *         destination of data, that is, has type
      *         {@link Redirect.Type#READ READ}
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder redirectError(Redirect destination) {
         if (destination.type() == Redirect.Type.READ)
@@ -724,8 +782,6 @@
      * @param  file the new standard input source
      * @return this process builder
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder redirectInput(File file) {
         return redirectInput(Redirect.from(file));
@@ -743,8 +799,6 @@
      * @param  file the new standard output destination
      * @return this process builder
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder redirectOutput(File file) {
         return redirectOutput(Redirect.to(file));
@@ -762,8 +816,6 @@
      * @param  file the new standard error destination
      * @return this process builder
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder redirectError(File file) {
         return redirectError(Redirect.to(file));
@@ -778,8 +830,6 @@
      *
      * @return this process builder's standard input source
      * @since  1.7
-     *
-     * @hide
      */
     public Redirect redirectInput() {
         return (redirects == null) ? Redirect.PIPE : redirects[0];
@@ -794,8 +844,6 @@
      *
      * @return this process builder's standard output destination
      * @since  1.7
-     *
-     * @hide
      */
     public Redirect redirectOutput() {
         return (redirects == null) ? Redirect.PIPE : redirects[1];
@@ -810,8 +858,6 @@
      *
      * @return this process builder's standard error destination
      * @since  1.7
-     *
-     * @hide
      */
     public Redirect redirectError() {
         return (redirects == null) ? Redirect.PIPE : redirects[2];
@@ -838,8 +884,6 @@
      *
      * @return this process builder
      * @since  1.7
-     *
-     * @hide
      */
     public ProcessBuilder inheritIO() {
         Arrays.fill(redirects(), Redirect.INHERIT);
@@ -937,6 +981,20 @@
      *         <li>its
      *         {@link SecurityManager#checkExec checkExec}
      *         method doesn't allow creation of the subprocess, or
+     *
+     *         <li>the standard input to the subprocess was
+     *         {@linkplain #redirectInput redirected from a file}
+     *         and the security manager's
+     *         {@link SecurityManager#checkRead checkRead} method
+     *         denies read access to the file, or
+     *
+     *         <li>the standard output or standard error of the
+     *         subprocess was
+     *         {@linkplain #redirectOutput redirected to a file}
+     *         and the security manager's
+     *         {@link SecurityManager#checkWrite checkWrite} method
+     *         denies write access to the file
+     *
      *         </ul>
      *
      * @throws IOException if an I/O error occurs
diff --git a/ojluni/src/main/java/java/lang/String.java b/ojluni/src/main/java/java/lang/String.java
index ea5a642..6958edf 100644
--- a/ojluni/src/main/java/java/lang/String.java
+++ b/ojluni/src/main/java/java/lang/String.java
@@ -29,6 +29,7 @@
 import java.io.UnsupportedEncodingException;
 import java.lang.ArrayIndexOutOfBoundsException;
 import java.nio.charset.Charset;
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -891,7 +892,10 @@
             return CharsetUtils.toBigEndianUtf16Bytes(this, 0, count);
         }
 
-        return StringCoding.encode(charset, this);
+        ByteBuffer buffer = charset.encode(this);
+        byte[] bytes = new byte[buffer.limit()];
+        buffer.get(bytes);
+        return bytes;
     }
 
     /**
diff --git a/ojluni/src/main/java/java/lang/StringCoding.java b/ojluni/src/main/java/java/lang/StringCoding.java
index 3676df5..d2499f6 100644
--- a/ojluni/src/main/java/java/lang/StringCoding.java
+++ b/ojluni/src/main/java/java/lang/StringCoding.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, 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
@@ -309,26 +309,30 @@
 
         byte[] encode(char[] ca, int off, int len) {
             int en = scale(len, ce.maxBytesPerChar());
+            byte[] ba = new byte[en];
             if (len == 0)
-                return new byte[0];
+                return ba;
             if (ce instanceof ArrayEncoder) {
-                byte[] ba = new byte[en];
                 int blen = ((ArrayEncoder)ce).encode(ca, off, len, ba);
                 return safeTrim(ba, blen, cs, isTrusted);
             } else {
                 ce.reset();
+                ByteBuffer bb = ByteBuffer.wrap(ba);
                 CharBuffer cb = CharBuffer.wrap(ca, off, len);
                 try {
-                    /* ----- BEGIN android -----
-                    CoderResult cr = ce.encode(cb, bb, true);
-                    Pass read-only buffer, so the encoder can't alter it */
-                    ByteBuffer bb = ce.encode(cb.asReadOnlyBuffer());
-                    return safeTrim(bb.array(), bb.limit(), cs, isTrusted);
+                    // Android-changed:  Pass read-only buffer, so the encoder can't alter it
+                    CoderResult cr = ce.encode(cb.asReadOnlyBuffer(), bb, true);
+                    if (!cr.isUnderflow())
+                        cr.throwException();
+                    cr = ce.flush(bb);
+                    if (!cr.isUnderflow())
+                        cr.throwException();
                 } catch (CharacterCodingException x) {
                     // Substitution is always enabled,
                     // so this shouldn't happen
                     throw new Error(x);
                 }
+                return safeTrim(ba, bb.position(), cs, isTrusted);
             }
         }
     }
@@ -376,9 +380,7 @@
             ByteBuffer bb = ByteBuffer.wrap(ba);
             CharBuffer cb = CharBuffer.wrap(ca, off, len);
             try {
-                /* ----- BEGIN android -----
-                   CoderResult cr = ce.encode(cb, bb, true);
-                   Pass read-only buffer, so the encoder can't alter it */
+                // Android-changed:  Pass read-only buffer, so the encoder can't alter it
                 CoderResult cr = ce.encode(cb.asReadOnlyBuffer(), bb, true);
                 if (!cr.isUnderflow())
                     cr.throwException();
@@ -392,13 +394,6 @@
         }
     }
 
-    static byte[] encode(Charset cs, String str) {
-        ByteBuffer buffer = cs.encode(str);
-        byte[] bytes = new byte[buffer.limit()];
-        buffer.get(bytes);
-        return bytes;
-    }
-
     static byte[] encode(char[] ca, int off, int len) {
         String csn = Charset.defaultCharset().name();
         try {
diff --git a/ojluni/src/main/java/java/lang/StringIndexOutOfBoundsException.java b/ojluni/src/main/java/java/lang/StringIndexOutOfBoundsException.java
index 935fd67..4fdd061 100644
--- a/ojluni/src/main/java/java/lang/StringIndexOutOfBoundsException.java
+++ b/ojluni/src/main/java/java/lang/StringIndexOutOfBoundsException.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2012, 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
@@ -27,7 +27,7 @@
 package java.lang;
 
 /**
- * Thrown by <code>String</code> methods to indicate that an index
+ * Thrown by {@code String} methods to indicate that an index
  * is either negative or greater than the size of the string.  For
  * some methods such as the charAt method, this exception also is
  * thrown when the index is equal to the size of the string.
@@ -41,7 +41,7 @@
     private static final long serialVersionUID = -6762910422159637258L;
 
     /**
-     * Constructs a <code>StringIndexOutOfBoundsException</code> with no
+     * Constructs a {@code StringIndexOutOfBoundsException} with no
      * detail message.
      *
      * @since   JDK1.0.
@@ -51,7 +51,7 @@
     }
 
     /**
-     * Constructs a <code>StringIndexOutOfBoundsException</code> with
+     * Constructs a {@code StringIndexOutOfBoundsException} with
      * the specified detail message.
      *
      * @param   s   the detail message.
@@ -61,7 +61,7 @@
     }
 
     /**
-     * Constructs a new <code>StringIndexOutOfBoundsException</code>
+     * Constructs a new {@code StringIndexOutOfBoundsException}
      * class with an argument indicating the illegal index.
      *
      * @param   index   the illegal index.
diff --git a/ojluni/src/main/java/java/lang/SuppressWarnings.java b/ojluni/src/main/java/java/lang/SuppressWarnings.java
index babb060..d315ddb 100644
--- a/ojluni/src/main/java/java/lang/SuppressWarnings.java
+++ b/ojluni/src/main/java/java/lang/SuppressWarnings.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -41,8 +41,13 @@
  * suppress a warning in a particular method, you should annotate that
  * method rather than its class.
  *
- * @since 1.5
  * @author Josh Bloch
+ * @since 1.5
+ * @jls 4.8 Raw Types
+ * @jls 4.12.2 Variables of Reference Type
+ * @jls 5.1.9 Unchecked Conversion
+ * @jls 5.5.2 Checked Casts and Unchecked Casts
+ * @jls 9.6.3.5 @SuppressWarnings
  */
 @Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
 @Retention(RetentionPolicy.SOURCE)
@@ -56,9 +61,12 @@
      * free to emit a warning if an annotation contains an unrecognized
      * warning name.
      *
-     * <p>Compiler vendors should document the warning names they support in
-     * conjunction with this annotation type. They are encouraged to cooperate
-     * to ensure that the same names work across multiple compilers.
+     * <p> The string {@code "unchecked"} is used to suppress
+     * unchecked warnings. Compiler vendors should document the
+     * additional warning names they support in conjunction with this
+     * annotation type. They are encouraged to cooperate to ensure
+     * that the same names work across multiple compilers.
+     * @return the set of warnings to be suppressed
      */
     String[] value();
 }
diff --git a/ojluni/src/main/java/java/lang/System.java b/ojluni/src/main/java/java/lang/System.java
index 03b6bd2..22ebae5 100644
--- a/ojluni/src/main/java/java/lang/System.java
+++ b/ojluni/src/main/java/java/lang/System.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -25,19 +25,23 @@
  */
 package java.lang;
 
-import dalvik.system.VMRuntime;
-import dalvik.system.VMStack;
+import android.system.ErrnoException;
 import android.system.StructPasswd;
 import android.system.StructUtsname;
-import android.system.ErrnoException;
+import dalvik.system.VMRuntime;
+import dalvik.system.VMStack;
 import java.io.*;
-import java.util.Locale;
-import java.util.Properties;
+import java.lang.annotation.Annotation;
 import java.nio.channels.Channel;
 import java.nio.channels.spi.SelectorProvider;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.PropertyPermission;
 import libcore.icu.ICU;
 import libcore.io.Libcore;
-
+import sun.reflect.CallerSensitive;
+import sun.security.util.SecurityConstants;
 /**
  * The <code>System</code> class contains several useful class fields
  * and methods. It cannot be instantiated.
@@ -191,8 +195,7 @@
         setErr0(err);
     }
 
-    private static Console cons = null;
-
+    private static volatile Console cons = null;
     /**
      * Returns the unique {@link java.io.Console Console} object associated
      * with the current Java virtual machine, if any.
@@ -202,13 +205,15 @@
      * @since   1.6
      */
      public static Console console() {
-         synchronized (System.class) {
-             if (cons == null) {
-                 cons = Console.console();
+         // Android-changed: Added proper double checked locking for cons access
+         if (cons == null) {
+             synchronized (System.class) {
+                 if (cons == null) {
+                     cons = Console.console();
+                 }
              }
-
-             return cons;
          }
+         return cons;
      }
 
     /**
@@ -252,16 +257,16 @@
      * cannot be safely isolated within a single VM on Android, so this method
      * <i>always</i> throws a {@code SecurityException} when passed a non-null SecurityManager
      *
-     * @param sm a security manager
+     * @param s a security manager
      * @throws SecurityException always, unless {@code sm == null}
      */
-    public static void setSecurityManager(SecurityManager sm) {
-        if (sm != null) {
+    public static
+    void setSecurityManager(final SecurityManager s) {
+        if (s != null) {
             throw new SecurityException();
         }
     }
 
-
     /**
      * Always returns {@code null} in Android
      *
@@ -1117,12 +1122,26 @@
      * <p>
      * Multiple paths in a system property value are separated by the path
      * separator character of the platform.
+     * <p>
+     * Note that even if the security manager does not permit the
+     * <code>getProperties</code> operation, it may choose to permit the
+     * {@link #getProperty(String)} operation.
      *
      * @return     the system properties
+     * @exception  SecurityException  if a security manager exists and its
+     *             <code>checkPropertiesAccess</code> method doesn't allow access
+     *              to the system properties.
      * @see        #setProperties
+     * @see        java.lang.SecurityException
+     * @see        java.lang.SecurityManager#checkPropertiesAccess()
      * @see        java.util.Properties
      */
     public static Properties getProperties() {
+        SecurityManager sm = getSecurityManager();
+        if (sm != null) {
+            sm.checkPropertiesAccess();
+        }
+
         return props;
     }
 
@@ -1133,6 +1152,9 @@
      *
      * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
      * Windows systems it returns {@code "\r\n"}.
+     *
+     * @return the system-dependent line separator string
+     * @since 1.7
      */
     public static String lineSeparator() {
         return lineSeparator;
@@ -1160,7 +1182,11 @@
 
     /**
      * Gets the system property indicated by the specified key.
-     *
+     * <p>
+     * First, if there is a security manager, its
+     * <code>checkPropertyAccess</code> method is called with the key as
+     * its argument. This may result in a SecurityException.
+     * <p>
      * If there is no current set of system properties, a set of system
      * properties is first created and initialized in the same manner as
      * for the <code>getProperties</code> method.
@@ -1169,14 +1195,23 @@
      * @return     the string value of the system property,
      *             or <code>null</code> if there is no property with that key.
      *
+     * @exception  SecurityException  if a security manager exists and its
+     *             <code>checkPropertyAccess</code> method doesn't allow
+     *              access to the specified system property.
      * @exception  NullPointerException if <code>key</code> is
      *             <code>null</code>.
      * @exception  IllegalArgumentException if <code>key</code> is empty.
      * @see        #setProperty
+     * @see        java.lang.SecurityException
+     * @see        java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
      * @see        java.lang.System#getProperties()
      */
     public static String getProperty(String key) {
         checkKey(key);
+        SecurityManager sm = getSecurityManager();
+        if (sm != null) {
+            sm.checkPropertyAccess(key);
+        }
 
         return props.getProperty(key);
     }
@@ -1197,57 +1232,99 @@
      * @return     the string value of the system property,
      *             or the default value if there is no property with that key.
      *
+     * @exception  SecurityException  if a security manager exists and its
+     *             <code>checkPropertyAccess</code> method doesn't allow
+     *             access to the specified system property.
      * @exception  NullPointerException if <code>key</code> is
      *             <code>null</code>.
      * @exception  IllegalArgumentException if <code>key</code> is empty.
      * @see        #setProperty
+     * @see        java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
      * @see        java.lang.System#getProperties()
      */
     public static String getProperty(String key, String def) {
         checkKey(key);
+        SecurityManager sm = getSecurityManager();
+        if (sm != null) {
+            sm.checkPropertyAccess(key);
+        }
 
         return props.getProperty(key, def);
     }
 
     /**
      * Sets the system property indicated by the specified key.
+     * <p>
+     * First, if a security manager exists, its
+     * <code>SecurityManager.checkPermission</code> method
+     * is called with a <code>PropertyPermission(key, "write")</code>
+     * permission. This may result in a SecurityException being thrown.
+     * If no exception is thrown, the specified property is set to the given
+     * value.
+     * <p>
      *
      * @param      key   the name of the system property.
      * @param      value the value of the system property.
      * @return     the previous value of the system property,
      *             or <code>null</code> if it did not have one.
      *
+     * @exception  SecurityException  if a security manager exists and its
+     *             <code>checkPermission</code> method doesn't allow
+     *             setting of the specified property.
      * @exception  NullPointerException if <code>key</code> or
      *             <code>value</code> is <code>null</code>.
      * @exception  IllegalArgumentException if <code>key</code> is empty.
      * @see        #getProperty
      * @see        java.lang.System#getProperty(java.lang.String)
      * @see        java.lang.System#getProperty(java.lang.String, java.lang.String)
+     * @see        java.util.PropertyPermission
+     * @see        SecurityManager#checkPermission
      * @since      1.2
      */
     public static String setProperty(String key, String value) {
         checkKey(key);
+        SecurityManager sm = getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new PropertyPermission(key,
+                SecurityConstants.PROPERTY_WRITE_ACTION));
+        }
 
         return (String) props.setProperty(key, value);
     }
 
     /**
      * Removes the system property indicated by the specified key.
+     * <p>
+     * First, if a security manager exists, its
+     * <code>SecurityManager.checkPermission</code> method
+     * is called with a <code>PropertyPermission(key, "write")</code>
+     * permission. This may result in a SecurityException being thrown.
+     * If no exception is thrown, the specified property is removed.
+     * <p>
      *
      * @param      key   the name of the system property to be removed.
      * @return     the previous string value of the system property,
      *             or <code>null</code> if there was no property with that key.
      *
+     * @exception  SecurityException  if a security manager exists and its
+     *             <code>checkPropertyAccess</code> method doesn't allow
+     *              access to the specified system property.
      * @exception  NullPointerException if <code>key</code> is
      *             <code>null</code>.
      * @exception  IllegalArgumentException if <code>key</code> is empty.
      * @see        #getProperty
      * @see        #setProperty
      * @see        java.util.Properties
+     * @see        java.lang.SecurityException
+     * @see        java.lang.SecurityManager#checkPropertiesAccess()
      * @since 1.5
      */
     public static String clearProperty(String key) {
         checkKey(key);
+        SecurityManager sm = getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new PropertyPermission(key, "write"));
+        }
 
         return (String) props.remove(key);
     }
@@ -1357,6 +1434,11 @@
      * @since  1.5
      */
     public static java.util.Map<String,String> getenv() {
+        SecurityManager sm = getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission("getenv.*"));
+        }
+
         return ProcessEnvironment.getenv();
     }
 
@@ -1477,13 +1559,25 @@
      */
     @Deprecated
     public static void runFinalizersOnExit(boolean value) {
-        Runtime.getRuntime().runFinalizersOnExit(value);
+        Runtime.runFinalizersOnExit(value);
     }
 
     /**
-     * Loads a code file with the specified filename from the local file
-     * system as a dynamic library. The filename
-     * argument must be a complete path name.
+     * Loads the native library specified by the filename argument.  The filename
+     * argument must be an absolute path name.
+     *
+     * If the filename argument, when stripped of any platform-specific library
+     * prefix, path, and file extension, indicates a library whose name is,
+     * for example, L, and a native library called L is statically linked
+     * with the VM, then the JNI_OnLoad_L function exported by the library
+     * is invoked rather than attempting to load a dynamic library.
+     * A filename matching the argument does not have to exist in the
+     * file system.
+     * See the JNI Specification for more details.
+     *
+     * Otherwise, the filename argument is mapped to a native library image in
+     * an implementation-dependent manner.
+     *
      * <p>
      * The call <code>System.load(name)</code> is effectively equivalent
      * to the call:
@@ -1495,20 +1589,31 @@
      * @exception  SecurityException  if a security manager exists and its
      *             <code>checkLink</code> method doesn't allow
      *             loading of the specified dynamic library
-     * @exception  UnsatisfiedLinkError  if the file does not exist.
+     * @exception  UnsatisfiedLinkError  if either the filename is not an
+     *             absolute path name, the native library is not statically
+     *             linked with the VM, or the library cannot be mapped to
+     *             a native library image by the host system.
      * @exception  NullPointerException if <code>filename</code> is
      *             <code>null</code>
      * @see        java.lang.Runtime#load(java.lang.String)
      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
      */
+    @CallerSensitive
     public static void load(String filename) {
         Runtime.getRuntime().load0(VMStack.getStackClass1(), filename);
     }
 
     /**
-     * Loads the system library specified by the <code>libname</code>
-     * argument. The manner in which a library name is mapped to the
-     * actual system library is system dependent.
+     * Loads the native library specified by the <code>libname</code>
+     * argument.  The <code>libname</code> argument must not contain any platform
+     * specific prefix, file extension or path. If a native library
+     * called <code>libname</code> is statically linked with the VM, then the
+     * JNI_OnLoad_<code>libname</code> function exported by the library is invoked.
+     * See the JNI Specification for more details.
+     *
+     * Otherwise, the libname argument is loaded from a system library
+     * location and mapped to a native library image in an implementation-
+     * dependent manner.
      * <p>
      * The call <code>System.loadLibrary(name)</code> is effectively
      * equivalent to the call
@@ -1520,12 +1625,16 @@
      * @exception  SecurityException  if a security manager exists and its
      *             <code>checkLink</code> method doesn't allow
      *             loading of the specified dynamic library
-     * @exception  UnsatisfiedLinkError  if the library does not exist.
+     * @exception  UnsatisfiedLinkError if either the libname argument
+     *             contains a file path, the native library is not statically
+     *             linked with the VM,  or the library cannot be mapped to a
+     *             native library image by the host system.
      * @exception  NullPointerException if <code>libname</code> is
      *             <code>null</code>
      * @see        java.lang.Runtime#loadLibrary(java.lang.String)
      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
      */
+    @CallerSensitive
     public static void loadLibrary(String libname) {
         Runtime.getRuntime().loadLibrary0(VMStack.getCallingClassLoader(), libname);
     }
@@ -1545,6 +1654,19 @@
     public static native String mapLibraryName(String libname);
 
     /**
+     * Create PrintStream for stdout/err based on encoding.
+     */
+    private static PrintStream newPrintStream(FileOutputStream fos, String enc) {
+       if (enc != null) {
+            try {
+                return new PrintStream(new BufferedOutputStream(fos, 128), true, enc);
+            } catch (UnsupportedEncodingException uee) {}
+        }
+        return new PrintStream(new BufferedOutputStream(fos, 128), true);
+    }
+
+
+    /**
      * Initialize the system class.  Called after thread initialization.
      */
     static {
@@ -1561,10 +1683,9 @@
         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
         FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
-
         in = new BufferedInputStream(fdIn);
-        out = new PrintStream(fdOut);
-        err = new PrintStream(fdErr);
+        out = newPrintStream(fdOut, props.getProperty("sun.stdout.encoding"));
+        err = newPrintStream(fdErr, props.getProperty("sun.stderr.encoding"));
 
         // Initialize any miscellenous operating system settings that need to be
         // set for the class libraries. Currently this is no-op everywhere except
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index f0e9a78..999d936 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -78,7 +78,7 @@
  * <code>Thread</code>. An instance of the subclass can then be
  * allocated and started. For example, a thread that computes primes
  * larger than a stated value could be written as follows:
- * <p><hr><blockquote><pre>
+ * <hr><blockquote><pre>
  *     class PrimeThread extends Thread {
  *         long minPrime;
  *         PrimeThread(long minPrime) {
@@ -93,7 +93,7 @@
  * </pre></blockquote><hr>
  * <p>
  * The following code would then create a thread and start it running:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     PrimeThread p = new PrimeThread(143);
  *     p.start();
  * </pre></blockquote>
@@ -104,7 +104,7 @@
  * then be allocated, passed as an argument when creating
  * <code>Thread</code>, and started. The same example in this other
  * style looks like the following:
- * <p><hr><blockquote><pre>
+ * <hr><blockquote><pre>
  *     class PrimeRun implements Runnable {
  *         long minPrime;
  *         PrimeRun(long minPrime) {
@@ -119,7 +119,7 @@
  * </pre></blockquote><hr>
  * <p>
  * The following code would then create a thread and start it running:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     PrimeRun p = new PrimeRun(143);
  *     new Thread(p).start();
  * </pre></blockquote>
@@ -152,7 +152,7 @@
 
     boolean started = false;
 
-    private String name;
+    private volatile String name;
 
     private int         priority;
     private Thread      threadQ;
@@ -853,50 +853,15 @@
     }
 
     /**
-     * Forces the thread to stop executing.
-     * <p>
-     * If there is a security manager installed, the <code>checkAccess</code>
-     * method of this thread is called, which may result in a
-     * <code>SecurityException</code> being raised (in the current thread).
-     * <p>
-     * If this thread is different from the current thread (that is, the current
-     * thread is trying to stop a thread other than itself) or
-     * <code>obj</code> is not an instance of <code>ThreadDeath</code>, the
-     * security manager's <code>checkPermission</code> method (with the
-     * <code>RuntimePermission("stopThread")</code> argument) is called in
-     * addition.
-     * Again, this may result in throwing a
-     * <code>SecurityException</code> (in the current thread).
-     * <p>
-     * If the argument <code>obj</code> is null, a
-     * <code>NullPointerException</code> is thrown (in the current thread).
-     * <p>
-     * The thread represented by this thread is forced to stop
-     * whatever it is doing abnormally and to throw the
-     * <code>Throwable</code> object <code>obj</code> as an exception. This
-     * is an unusual action to take; normally, the <code>stop</code> method
-     * that takes no arguments should be used.
-     * <p>
-     * It is permitted to stop a thread that has not yet been started.
-     * If the thread is eventually started, it immediately terminates.
+     * Throws {@code UnsupportedOperationException}.
      *
-     * @param      obj   the Throwable object to be thrown.
-     * @exception  SecurityException  if the current thread cannot modify
-     *               this thread.
-     * @throws     NullPointerException if obj is <tt>null</tt>.
-     * @see        #interrupt()
-     * @see        #checkAccess()
-     * @see        #run()
-     * @see        #start()
-     * @see        #stop()
-     * @see        SecurityManager#checkAccess(Thread)
-     * @see        SecurityManager#checkPermission
-     * @deprecated This method is inherently unsafe.  See {@link #stop()}
-     *        for details.  An additional danger of this
-     *        method is that it may be used to generate exceptions that the
-     *        target thread is unprepared to handle (including checked
-     *        exceptions that the thread could not possibly throw, were it
-     *        not for this method).
+     * @param obj ignored
+     *
+     * @deprecated This method was originally designed to force a thread to stop
+     *        and throw a given {@code Throwable} as an exception. It was
+     *        inherently unsafe (see {@link #stop()} for details), and furthermore
+     *        could be used to generate exceptions that the target thread was
+     *        not prepared to handle.
      *        For more information, see
      *        <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
      *        are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
@@ -923,8 +888,8 @@
      * will receive an {@link InterruptedException}.
      *
      * <p> If this thread is blocked in an I/O operation upon an {@link
-     * java.nio.channels.InterruptibleChannel </code>interruptible
-     * channel<code>} then the channel will be closed, the thread's interrupt
+     * java.nio.channels.InterruptibleChannel InterruptibleChannel}
+     * then the channel will be closed, the thread's interrupt
      * status will be set, and the thread will receive a {@link
      * java.nio.channels.ClosedByInterruptException}.
      *
@@ -1642,7 +1607,7 @@
      * security-sensitive non-final methods, or else the
      * "enableContextClassLoaderOverride" RuntimePermission is checked.
      */
-    private static boolean isCCLOverridden(Class cl) {
+    private static boolean isCCLOverridden(Class<?> cl) {
         if (cl == Thread.class)
             return false;
 
@@ -1662,21 +1627,21 @@
      * override security-sensitive non-final methods.  Returns true if the
      * subclass overrides any of the methods, false otherwise.
      */
-    private static boolean auditSubclass(final Class subcl) {
+    private static boolean auditSubclass(final Class<?> subcl) {
         Boolean result = AccessController.doPrivileged(
             new PrivilegedAction<Boolean>() {
                 public Boolean run() {
-                    for (Class cl = subcl;
+                    for (Class<?> cl = subcl;
                          cl != Thread.class;
                          cl = cl.getSuperclass())
                     {
                         try {
-                            cl.getDeclaredMethod("getContextClassLoader", new Class[0]);
+                            cl.getDeclaredMethod("getContextClassLoader", new Class<?>[0]);
                             return Boolean.TRUE;
                         } catch (NoSuchMethodException ex) {
                         }
                         try {
-                            Class[] params = {ClassLoader.class};
+                            Class<?>[] params = {ClassLoader.class};
                             cl.getDeclaredMethod("setContextClassLoader", params);
                             return Boolean.TRUE;
                         } catch (NoSuchMethodException ex) {
@@ -1838,6 +1803,7 @@
      * @see ThreadGroup#uncaughtException
      * @since 1.5
      */
+    @FunctionalInterface
     public interface UncaughtExceptionHandler {
         /**
          * Method invoked when the given thread terminates due to the
@@ -1900,6 +1866,7 @@
      * there is no default.
      * @since 1.5
      * @see #setDefaultUncaughtExceptionHandler
+     * @return the default uncaught exception handler for all threads
      */
     public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler(){
         return defaultUncaughtExceptionHandler;
@@ -1912,6 +1879,7 @@
      * <tt>ThreadGroup</tt> object is returned, unless this thread
      * has terminated, in which case <tt>null</tt> is returned.
      * @since 1.5
+     * @return the uncaught exception handler for this thread
      */
     public UncaughtExceptionHandler getUncaughtExceptionHandler() {
         return uncaughtExceptionHandler != null ?
diff --git a/ojluni/src/main/java/java/lang/ThreadGroup.java b/ojluni/src/main/java/java/lang/ThreadGroup.java
index 3b702a9..1388851 100644
--- a/ojluni/src/main/java/java/lang/ThreadGroup.java
+++ b/ojluni/src/main/java/java/lang/ThreadGroup.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, 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
@@ -681,6 +681,7 @@
      *     {@link Thread#suspend} for details.
      */
     @Deprecated
+    @SuppressWarnings("deprecation")
     public final void suspend() {
         if (stopOrSuspend(true))
             Thread.currentThread().suspend();
@@ -693,6 +694,7 @@
      * if (and only if) the current thread is found to be in this thread
      * group or one of its subgroups.
      */
+    @SuppressWarnings("deprecation")
     private boolean stopOrSuspend(boolean suspend) {
         boolean suicide = false;
         Thread us = Thread.currentThread();
@@ -742,6 +744,7 @@
      *       deadlock-prone.  See {@link Thread#suspend} for details.
      */
     @Deprecated
+    @SuppressWarnings("deprecation")
     public final void resume() {
         int ngroupsSnapshot;
         ThreadGroup[] groupsSnapshot;
@@ -926,9 +929,6 @@
      *
      * @param  t
      *         the Thread whose start method was invoked
-     *
-     * @param  failed
-     *         true if the thread could not be started successfully
      */
     void threadStartFailed(Thread t) {
         synchronized(this) {
diff --git a/ojluni/src/main/java/java/lang/ThreadLocal.java b/ojluni/src/main/java/java/lang/ThreadLocal.java
index 50dcf9b..c29ce7e 100644
--- a/ojluni/src/main/java/java/lang/ThreadLocal.java
+++ b/ojluni/src/main/java/java/lang/ThreadLocal.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -25,19 +25,21 @@
 
 package java.lang;
 import java.lang.ref.*;
+import java.util.Objects;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Supplier;
 
 /**
  * This class provides thread-local variables.  These variables differ from
  * their normal counterparts in that each thread that accesses one (via its
- * <tt>get</tt> or <tt>set</tt> method) has its own, independently initialized
- * copy of the variable.  <tt>ThreadLocal</tt> instances are typically private
+ * {@code get} or {@code set} method) has its own, independently initialized
+ * copy of the variable.  {@code ThreadLocal} instances are typically private
  * static fields in classes that wish to associate state with a thread (e.g.,
  * a user ID or Transaction ID).
  *
  * <p>For example, the class below generates unique identifiers local to each
  * thread.
- * A thread's id is assigned the first time it invokes <tt>ThreadId.get()</tt>
+ * A thread's id is assigned the first time it invokes {@code ThreadId.get()}
  * and remains unchanged on subsequent calls.
  * <pre>
  * import java.util.concurrent.atomic.AtomicInteger;
@@ -47,8 +49,8 @@
  *     private static final AtomicInteger nextId = new AtomicInteger(0);
  *
  *     // Thread local variable containing each thread's ID
- *     private static final ThreadLocal&lt;Integer> threadId =
- *         new ThreadLocal&lt;Integer>() {
+ *     private static final ThreadLocal&lt;Integer&gt; threadId =
+ *         new ThreadLocal&lt;Integer&gt;() {
  *             &#64;Override protected Integer initialValue() {
  *                 return nextId.getAndIncrement();
  *         }
@@ -61,7 +63,7 @@
  * }
  * </pre>
  * <p>Each thread holds an implicit reference to its copy of a thread-local
- * variable as long as the thread is alive and the <tt>ThreadLocal</tt>
+ * variable as long as the thread is alive and the {@code ThreadLocal}
  * instance is accessible; after a thread goes away, all of its copies of
  * thread-local instances are subject to garbage collection (unless other
  * references to these copies exist).
@@ -108,14 +110,14 @@
      * thread-local variable.  This method will be invoked the first
      * time a thread accesses the variable with the {@link #get}
      * method, unless the thread previously invoked the {@link #set}
-     * method, in which case the <tt>initialValue</tt> method will not
+     * method, in which case the {@code initialValue} method will not
      * be invoked for the thread.  Normally, this method is invoked at
      * most once per thread, but it may be invoked again in case of
      * subsequent invocations of {@link #remove} followed by {@link #get}.
      *
-     * <p>This implementation simply returns <tt>null</tt>; if the
+     * <p>This implementation simply returns {@code null}; if the
      * programmer desires thread-local variables to have an initial
-     * value other than <tt>null</tt>, <tt>ThreadLocal</tt> must be
+     * value other than {@code null}, {@code ThreadLocal} must be
      * subclassed, and this method overridden.  Typically, an
      * anonymous inner class will be used.
      *
@@ -126,7 +128,22 @@
     }
 
     /**
+     * Creates a thread local variable. The initial value of the variable is
+     * determined by invoking the {@code get} method on the {@code Supplier}.
+     *
+     * @param <S> the type of the thread local's value
+     * @param supplier the supplier to be used to determine the initial value
+     * @return a new thread local variable
+     * @throws NullPointerException if the specified supplier is null
+     * @since 1.8
+     */
+    public static <S> ThreadLocal<S> withInitial(Supplier<? extends S> supplier) {
+        return new SuppliedThreadLocal<>(supplier);
+    }
+
+    /**
      * Creates a thread local variable.
+     * @see #withInitial(java.util.function.Supplier)
      */
     public ThreadLocal() {
     }
@@ -144,8 +161,11 @@
         ThreadLocalMap map = getMap(t);
         if (map != null) {
             ThreadLocalMap.Entry e = map.getEntry(this);
-            if (e != null)
-                return (T)e.value;
+            if (e != null) {
+                @SuppressWarnings("unchecked")
+                T result = (T)e.value;
+                return result;
+            }
         }
         return setInitialValue();
     }
@@ -192,7 +212,7 @@
      * reinitialized by invoking its {@link #initialValue} method,
      * unless its value is {@linkplain #set set} by the current thread
      * in the interim.  This may result in multiple invocations of the
-     * <tt>initialValue</tt> method in the current thread.
+     * {@code initialValue} method in the current thread.
      *
      * @since 1.5
      */
@@ -219,7 +239,6 @@
      *
      * @param t the current thread
      * @param firstValue value for the initial entry of the map
-     * @param map the map to store.
      */
     void createMap(Thread t, T firstValue) {
         t.threadLocals = new ThreadLocalMap(this, firstValue);
@@ -249,6 +268,24 @@
     }
 
     /**
+     * An extension of ThreadLocal that obtains its initial value from
+     * the specified {@code Supplier}.
+     */
+    static final class SuppliedThreadLocal<T> extends ThreadLocal<T> {
+
+        private final Supplier<? extends T> supplier;
+
+        SuppliedThreadLocal(Supplier<? extends T> supplier) {
+            this.supplier = Objects.requireNonNull(supplier);
+        }
+
+        @Override
+        protected T initialValue() {
+            return supplier.get();
+        }
+    }
+
+    /**
      * ThreadLocalMap is a customized hash map suitable only for
      * maintaining thread local values. No operations are exported
      * outside of the ThreadLocal class. The class is package private to
@@ -268,11 +305,11 @@
          * entry can be expunged from table.  Such entries are referred to
          * as "stale entries" in the code that follows.
          */
-        static class Entry extends WeakReference<ThreadLocal> {
+        static class Entry extends WeakReference<ThreadLocal<?>> {
             /** The value associated with this ThreadLocal. */
             Object value;
 
-            Entry(ThreadLocal k, Object v) {
+            Entry(ThreadLocal<?> k, Object v) {
                 super(k);
                 value = v;
             }
@@ -325,7 +362,7 @@
          * ThreadLocalMaps are constructed lazily, so we only create
          * one when we have at least one entry to put in it.
          */
-        ThreadLocalMap(ThreadLocal firstKey, Object firstValue) {
+        ThreadLocalMap(ThreadLocal<?> firstKey, Object firstValue) {
             table = new Entry[INITIAL_CAPACITY];
             int i = firstKey.threadLocalHashCode & (INITIAL_CAPACITY - 1);
             table[i] = new Entry(firstKey, firstValue);
@@ -348,7 +385,8 @@
             for (int j = 0; j < len; j++) {
                 Entry e = parentTable[j];
                 if (e != null) {
-                    ThreadLocal key = e.get();
+                    @SuppressWarnings("unchecked")
+                    ThreadLocal<Object> key = (ThreadLocal<Object>) e.get();
                     if (key != null) {
                         Object value = key.childValue(e.value);
                         Entry c = new Entry(key, value);
@@ -372,7 +410,7 @@
          * @param  key the thread local object
          * @return the entry associated with key, or null if no such
          */
-        private Entry getEntry(ThreadLocal key) {
+        private Entry getEntry(ThreadLocal<?> key) {
             int i = key.threadLocalHashCode & (table.length - 1);
             Entry e = table[i];
             if (e != null && e.get() == key)
@@ -390,12 +428,12 @@
          * @param  e the entry at table[i]
          * @return the entry associated with key, or null if no such
          */
-        private Entry getEntryAfterMiss(ThreadLocal key, int i, Entry e) {
+        private Entry getEntryAfterMiss(ThreadLocal<?> key, int i, Entry e) {
             Entry[] tab = table;
             int len = tab.length;
 
             while (e != null) {
-                ThreadLocal k = e.get();
+                ThreadLocal<?> k = e.get();
                 if (k == key)
                     return e;
                 if (k == null)
@@ -413,7 +451,7 @@
          * @param key the thread local object
          * @param value the value to be set
          */
-        private void set(ThreadLocal key, Object value) {
+        private void set(ThreadLocal<?> key, Object value) {
 
             // We don't use a fast path as with get() because it is at
             // least as common to use set() to create new entries as
@@ -427,7 +465,7 @@
             for (Entry e = tab[i];
                  e != null;
                  e = tab[i = nextIndex(i, len)]) {
-                ThreadLocal k = e.get();
+                ThreadLocal<?> k = e.get();
 
                 if (k == key) {
                     e.value = value;
@@ -449,7 +487,7 @@
         /**
          * Remove the entry for key.
          */
-        private void remove(ThreadLocal key) {
+        private void remove(ThreadLocal<?> key) {
             Entry[] tab = table;
             int len = tab.length;
             int i = key.threadLocalHashCode & (len-1);
@@ -479,7 +517,7 @@
          * @param  staleSlot index of the first stale entry encountered while
          *         searching for key.
          */
-        private void replaceStaleEntry(ThreadLocal key, Object value,
+        private void replaceStaleEntry(ThreadLocal<?> key, Object value,
                                        int staleSlot) {
             Entry[] tab = table;
             int len = tab.length;
@@ -501,7 +539,7 @@
             for (int i = nextIndex(staleSlot, len);
                  (e = tab[i]) != null;
                  i = nextIndex(i, len)) {
-                ThreadLocal k = e.get();
+                ThreadLocal<?> k = e.get();
 
                 // If we find key, then we need to swap it
                 // with the stale entry to maintain hash table order.
@@ -563,7 +601,7 @@
             for (i = nextIndex(staleSlot, len);
                  (e = tab[i]) != null;
                  i = nextIndex(i, len)) {
-                ThreadLocal k = e.get();
+                ThreadLocal<?> k = e.get();
                 if (k == null) {
                     e.value = null;
                     tab[i] = null;
@@ -596,9 +634,9 @@
          * @param i a position known NOT to hold a stale entry. The
          * scan starts at the element after i.
          *
-         * @param n scan control: <tt>log2(n)</tt> cells are scanned,
+         * @param n scan control: {@code log2(n)} cells are scanned,
          * unless a stale entry is found, in which case
-         * <tt>log2(table.length)-1</tt> additional cells are scanned.
+         * {@code log2(table.length)-1} additional cells are scanned.
          * When called from insertions, this parameter is the number
          * of elements, but when from replaceStaleEntry, it is the
          * table length. (Note: all this could be changed to be either
@@ -650,7 +688,7 @@
             for (int j = 0; j < oldLen; ++j) {
                 Entry e = oldTab[j];
                 if (e != null) {
-                    ThreadLocal k = e.get();
+                    ThreadLocal<?> k = e.get();
                     if (k == null) {
                         e.value = null; // Help the GC
                     } else {
diff --git a/ojluni/src/main/java/java/lang/Void.java b/ojluni/src/main/java/java/lang/Void.java
index 817e0e0..91778b1 100644
--- a/ojluni/src/main/java/java/lang/Void.java
+++ b/ojluni/src/main/java/java/lang/Void.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
diff --git a/ojluni/src/main/java/java/net/Inet6Address.java b/ojluni/src/main/java/java/net/Inet6Address.java
index 1fa8e04..013c4ca 100644
--- a/ojluni/src/main/java/java/net/Inet6Address.java
+++ b/ojluni/src/main/java/java/net/Inet6Address.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * 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
@@ -26,10 +26,13 @@
 
 package java.net;
 
-import java.io.ObjectInputStream;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
 import java.util.Enumeration;
+import java.util.Arrays;
 import libcore.io.Libcore;
 import static android.system.OsConstants.*;
 
@@ -183,73 +186,226 @@
     public static final InetAddress LOOPBACK = new Inet6Address("ip6-localhost",
             new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 0);
 
-    /**
-     * Holds a 128-bit (16 bytes) IPv6 address.
-     *
-     * @serial
-     */
-    byte[] ipaddress;
+    private class Inet6AddressHolder {
 
-    /**
-     * scope_id. The scope specified when the object is created. If the object is created
-     * with an interface name, then the scope_id is not determined until the time it is needed.
-     */
-    private int scope_id = 0;
+        private Inet6AddressHolder() {
+            ipaddress = new byte[INADDRSZ];
+        }
 
-    /**
-     * This will be set to true when the scope_id field contains a valid
-     * integer scope_id.
-     */
-    private boolean scope_id_set = false;
+        private Inet6AddressHolder(
+            byte[] ipaddress, int scope_id, boolean scope_id_set,
+            NetworkInterface ifname, boolean scope_ifname_set)
+        {
+            this.ipaddress = ipaddress;
+            this.scope_id = scope_id;
+            this.scope_id_set = scope_id_set;
+            this.scope_ifname_set = scope_ifname_set;
+            this.scope_ifname = ifname;
+        }
 
-    /**
-     * scoped interface. scope_id is derived from this as the scope_id of the first
-     * address whose scope is the same as this address for the named interface.
-     */
-    private transient NetworkInterface scope_ifname = null;
+        /**
+         * Holds a 128-bit (16 bytes) IPv6 address.
+         */
+        byte[] ipaddress;
 
-    /**
-     * set if the object is constructed with a scoped interface instead of a
-     * numeric scope id.
-     */
-    private boolean scope_ifname_set = false;
+        /**
+         * scope_id. The scope specified when the object is created. If the object
+         * is created with an interface name, then the scope_id is not determined
+         * until the time it is needed.
+         */
+        int scope_id;  // 0
+
+        /**
+         * This will be set to true when the scope_id field contains a valid
+         * integer scope_id.
+         */
+        boolean scope_id_set;  // false
+
+        /**
+         * scoped interface. scope_id is derived from this as the scope_id of the first
+         * address whose scope is the same as this address for the named interface.
+         */
+        NetworkInterface scope_ifname;  // null
+
+        /**
+         * set if the object is constructed with a scoped
+         * interface instead of a numeric scope id.
+         */
+        boolean scope_ifname_set; // false;
+
+        void setAddr(byte addr[]) {
+            if (addr.length == INADDRSZ) { // normal IPv6 address
+                System.arraycopy(addr, 0, ipaddress, 0, INADDRSZ);
+            }
+        }
+
+        void init(byte addr[], int scope_id) {
+            setAddr(addr);
+
+            // Android-changed: was >= 0
+            if (scope_id > 0) {
+                this.scope_id = scope_id;
+                this.scope_id_set = true;
+            }
+        }
+
+        void init(byte addr[], NetworkInterface nif)
+            throws UnknownHostException
+        {
+            setAddr(addr);
+
+            if (nif != null) {
+                this.scope_id = deriveNumericScope(ipaddress, nif);
+                this.scope_id_set = true;
+                this.scope_ifname = nif;
+                this.scope_ifname_set = true;
+            }
+        }
+
+        /* ----- android-removed -----
+        String getHostAddress() {
+            String s = numericToTextFormat(ipaddress);
+            if (scope_ifname != null) { // must check this first
+                s = s + "%" + scope_ifname.getName();
+            } else if (scope_id_set) {
+                s = s + "%" + scope_id;
+            }
+            return s;
+        } */
+
+        public boolean equals(Object o) {
+            if (! (o instanceof Inet6AddressHolder)) {
+                return false;
+            }
+            Inet6AddressHolder that = (Inet6AddressHolder)o;
+
+            return Arrays.equals(this.ipaddress, that.ipaddress);
+        }
+
+        public int hashCode() {
+            if (ipaddress != null) {
+
+                int hash = 0;
+                int i=0;
+                while (i<INADDRSZ) {
+                    int j=0;
+                    int component=0;
+                    while (j<4 && i<INADDRSZ) {
+                        component = (component << 8) + ipaddress[i];
+                        j++;
+                        i++;
+                    }
+                    hash += component;
+                }
+                return hash;
+
+            } else {
+                return 0;
+            }
+        }
+
+        boolean isIPv4CompatibleAddress() {
+            if ((ipaddress[0] == 0x00) && (ipaddress[1] == 0x00) &&
+                (ipaddress[2] == 0x00) && (ipaddress[3] == 0x00) &&
+                (ipaddress[4] == 0x00) && (ipaddress[5] == 0x00) &&
+                (ipaddress[6] == 0x00) && (ipaddress[7] == 0x00) &&
+                (ipaddress[8] == 0x00) && (ipaddress[9] == 0x00) &&
+                (ipaddress[10] == 0x00) && (ipaddress[11] == 0x00))  {
+                return true;
+            }
+            return false;
+        }
+
+        boolean isMulticastAddress() {
+            return ((ipaddress[0] & 0xff) == 0xff);
+        }
+
+        boolean isAnyLocalAddress() {
+            byte test = 0x00;
+            for (int i = 0; i < INADDRSZ; i++) {
+                test |= ipaddress[i];
+            }
+            return (test == 0x00);
+        }
+
+        boolean isLoopbackAddress() {
+            byte test = 0x00;
+            for (int i = 0; i < 15; i++) {
+                test |= ipaddress[i];
+            }
+            return (test == 0x00) && (ipaddress[15] == 0x01);
+        }
+
+        boolean isLinkLocalAddress() {
+            return ((ipaddress[0] & 0xff) == 0xfe
+                    && (ipaddress[1] & 0xc0) == 0x80);
+        }
+
+
+        boolean isSiteLocalAddress() {
+            return ((ipaddress[0] & 0xff) == 0xfe
+                    && (ipaddress[1] & 0xc0) == 0xc0);
+        }
+
+        boolean isMCGlobal() {
+            return ((ipaddress[0] & 0xff) == 0xff
+                    && (ipaddress[1] & 0x0f) == 0x0e);
+        }
+
+        boolean isMCNodeLocal() {
+            return ((ipaddress[0] & 0xff) == 0xff
+                    && (ipaddress[1] & 0x0f) == 0x01);
+        }
+
+        boolean isMCLinkLocal() {
+            return ((ipaddress[0] & 0xff) == 0xff
+                    && (ipaddress[1] & 0x0f) == 0x02);
+        }
+
+        boolean isMCSiteLocal() {
+            return ((ipaddress[0] & 0xff) == 0xff
+                    && (ipaddress[1] & 0x0f) == 0x05);
+        }
+
+        boolean isMCOrgLocal() {
+            return ((ipaddress[0] & 0xff) == 0xff
+                    && (ipaddress[1] & 0x0f) == 0x08);
+        }
+    }
+
+    private final transient Inet6AddressHolder holder6;
 
     private static final long serialVersionUID = 6880410070516793377L;
 
     Inet6Address() {
         super();
-        holder().hostName = null;
-        ipaddress = new byte[INADDRSZ];
-        holder().family = AF_INET6;
+        holder.init(null, AF_INET6);
+        holder6 = new Inet6AddressHolder();
     }
 
     /* checking of value for scope_id should be done by caller
      * scope_id must be >= 0, or -1 to indicate not being set
      */
     Inet6Address(String hostName, byte addr[], int scope_id) {
-        holder().hostName = hostName;
-        if (addr.length == INADDRSZ) { // normal IPv6 address
-            holder().family = AF_INET6;
-            ipaddress = addr.clone();
-        }
-        // Android change, was >= 0.
-        if (scope_id > 0) {
-            this.scope_id = scope_id;
-            scope_id_set = true;
-        }
+        holder.init(hostName, AF_INET6);
+        holder6 = new Inet6AddressHolder();
+        holder6.init(addr, scope_id);
     }
 
     Inet6Address(String hostName, byte addr[]) {
+        holder6 = new Inet6AddressHolder();
         try {
             initif (hostName, addr, null);
         } catch (UnknownHostException e) {} /* cant happen if ifname is null */
     }
 
     Inet6Address (String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException {
+        holder6 = new Inet6AddressHolder();
         initif (hostName, addr, nif);
     }
 
     Inet6Address (String hostName, byte addr[], String ifname) throws UnknownHostException {
+        holder6 = new Inet6AddressHolder();
         initstr (hostName, addr, ifname);
     }
 
@@ -339,16 +495,13 @@
 
     private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException {
         holder().hostName = hostName;
+        int family = -1;
+        holder6.init(addr, nif);
+
         if (addr.length == INADDRSZ) { // normal IPv6 address
-            holder().family = AF_INET6;
-            ipaddress = addr.clone();
+            family = AF_INET6;
         }
-        if (nif != null) {
-            this.scope_ifname = nif;
-            scope_ifname_set = true;
-            scope_id = deriveNumericScope (nif);
-            scope_id_set = true;
-        }
+        holder.init(hostName, family);
     }
 
     /* check the two Ipv6 addresses and return false if they are both
@@ -356,18 +509,22 @@
      * (ie. one is sitelocal and the other linklocal)
      * return true otherwise.
      */
-    private boolean differentLocalAddressTypes(Inet6Address other) {
 
-        if (isLinkLocalAddress() && !other.isLinkLocalAddress()) {
+    private static boolean isDifferentLocalAddressType(
+        byte[] thisAddr, byte[] otherAddr) {
+
+        if (Inet6Address.isLinkLocalAddress(thisAddr) &&
+                !Inet6Address.isLinkLocalAddress(otherAddr)) {
             return false;
         }
-        if (isSiteLocalAddress() && !other.isSiteLocalAddress()) {
+        if (Inet6Address.isSiteLocalAddress(thisAddr) &&
+                !Inet6Address.isSiteLocalAddress(otherAddr)) {
             return false;
         }
         return true;
     }
 
-    private int deriveNumericScope (NetworkInterface ifc) throws UnknownHostException {
+    private static int deriveNumericScope (byte[] thisAddr, NetworkInterface ifc) throws UnknownHostException {
         Enumeration<InetAddress> addresses = ifc.getInetAddresses();
         while (addresses.hasMoreElements()) {
             InetAddress addr = addresses.nextElement();
@@ -376,12 +533,12 @@
             }
             Inet6Address ia6_addr = (Inet6Address)addr;
             /* check if site or link local prefixes match */
-            if (!differentLocalAddressTypes(ia6_addr)){
+            if (!isDifferentLocalAddressType(thisAddr, ia6_addr.getAddress())){
                 /* type not the same, so carry on searching */
                 continue;
             }
             /* found a matching address - return its scope_id */
-            return ia6_addr.scope_id;
+            return ia6_addr.getScopeId();
         }
         throw new UnknownHostException ("no scope_id found");
     }
@@ -396,41 +553,62 @@
         while (en.hasMoreElements()) {
             NetworkInterface ifc = en.nextElement();
             if (ifc.getName().equals (ifname)) {
-                Enumeration addresses = ifc.getInetAddresses();
-                while (addresses.hasMoreElements()) {
-                    InetAddress addr = (InetAddress)addresses.nextElement();
-                    if (!(addr instanceof Inet6Address)) {
-                        continue;
-                    }
-                    Inet6Address ia6_addr = (Inet6Address)addr;
-                    /* check if site or link local prefixes match */
-                    if (!differentLocalAddressTypes(ia6_addr)){
-                        /* type not the same, so carry on searching */
-                        continue;
-                    }
-                    /* found a matching address - return its scope_id */
-                    return ia6_addr.scope_id;
-                }
+                return deriveNumericScope(holder6.ipaddress, ifc);
             }
         }
         throw new UnknownHostException ("No matching address found for interface : " +ifname);
     }
 
     /**
+     * @serialField ipaddress byte[]
+     * @serialField scope_id int
+     * @serialField scope_id_set boolean
+     * @serialField scope_ifname_set boolean
+     * @serialField ifname String
+     */
+
+    private static final ObjectStreamField[] serialPersistentFields = {
+         new ObjectStreamField("ipaddress", byte[].class),
+         new ObjectStreamField("scope_id", int.class),
+         new ObjectStreamField("scope_id_set", boolean.class),
+         new ObjectStreamField("scope_ifname_set", boolean.class),
+         new ObjectStreamField("ifname", String.class)
+    };
+
+    private static final long FIELDS_OFFSET;
+    private static final sun.misc.Unsafe UNSAFE;
+
+    static {
+        try {
+            sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
+            FIELDS_OFFSET = unsafe.objectFieldOffset(
+                    Inet6Address.class.getDeclaredField("holder6"));
+            UNSAFE = unsafe;
+        } catch (ReflectiveOperationException e) {
+            throw new Error(e);
+        }
+    }
+
+    /**
      * restore the state of this object from stream
      * including the scope information, only if the
      * scoped interface name is valid on this system
      */
     private void readObject(ObjectInputStream s)
         throws IOException, ClassNotFoundException {
-        scope_ifname = null;
-        scope_ifname_set = false;
+        NetworkInterface scope_ifname = null;
 
+        // Android-changed: was getClass().getClassLoader() != null
         if (getClass().getClassLoader() != Class.class.getClassLoader()) {
             throw new SecurityException ("invalid address type");
         }
 
-        s.defaultReadObject();
+        ObjectInputStream.GetField gf = s.readFields();
+        byte[] ipaddress = (byte[])gf.get("ipaddress", null);
+        int scope_id = (int)gf.get("scope_id", -1);
+        boolean scope_id_set = (boolean)gf.get("scope_id_set", false);
+        boolean scope_ifname_set = (boolean)gf.get("scope_ifname_set", false);
+        String ifname = (String)gf.get("ifname", null);
 
         if (ifname != null && !"".equals (ifname)) {
             try {
@@ -442,8 +620,9 @@
                     scope_ifname_set = false;
                     scope_id = 0;
                 } else {
+                    scope_ifname_set = true;
                     try {
-                        scope_id = deriveNumericScope (scope_ifname);
+                        scope_id = deriveNumericScope (ipaddress, scope_ifname);
                     } catch (UnknownHostException e) {
                         // typically should not happen, but it may be that
                         // the machine being used for deserialization has
@@ -451,8 +630,8 @@
                     }
                 }
             } catch (SocketException e) {}
-
         }
+
         /* if ifname was not supplied, then the numeric info is used */
 
         ipaddress = ipaddress.clone();
@@ -466,6 +645,35 @@
         if (holder().getFamily() != AF_INET6) {
             throw new InvalidObjectException("invalid address family type");
         }
+
+        Inet6AddressHolder h = new Inet6AddressHolder(
+            ipaddress, scope_id, scope_id_set, scope_ifname, scope_ifname_set
+        );
+
+        UNSAFE.putObject(this, FIELDS_OFFSET, h);
+    }
+
+    /**
+     * default behavior is overridden in order to write the
+     * scope_ifname field as a String, rather than a NetworkInterface
+     * which is not serializable
+     */
+    private synchronized void writeObject(ObjectOutputStream s)
+        throws IOException
+    {
+            String ifname = null;
+
+        if (holder6.scope_ifname != null) {
+            ifname = holder6.scope_ifname.getName();
+            holder6.scope_ifname_set = true;
+        }
+        ObjectOutputStream.PutField pfields = s.putFields();
+        pfields.put("ipaddress", holder6.ipaddress);
+        pfields.put("scope_id", holder6.scope_id);
+        pfields.put("scope_id_set", holder6.scope_id_set);
+        pfields.put("scope_ifname_set", holder6.scope_ifname_set);
+        pfields.put("ifname", ifname);
+        s.writeFields();
     }
 
     /**
@@ -480,7 +688,7 @@
      */
     @Override
     public boolean isMulticastAddress() {
-        return ((ipaddress[0] & 0xff) == 0xff);
+        return holder6.isMulticastAddress();
     }
 
     /**
@@ -493,11 +701,7 @@
      */
     @Override
     public boolean isAnyLocalAddress() {
-        byte test = 0x00;
-        for (int i = 0; i < INADDRSZ; i++) {
-            test |= ipaddress[i];
-        }
-        return (test == 0x00);
+        return holder6.isAnyLocalAddress();
     }
 
     /**
@@ -510,11 +714,7 @@
      */
     @Override
     public boolean isLoopbackAddress() {
-        byte test = 0x00;
-        for (int i = 0; i < 15; i++) {
-            test |= ipaddress[i];
-        }
-        return (test == 0x00) && (ipaddress[15] == 0x01);
+        return holder6.isLoopbackAddress();
     }
 
     /**
@@ -522,10 +722,16 @@
      *
      * @return a {@code boolean} indicating if the InetAddress is a link local
      *         address; or false if address is not a link local unicast address.
+     *
      * @since 1.4
      */
     @Override
     public boolean isLinkLocalAddress() {
+        return holder6.isLinkLocalAddress();
+    }
+
+    /* static version of above */
+    static boolean isLinkLocalAddress(byte[] ipaddress) {
         return ((ipaddress[0] & 0xff) == 0xfe
                 && (ipaddress[1] & 0xc0) == 0x80);
     }
@@ -540,6 +746,11 @@
      */
     @Override
     public boolean isSiteLocalAddress() {
+        return holder6.isSiteLocalAddress();
+    }
+
+    /* static version of above */
+    static boolean isSiteLocalAddress(byte[] ipaddress) {
         return ((ipaddress[0] & 0xff) == 0xfe
                 && (ipaddress[1] & 0xc0) == 0xc0);
     }
@@ -555,8 +766,7 @@
      */
     @Override
     public boolean isMCGlobal() {
-        return ((ipaddress[0] & 0xff) == 0xff
-                && (ipaddress[1] & 0x0f) == 0x0e);
+        return holder6.isMCGlobal();
     }
 
     /**
@@ -570,8 +780,7 @@
      */
     @Override
     public boolean isMCNodeLocal() {
-        return ((ipaddress[0] & 0xff) == 0xff
-                && (ipaddress[1] & 0x0f) == 0x01);
+        return holder6.isMCNodeLocal();
     }
 
     /**
@@ -585,8 +794,7 @@
      */
     @Override
     public boolean isMCLinkLocal() {
-        return ((ipaddress[0] & 0xff) == 0xff
-                && (ipaddress[1] & 0x0f) == 0x02);
+        return holder6.isMCLinkLocal();
     }
 
     /**
@@ -600,35 +808,32 @@
      */
     @Override
     public boolean isMCSiteLocal() {
-        return ((ipaddress[0] & 0xff) == 0xff
-                && (ipaddress[1] & 0x0f) == 0x05);
+        return holder6.isMCSiteLocal();
     }
 
     /**
      * Utility routine to check if the multicast address has organization scope.
      *
-     * @return a {@code boolean} indicating if the address has
-     *         is a multicast address of organization-local scope,
-     *         false if it is not of organization-local scope
-     *         or it is not a multicast address
+     * @return a {@code boolean} indicating if the address has is a multicast
+     *         address of organization-local scope, false if it is not of
+     *         organization-local scope or it is not a multicast address
+     *
      * @since 1.4
      */
     @Override
     public boolean isMCOrgLocal() {
-        return ((ipaddress[0] & 0xff) == 0xff
-                && (ipaddress[1] & 0x0f) == 0x08);
+        return holder6.isMCOrgLocal();
     }
-
     /**
-     * Returns the raw IP address of this {@code InetAddress}
-     * object. The result is in network byte order: the highest order
-     * byte of the address is in {@code getAddress()[0]}.
+     * Returns the raw IP address of this {@code InetAddress} object. The result
+     * is in network byte order: the highest order byte of the address is in
+     * {@code getAddress()[0]}.
      *
      * @return  the raw IP address of this object.
      */
     @Override
     public byte[] getAddress() {
-        return ipaddress.clone();
+        return holder6.ipaddress.clone();
     }
 
     /**
@@ -636,10 +841,11 @@
      * an interface. If no scoped_id is set, the returned value is zero.
      *
      * @return the scopeId, or zero if not set.
+     *
      * @since 1.5
      */
-     public int getScopeId () {
-        return scope_id;
+     public int getScopeId() {
+        return holder6.scope_id;
      }
 
     /**
@@ -649,30 +855,25 @@
      * @return the scoped interface, or null if not set.
      * @since 1.5
      */
-     public NetworkInterface getScopedInterface () {
-        return scope_ifname;
+     public NetworkInterface getScopedInterface() {
+        return holder6.scope_ifname;
      }
 
     /**
-     * Returns the IP address string in textual presentation. If the instance was created
-     * specifying a scope identifier then the scope id is appended to the IP address preceded by
-     * a "%" (per-cent) character. This can be either a numeric value or a string, depending on which
-     * was used to createthe instance.
+     * Returns the IP address string in textual presentation. If the instance
+     * was created specifying a scope identifier then the scope id is appended
+     * to the IP address preceded by a "%" (per-cent) character. This can be
+     * either a numeric value or a string, depending on which was used to create
+     * the instance.
      *
      * @return  the raw IP address in a string format.
      */
     @Override
     public String getHostAddress() {
-
         /* ----- BEGIN android -----
-           getnameinfo returns smarter representations
-        String s = numericToTextFormat(ipaddress);
-        if (scope_ifname_set) {
-            s = s + "%" + scope_ifname.getName();
-        } else if (scope_id_set) {
-            s = s + "%" + scope_id;
-        }
-        return s;*/
+         * getnameinfo returns smarter representations
+        return holder6.getHostAddress();
+         */
 
         return Libcore.os.getnameinfo(this, NI_NUMERICHOST); // Can't throw.
         // ----- END android -----
@@ -685,81 +886,51 @@
      */
     @Override
     public int hashCode() {
-        if (ipaddress != null) {
-
-            int hash = 0;
-            int i=0;
-            while (i<INADDRSZ) {
-                int j=0;
-                int component=0;
-                while (j<4 && i<INADDRSZ) {
-                    component = (component << 8) + ipaddress[i];
-                    j++;
-                    i++;
-                }
-                hash += component;
-            }
-            return hash;
-
-        } else {
-            return 0;
-        }
+        return holder6.hashCode();
     }
 
     /**
-     * Compares this object against the specified object.
-     * The result is {@code true} if and only if the argument is
-     * not {@code null} and it represents the same IP address as
-     * this object.
-     * <p>
-     * Two instances of {@code InetAddress} represent the same IP
-     * address if the length of the byte arrays returned by
-     * {@code getAddress} is the same for both, and each of the
-     * array components is the same for the byte arrays.
+     * Compares this object against the specified object. The result is {@code
+     * true} if and only if the argument is not {@code null} and it represents
+     * the same IP address as this object.
+     *
+     * <p> Two instances of {@code InetAddress} represent the same IP address
+     * if the length of the byte arrays returned by {@code getAddress} is the
+     * same for both, and each of the array components is the same for the byte
+     * arrays.
      *
      * @param   obj   the object to compare against.
-     * @return  {@code true} if the objects are the same;
-     *          {@code false} otherwise.
+     *
+     * @return  {@code true} if the objects are the same; {@code false} otherwise.
+     *
      * @see     java.net.InetAddress#getAddress()
      */
     @Override
     public boolean equals(Object obj) {
-        if (obj == null ||
-            !(obj instanceof Inet6Address))
+        if (obj == null || !(obj instanceof Inet6Address))
             return false;
 
         Inet6Address inetAddr = (Inet6Address)obj;
 
-        for (int i = 0; i < INADDRSZ; i++) {
-            if (ipaddress[i] != inetAddr.ipaddress[i])
-                return false;
-        }
-
-        return true;
+        return holder6.equals(inetAddr.holder6);
     }
 
     /**
      * Utility routine to check if the InetAddress is an
      * IPv4 compatible IPv6 address.
      *
-     * @return a {@code boolean} indicating if the InetAddress is
-     * an IPv4 compatible IPv6 address; or false if address is IPv4 address.
+     * @return a {@code boolean} indicating if the InetAddress is an IPv4
+     *         compatible IPv6 address; or false if address is IPv4 address.
+     *
      * @since 1.4
      */
     public boolean isIPv4CompatibleAddress() {
-        if ((ipaddress[0] == 0x00) && (ipaddress[1] == 0x00) &&
-            (ipaddress[2] == 0x00) && (ipaddress[3] == 0x00) &&
-            (ipaddress[4] == 0x00) && (ipaddress[5] == 0x00) &&
-            (ipaddress[6] == 0x00) && (ipaddress[7] == 0x00) &&
-            (ipaddress[8] == 0x00) && (ipaddress[9] == 0x00) &&
-            (ipaddress[10] == 0x00) && (ipaddress[11] == 0x00))  {
-            return true;
-        }
-        return false;
+        return holder6.isIPv4CompatibleAddress();
     }
 
     // Utilities
     private final static int INT16SZ = 2;
+
     /*
      * Convert IPv6 binary address into presentation (printable) format.
      *
@@ -768,36 +939,15 @@
      *         textual representation format
      * @since 1.4
      */
-    static String numericToTextFormat(byte[] src)
-    {
-        StringBuffer sb = new StringBuffer(39);
+    static String numericToTextFormat(byte[] src) {
+        StringBuilder sb = new StringBuilder(39);
         for (int i = 0; i < (INADDRSZ / INT16SZ); i++) {
             sb.append(Integer.toHexString(((src[i<<1]<<8) & 0xff00)
                                           | (src[(i<<1)+1] & 0xff)));
-
             if (i < (INADDRSZ / INT16SZ) -1 ) {
                sb.append(":");
             }
         }
         return sb.toString();
     }
-
-    /**
-     * Following field is only used during (de)/serialization
-     */
-    private String ifname;
-
-    /**
-     * default behavior is overridden in order to write the
-     * scope_ifname field as a String, rather than a NetworkInterface
-     * which is not serializable
-     */
-    private synchronized void writeObject(java.io.ObjectOutputStream s)
-        throws IOException
-    {
-        if (scope_ifname_set) {
-            ifname = scope_ifname.getName();
-        }
-        s.defaultWriteObject();
-    }
 }
diff --git a/ojluni/src/main/java/java/net/InetAddress.java b/ojluni/src/main/java/java/net/InetAddress.java
index edfdb00..b5dc761 100644
--- a/ojluni/src/main/java/java/net/InetAddress.java
+++ b/ojluni/src/main/java/java/net/InetAddress.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, 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
@@ -208,6 +208,14 @@
             this.family = family;
         }
 
+        void init(String hostName, int family) {
+            this.originalHostName = hostName;
+            this.hostName = hostName;
+            if (family != -1) {
+                this.family = family;
+            }
+        }
+
         String hostName;
 
         String getHostName() {
diff --git a/ojluni/src/main/java/java/security/cert/CRLException.java b/ojluni/src/main/java/java/security/cert/CRLException.java
index ca5b689..7a85431 100644
--- a/ojluni/src/main/java/java/security/cert/CRLException.java
+++ b/ojluni/src/main/java/java/security/cert/CRLException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -57,13 +57,13 @@
     }
 
     /**
-     * Creates a <code>CRLException</code> with the specified
+     * Creates a {@code CRLException} with the specified
      * detail message and cause.
      *
      * @param message the detail message (which is saved for later retrieval
      *        by the {@link #getMessage()} method).
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
@@ -72,13 +72,13 @@
     }
 
     /**
-     * Creates a <code>CRLException</code> with the specified cause
-     * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+     * Creates a {@code CRLException} with the specified cause
+     * and a detail message of {@code (cause==null ? null : cause.toString())}
      * (which typically contains the class and detail message of
-     * <tt>cause</tt>).
+     * {@code cause}).
      *
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
diff --git a/ojluni/src/main/java/java/security/cert/CRLSelector.java b/ojluni/src/main/java/java/security/cert/CRLSelector.java
index 2c00f10..7ab181d 100644
--- a/ojluni/src/main/java/java/security/cert/CRLSelector.java
+++ b/ojluni/src/main/java/java/security/cert/CRLSelector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,9 +26,9 @@
 package java.security.cert;
 
 /**
- * A selector that defines a set of criteria for selecting <code>CRL</code>s.
+ * A selector that defines a set of criteria for selecting {@code CRL}s.
  * Classes that implement this interface are often used to specify
- * which <code>CRL</code>s should be retrieved from a <code>CertStore</code>.
+ * which {@code CRL}s should be retrieved from a {@code CertStore}.
  * <p>
  * <b>Concurrent Access</b>
  * <p>
@@ -48,19 +48,19 @@
 public interface CRLSelector extends Cloneable {
 
     /**
-     * Decides whether a <code>CRL</code> should be selected.
+     * Decides whether a {@code CRL} should be selected.
      *
-     * @param   crl     the <code>CRL</code> to be checked
-     * @return  <code>true</code> if the <code>CRL</code> should be selected,
-     * <code>false</code> otherwise
+     * @param   crl     the {@code CRL} to be checked
+     * @return  {@code true} if the {@code CRL} should be selected,
+     * {@code false} otherwise
      */
     boolean match(CRL crl);
 
     /**
-     * Makes a copy of this <code>CRLSelector</code>. Changes to the
+     * Makes a copy of this {@code CRLSelector}. Changes to the
      * copy will not affect the original and vice versa.
      *
-     * @return a copy of this <code>CRLSelector</code>
+     * @return a copy of this {@code CRLSelector}
      */
     Object clone();
 }
diff --git a/ojluni/src/main/java/java/security/cert/CertPath.java b/ojluni/src/main/java/java/security/cert/CertPath.java
index 600000a..f742664 100644
--- a/ojluni/src/main/java/java/security/cert/CertPath.java
+++ b/ojluni/src/main/java/java/security/cert/CertPath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, 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
@@ -36,59 +36,59 @@
  * An immutable sequence of certificates (a certification path).
  * <p>
  * This is an abstract class that defines the methods common to all
- * <code>CertPath</code>s. Subclasses can handle different kinds of
+ * {@code CertPath}s. Subclasses can handle different kinds of
  * certificates (X.509, PGP, etc.).
  * <p>
- * All <code>CertPath</code> objects have a type, a list of
- * <code>Certificate</code>s, and one or more supported encodings. Because the
- * <code>CertPath</code> class is immutable, a <code>CertPath</code> cannot
+ * All {@code CertPath} objects have a type, a list of
+ * {@code Certificate}s, and one or more supported encodings. Because the
+ * {@code CertPath} class is immutable, a {@code CertPath} cannot
  * change in any externally visible way after being constructed. This
  * stipulation applies to all public fields and methods of this class and any
  * added or overridden by subclasses.
  * <p>
- * The type is a <code>String</code> that identifies the type of
- * <code>Certificate</code>s in the certification path. For each
- * certificate <code>cert</code> in a certification path <code>certPath</code>,
- * <code>cert.getType().equals(certPath.getType())</code> must be
- * <code>true</code>.
+ * The type is a {@code String} that identifies the type of
+ * {@code Certificate}s in the certification path. For each
+ * certificate {@code cert} in a certification path {@code certPath},
+ * {@code cert.getType().equals(certPath.getType())} must be
+ * {@code true}.
  * <p>
- * The list of <code>Certificate</code>s is an ordered <code>List</code> of
- * zero or more <code>Certificate</code>s. This <code>List</code> and all
- * of the <code>Certificate</code>s contained in it must be immutable.
+ * The list of {@code Certificate}s is an ordered {@code List} of
+ * zero or more {@code Certificate}s. This {@code List} and all
+ * of the {@code Certificate}s contained in it must be immutable.
  * <p>
- * Each <code>CertPath</code> object must support one or more encodings
+ * Each {@code CertPath} object must support one or more encodings
  * so that the object can be translated into a byte array for storage or
  * transmission to other parties. Preferably, these encodings should be
  * well-documented standards (such as PKCS#7). One of the encodings supported
- * by a <code>CertPath</code> is considered the default encoding. This
+ * by a {@code CertPath} is considered the default encoding. This
  * encoding is used if no encoding is explicitly requested (for the
  * {@link #getEncoded() getEncoded()} method, for instance).
  * <p>
- * All <code>CertPath</code> objects are also <code>Serializable</code>.
- * <code>CertPath</code> objects are resolved into an alternate
+ * All {@code CertPath} objects are also {@code Serializable}.
+ * {@code CertPath} objects are resolved into an alternate
  * {@link CertPathRep CertPathRep} object during serialization. This allows
- * a <code>CertPath</code> object to be serialized into an equivalent
+ * a {@code CertPath} object to be serialized into an equivalent
  * representation regardless of its underlying implementation.
  * <p>
- * <code>CertPath</code> objects can be created with a
- * <code>CertificateFactory</code> or they can be returned by other classes,
- * such as a <code>CertPathBuilder</code>.
+ * {@code CertPath} objects can be created with a
+ * {@code CertificateFactory} or they can be returned by other classes,
+ * such as a {@code CertPathBuilder}.
  * <p>
- * By convention, X.509 <code>CertPath</code>s (consisting of
- * <code>X509Certificate</code>s), are ordered starting with the target
+ * By convention, X.509 {@code CertPath}s (consisting of
+ * {@code X509Certificate}s), are ordered starting with the target
  * certificate and ending with a certificate issued by the trust anchor. That
  * is, the issuer of one certificate is the subject of the following one. The
  * certificate representing the {@link TrustAnchor TrustAnchor} should not be
- * included in the certification path. Unvalidated X.509 <code>CertPath</code>s
- * may not follow these conventions. PKIX <code>CertPathValidator</code>s will
+ * included in the certification path. Unvalidated X.509 {@code CertPath}s
+ * may not follow these conventions. PKIX {@code CertPathValidator}s will
  * detect any departure from these conventions that cause the certification
- * path to be invalid and throw a <code>CertPathValidatorException</code>.
+ * path to be invalid and throw a {@code CertPathValidatorException}.
  *
  * <p> Every implementation of the Java platform is required to support the
- * following standard <code>CertPath</code> encodings:
+ * following standard {@code CertPath} encodings:
  * <ul>
- * <li><tt>PKCS7</tt></li>
- * <li><tt>PkiPath</tt></li>
+ * <li>{@code PKCS7}</li>
+ * <li>{@code PkiPath}</li>
  * </ul>
  * These encodings are described in the <a href=
  * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertPathEncodings">
@@ -99,17 +99,17 @@
  * <p>
  * <b>Concurrent Access</b>
  * <p>
- * All <code>CertPath</code> objects must be thread-safe. That is, multiple
+ * All {@code CertPath} objects must be thread-safe. That is, multiple
  * threads may concurrently invoke the methods defined in this class on a
- * single <code>CertPath</code> object (or more than one) with no
- * ill effects. This is also true for the <code>List</code> returned by
- * <code>CertPath.getCertificates</code>.
+ * single {@code CertPath} object (or more than one) with no
+ * ill effects. This is also true for the {@code List} returned by
+ * {@code CertPath.getCertificates}.
  * <p>
- * Requiring <code>CertPath</code> objects to be immutable and thread-safe
+ * Requiring {@code CertPath} objects to be immutable and thread-safe
  * allows them to be passed around to various pieces of code without worrying
  * about coordinating access.  Providing this thread-safety is
- * generally not difficult, since the <code>CertPath</code> and
- * <code>List</code> objects in question are immutable.
+ * generally not difficult, since the {@code CertPath} and
+ * {@code List} objects in question are immutable.
  *
  * @see CertificateFactory
  * @see CertPathBuilder
@@ -124,25 +124,25 @@
     private String type;        // the type of certificates in this chain
 
     /**
-     * Creates a <code>CertPath</code> of the specified type.
+     * Creates a {@code CertPath} of the specified type.
      * <p>
      * This constructor is protected because most users should use a
-     * <code>CertificateFactory</code> to create <code>CertPath</code>s.
+     * {@code CertificateFactory} to create {@code CertPath}s.
      *
      * @param type the standard name of the type of
-     * <code>Certificate</code>s in this path
+     * {@code Certificate}s in this path
      */
     protected CertPath(String type) {
         this.type = type;
     }
 
     /**
-     * Returns the type of <code>Certificate</code>s in this certification
+     * Returns the type of {@code Certificate}s in this certification
      * path. This is the same string that would be returned by
      * {@link java.security.cert.Certificate#getType() cert.getType()}
-     * for all <code>Certificate</code>s in the certification path.
+     * for all {@code Certificate}s in the certification path.
      *
-     * @return the type of <code>Certificate</code>s in this certification
+     * @return the type of {@code Certificate}s in this certification
      * path (never null)
      */
     public String getType() {
@@ -152,21 +152,21 @@
     /**
      * Returns an iteration of the encodings supported by this certification
      * path, with the default encoding first. Attempts to modify the returned
-     * <code>Iterator</code> via its <code>remove</code> method result in an
-     * <code>UnsupportedOperationException</code>.
+     * {@code Iterator} via its {@code remove} method result in an
+     * {@code UnsupportedOperationException}.
      *
-     * @return an <code>Iterator</code> over the names of the supported
+     * @return an {@code Iterator} over the names of the supported
      *         encodings (as Strings)
      */
     public abstract Iterator<String> getEncodings();
 
     /**
      * Compares this certification path for equality with the specified
-     * object. Two <code>CertPath</code>s are equal if and only if their
-     * types are equal and their certificate <code>List</code>s (and by
-     * implication the <code>Certificate</code>s in those <code>List</code>s)
-     * are equal. A <code>CertPath</code> is never equal to an object that is
-     * not a <code>CertPath</code>.
+     * object. Two {@code CertPath}s are equal if and only if their
+     * types are equal and their certificate {@code List}s (and by
+     * implication the {@code Certificate}s in those {@code List}s)
+     * are equal. A {@code CertPath} is never equal to an object that is
+     * not a {@code CertPath}.
      * <p>
      * This algorithm is implemented by this method. If it is overridden,
      * the behavior specified here must be maintained.
@@ -195,14 +195,14 @@
      * Returns the hashcode for this certification path. The hash code of
      * a certification path is defined to be the result of the following
      * calculation:
-     * <pre><code>
+     * <pre>{@code
      *  hashCode = path.getType().hashCode();
      *  hashCode = 31*hashCode + path.getCertificates().hashCode();
-     * </code></pre>
-     * This ensures that <code>path1.equals(path2)</code> implies that
-     * <code>path1.hashCode()==path2.hashCode()</code> for any two certification
-     * paths, <code>path1</code> and <code>path2</code>, as required by the
-     * general contract of <code>Object.hashCode</code>.
+     * }</pre>
+     * This ensures that {@code path1.equals(path2)} implies that
+     * {@code path1.hashCode()==path2.hashCode()} for any two certification
+     * paths, {@code path1} and {@code path2}, as required by the
+     * general contract of {@code Object.hashCode}.
      *
      * @return the hashcode value for this certification path
      */
@@ -214,8 +214,8 @@
 
     /**
      * Returns a string representation of this certification path.
-     * This calls the <code>toString</code> method on each of the
-     * <code>Certificate</code>s in the path.
+     * This calls the {@code toString} method on each of the
+     * {@code Certificate}s in the path.
      *
      * @return a string representation of this certification path
      */
@@ -266,20 +266,20 @@
 
     /**
      * Returns the list of certificates in this certification path.
-     * The <code>List</code> returned must be immutable and thread-safe.
+     * The {@code List} returned must be immutable and thread-safe.
      *
-     * @return an immutable <code>List</code> of <code>Certificate</code>s
+     * @return an immutable {@code List} of {@code Certificate}s
      *         (may be empty, but not null)
      */
     public abstract List<? extends Certificate> getCertificates();
 
     /**
-     * Replaces the <code>CertPath</code> to be serialized with a
-     * <code>CertPathRep</code> object.
+     * Replaces the {@code CertPath} to be serialized with a
+     * {@code CertPathRep} object.
      *
-     * @return the <code>CertPathRep</code> to be serialized
+     * @return the {@code CertPathRep} to be serialized
      *
-     * @throws ObjectStreamException if a <code>CertPathRep</code> object
+     * @throws ObjectStreamException if a {@code CertPathRep} object
      * representing this certification path could not be created
      */
     protected Object writeReplace() throws ObjectStreamException {
@@ -295,7 +295,7 @@
     }
 
     /**
-     * Alternate <code>CertPath</code> class for serialization.
+     * Alternate {@code CertPath} class for serialization.
      * @since 1.4
      */
     protected static class CertPathRep implements Serializable {
@@ -308,10 +308,10 @@
         private byte[] data;
 
         /**
-         * Creates a <code>CertPathRep</code> with the specified
+         * Creates a {@code CertPathRep} with the specified
          * type and encoded form of a certification path.
          *
-         * @param type the standard name of a <code>CertPath</code> type
+         * @param type the standard name of a {@code CertPath} type
          * @param data the encoded form of the certification path
          */
         protected CertPathRep(String type, byte[] data) {
@@ -320,11 +320,11 @@
         }
 
         /**
-         * Returns a <code>CertPath</code> constructed from the type and data.
+         * Returns a {@code CertPath} constructed from the type and data.
          *
-         * @return the resolved <code>CertPath</code> object
+         * @return the resolved {@code CertPath} object
          *
-         * @throws ObjectStreamException if a <code>CertPath</code> could not
+         * @throws ObjectStreamException if a {@code CertPath} could not
          * be constructed
          */
         protected Object readResolve() throws ObjectStreamException {
diff --git a/ojluni/src/main/java/java/security/cert/CertPathParameters.java b/ojluni/src/main/java/java/security/cert/CertPathParameters.java
index 46f9d88..ace1b21 100644
--- a/ojluni/src/main/java/java/security/cert/CertPathParameters.java
+++ b/ojluni/src/main/java/java/security/cert/CertPathParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -28,8 +28,8 @@
 /**
  * A specification of certification path algorithm parameters.
  * The purpose of this interface is to group (and provide type safety for)
- * all <code>CertPath</code> parameter specifications. All
- * <code>CertPath</code> parameter specifications must implement this
+ * all {@code CertPath} parameter specifications. All
+ * {@code CertPath} parameter specifications must implement this
  * interface.
  *
  * @author      Yassir Elley
@@ -40,10 +40,10 @@
 public interface CertPathParameters extends Cloneable {
 
   /**
-   * Makes a copy of this <code>CertPathParameters</code>. Changes to the
+   * Makes a copy of this {@code CertPathParameters}. Changes to the
    * copy will not affect the original and vice versa.
    *
-   * @return a copy of this <code>CertPathParameters</code>
+   * @return a copy of this {@code CertPathParameters}
    */
   Object clone();
 }
diff --git a/ojluni/src/main/java/java/security/cert/CertSelector.java b/ojluni/src/main/java/java/security/cert/CertSelector.java
index 5ee1f71..a06cc84 100644
--- a/ojluni/src/main/java/java/security/cert/CertSelector.java
+++ b/ojluni/src/main/java/java/security/cert/CertSelector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -27,9 +27,9 @@
 
 /**
  * A selector that defines a set of criteria for selecting
- * <code>Certificate</code>s. Classes that implement this interface
- * are often used to specify which <code>Certificate</code>s should
- * be retrieved from a <code>CertStore</code>.
+ * {@code Certificate}s. Classes that implement this interface
+ * are often used to specify which {@code Certificate}s should
+ * be retrieved from a {@code CertStore}.
  * <p>
  * <b>Concurrent Access</b>
  * <p>
@@ -49,19 +49,19 @@
 public interface CertSelector extends Cloneable {
 
     /**
-     * Decides whether a <code>Certificate</code> should be selected.
+     * Decides whether a {@code Certificate} should be selected.
      *
-     * @param   cert    the <code>Certificate</code> to be checked
-     * @return  <code>true</code> if the <code>Certificate</code>
-     * should be selected, <code>false</code> otherwise
+     * @param   cert    the {@code Certificate} to be checked
+     * @return  {@code true} if the {@code Certificate}
+     * should be selected, {@code false} otherwise
      */
     boolean match(Certificate cert);
 
     /**
-     * Makes a copy of this <code>CertSelector</code>. Changes to the
+     * Makes a copy of this {@code CertSelector}. Changes to the
      * copy will not affect the original and vice versa.
      *
-     * @return a copy of this <code>CertSelector</code>
+     * @return a copy of this {@code CertSelector}
      */
     Object clone();
 }
diff --git a/ojluni/src/main/java/java/security/cert/CertStore.java b/ojluni/src/main/java/java/security/cert/CertStore.java
index bc02510..add36cd 100644
--- a/ojluni/src/main/java/java/security/cert/CertStore.java
+++ b/ojluni/src/main/java/java/security/cert/CertStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, 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
@@ -38,25 +38,25 @@
 import sun.security.jca.GetInstance.Instance;
 
 /**
- * A class for retrieving <code>Certificate</code>s and <code>CRL</code>s
+ * A class for retrieving {@code Certificate}s and {@code CRL}s
  * from a repository.
  * <p>
  * This class uses a provider-based architecture.
- * To create a <code>CertStore</code>, call one of the static
- * <code>getInstance</code> methods, passing in the type of
- * <code>CertStore</code> desired, any applicable initialization parameters
+ * To create a {@code CertStore}, call one of the static
+ * {@code getInstance} methods, passing in the type of
+ * {@code CertStore} desired, any applicable initialization parameters
  * and optionally the name of the provider desired.
  * <p>
- * Once the <code>CertStore</code> has been created, it can be used to
- * retrieve <code>Certificate</code>s and <code>CRL</code>s by calling its
+ * Once the {@code CertStore} has been created, it can be used to
+ * retrieve {@code Certificate}s and {@code CRL}s by calling its
  * {@link #getCertificates(CertSelector selector) getCertificates} and
  * {@link #getCRLs(CRLSelector selector) getCRLs} methods.
  * <p>
  * Unlike a {@link java.security.KeyStore KeyStore}, which provides access
  * to a cache of private keys and trusted certificates, a
- * <code>CertStore</code> is designed to provide access to a potentially
+ * {@code CertStore} is designed to provide access to a potentially
  * vast repository of untrusted certificates and CRLs. For example, an LDAP
- * implementation of <code>CertStore</code> provides access to certificates
+ * implementation of {@code CertStore} provides access to certificates
  * and CRLs stored in one or more directories using the LDAP protocol and the
  * schema as defined in the RFC service attribute.
  *
@@ -84,10 +84,10 @@
  * <p>
  * <b>Concurrent Access</b>
  * <p>
- * All public methods of <code>CertStore</code> objects must be thread-safe.
+ * All public methods of {@code CertStore} objects must be thread-safe.
  * That is, multiple threads may concurrently invoke these methods on a
- * single <code>CertStore</code> object (or more than one) with no
- * ill effects. This allows a <code>CertPathBuilder</code> to search for a
+ * single {@code CertStore} object (or more than one) with no
+ * ill effects. This allows a {@code CertPathBuilder} to search for a
  * CRL while simultaneously searching for further certificates, for instance.
  * <p>
  * The static methods of this class are also guaranteed to be thread-safe.
@@ -113,13 +113,13 @@
     private CertStoreParameters params;
 
     /**
-     * Creates a <code>CertStore</code> object of the given type, and
+     * Creates a {@code CertStore} object of the given type, and
      * encapsulates the given provider implementation (SPI object) in it.
      *
      * @param storeSpi the provider implementation
      * @param provider the provider
      * @param type the type
-     * @param params the initialization parameters (may be <code>null</code>)
+     * @param params the initialization parameters (may be {@code null})
      */
     protected CertStore(CertStoreSpi storeSpi, Provider provider,
                         String type, CertStoreParameters params) {
@@ -131,28 +131,28 @@
     }
 
     /**
-     * Returns a <code>Collection</code> of <code>Certificate</code>s that
-     * match the specified selector. If no <code>Certificate</code>s
-     * match the selector, an empty <code>Collection</code> will be returned.
+     * Returns a {@code Collection} of {@code Certificate}s that
+     * match the specified selector. If no {@code Certificate}s
+     * match the selector, an empty {@code Collection} will be returned.
      * <p>
-     * For some <code>CertStore</code> types, the resulting
-     * <code>Collection</code> may not contain <b>all</b> of the
-     * <code>Certificate</code>s that match the selector. For instance,
-     * an LDAP <code>CertStore</code> may not search all entries in the
+     * For some {@code CertStore} types, the resulting
+     * {@code Collection} may not contain <b>all</b> of the
+     * {@code Certificate}s that match the selector. For instance,
+     * an LDAP {@code CertStore} may not search all entries in the
      * directory. Instead, it may just search entries that are likely to
-     * contain the <code>Certificate</code>s it is looking for.
+     * contain the {@code Certificate}s it is looking for.
      * <p>
-     * Some <code>CertStore</code> implementations (especially LDAP
-     * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
-     * unless a non-null <code>CertSelector</code> is provided that
+     * Some {@code CertStore} implementations (especially LDAP
+     * {@code CertStore}s) may throw a {@code CertStoreException}
+     * unless a non-null {@code CertSelector} is provided that
      * includes specific criteria that can be used to find the certificates.
      * Issuer and/or subject names are especially useful criteria.
      *
-     * @param selector A <code>CertSelector</code> used to select which
-     *  <code>Certificate</code>s should be returned. Specify <code>null</code>
-     *  to return all <code>Certificate</code>s (if supported).
-     * @return A <code>Collection</code> of <code>Certificate</code>s that
-     *         match the specified selector (never <code>null</code>)
+     * @param selector A {@code CertSelector} used to select which
+     *  {@code Certificate}s should be returned. Specify {@code null}
+     *  to return all {@code Certificate}s (if supported).
+     * @return A {@code Collection} of {@code Certificate}s that
+     *         match the specified selector (never {@code null})
      * @throws CertStoreException if an exception occurs
      */
     public final Collection<? extends Certificate> getCertificates
@@ -161,28 +161,28 @@
     }
 
     /**
-     * Returns a <code>Collection</code> of <code>CRL</code>s that
-     * match the specified selector. If no <code>CRL</code>s
-     * match the selector, an empty <code>Collection</code> will be returned.
+     * Returns a {@code Collection} of {@code CRL}s that
+     * match the specified selector. If no {@code CRL}s
+     * match the selector, an empty {@code Collection} will be returned.
      * <p>
-     * For some <code>CertStore</code> types, the resulting
-     * <code>Collection</code> may not contain <b>all</b> of the
-     * <code>CRL</code>s that match the selector. For instance,
-     * an LDAP <code>CertStore</code> may not search all entries in the
+     * For some {@code CertStore} types, the resulting
+     * {@code Collection} may not contain <b>all</b> of the
+     * {@code CRL}s that match the selector. For instance,
+     * an LDAP {@code CertStore} may not search all entries in the
      * directory. Instead, it may just search entries that are likely to
-     * contain the <code>CRL</code>s it is looking for.
+     * contain the {@code CRL}s it is looking for.
      * <p>
-     * Some <code>CertStore</code> implementations (especially LDAP
-     * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
-     * unless a non-null <code>CRLSelector</code> is provided that
+     * Some {@code CertStore} implementations (especially LDAP
+     * {@code CertStore}s) may throw a {@code CertStoreException}
+     * unless a non-null {@code CRLSelector} is provided that
      * includes specific criteria that can be used to find the CRLs.
      * Issuer names and/or the certificate to be checked are especially useful.
      *
-     * @param selector A <code>CRLSelector</code> used to select which
-     *  <code>CRL</code>s should be returned. Specify <code>null</code>
-     *  to return all <code>CRL</code>s (if supported).
-     * @return A <code>Collection</code> of <code>CRL</code>s that
-     *         match the specified selector (never <code>null</code>)
+     * @param selector A {@code CRLSelector} used to select which
+     *  {@code CRL}s should be returned. Specify {@code null}
+     *  to return all {@code CRL}s (if supported).
+     * @return A {@code Collection} of {@code CRL}s that
+     *         match the specified selector (never {@code null})
      * @throws CertStoreException if an exception occurs
      */
     public final Collection<? extends CRL> getCRLs(CRLSelector selector)
@@ -191,8 +191,8 @@
     }
 
     /**
-     * Returns a <code>CertStore</code> object that implements the specified
-     * <code>CertStore</code> type and is initialized with the specified
+     * Returns a {@code CertStore} object that implements the specified
+     * {@code CertStore} type and is initialized with the specified
      * parameters.
      *
      * <p> This method traverses the list of registered security Providers,
@@ -204,29 +204,29 @@
      * <p> Note that the list of registered providers may be retrieved via
      * the {@link Security#getProviders() Security.getProviders()} method.
      *
-     * <p>The <code>CertStore</code> that is returned is initialized with the
-     * specified <code>CertStoreParameters</code>. The type of parameters
-     * needed may vary between different types of <code>CertStore</code>s.
-     * Note that the specified <code>CertStoreParameters</code> object is
+     * <p>The {@code CertStore} that is returned is initialized with the
+     * specified {@code CertStoreParameters}. The type of parameters
+     * needed may vary between different types of {@code CertStore}s.
+     * Note that the specified {@code CertStoreParameters} object is
      * cloned.
      *
-     * @param type the name of the requested <code>CertStore</code> type.
+     * @param type the name of the requested {@code CertStore} type.
      * See the CertStore section in the <a href=
      * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertStore">
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard types.
      *
-     * @param params the initialization parameters (may be <code>null</code>).
+     * @param params the initialization parameters (may be {@code null}).
      *
-     * @return a <code>CertStore</code> object that implements the specified
-     *          <code>CertStore</code> type.
+     * @return a {@code CertStore} object that implements the specified
+     *          {@code CertStore} type.
      *
      * @throws NoSuchAlgorithmException if no Provider supports a
      *          CertStoreSpi implementation for the specified type.
      *
      * @throws InvalidAlgorithmParameterException if the specified
      *          initialization parameters are inappropriate for this
-     *          <code>CertStore</code>.
+     *          {@code CertStore}.
      *
      * @see java.security.Provider
      */
@@ -253,8 +253,8 @@
     }
 
     /**
-     * Returns a <code>CertStore</code> object that implements the specified
-     * <code>CertStore</code> type.
+     * Returns a {@code CertStore} object that implements the specified
+     * {@code CertStore} type.
      *
      * <p> A new CertStore object encapsulating the
      * CertStoreSpi implementation from the specified provider
@@ -264,23 +264,23 @@
      * <p> Note that the list of registered providers may be retrieved via
      * the {@link Security#getProviders() Security.getProviders()} method.
      *
-     * <p>The <code>CertStore</code> that is returned is initialized with the
-     * specified <code>CertStoreParameters</code>. The type of parameters
-     * needed may vary between different types of <code>CertStore</code>s.
-     * Note that the specified <code>CertStoreParameters</code> object is
+     * <p>The {@code CertStore} that is returned is initialized with the
+     * specified {@code CertStoreParameters}. The type of parameters
+     * needed may vary between different types of {@code CertStore}s.
+     * Note that the specified {@code CertStoreParameters} object is
      * cloned.
      *
-     * @param type the requested <code>CertStore</code> type.
+     * @param type the requested {@code CertStore} type.
      * See the CertStore section in the <a href=
      * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertStore">
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard types.
      *
-     * @param params the initialization parameters (may be <code>null</code>).
+     * @param params the initialization parameters (may be {@code null}).
      *
      * @param provider the name of the provider.
      *
-     * @return a <code>CertStore</code> object that implements the
+     * @return a {@code CertStore} object that implements the
      *          specified type.
      *
      * @throws NoSuchAlgorithmException if a CertStoreSpi
@@ -289,12 +289,12 @@
      *
      * @throws InvalidAlgorithmParameterException if the specified
      *          initialization parameters are inappropriate for this
-     *          <code>CertStore</code>.
+     *          {@code CertStore}.
      *
      * @throws NoSuchProviderException if the specified provider is not
      *          registered in the security provider list.
      *
-     * @exception IllegalArgumentException if the <code>provider</code> is
+     * @exception IllegalArgumentException if the {@code provider} is
      *          null or empty.
      *
      * @see java.security.Provider
@@ -314,31 +314,31 @@
     }
 
     /**
-     * Returns a <code>CertStore</code> object that implements the specified
-     * <code>CertStore</code> type.
+     * Returns a {@code CertStore} object that implements the specified
+     * {@code CertStore} type.
      *
      * <p> A new CertStore object encapsulating the
      * CertStoreSpi implementation from the specified Provider
      * object is returned.  Note that the specified Provider object
      * does not have to be registered in the provider list.
      *
-     * <p>The <code>CertStore</code> that is returned is initialized with the
-     * specified <code>CertStoreParameters</code>. The type of parameters
-     * needed may vary between different types of <code>CertStore</code>s.
-     * Note that the specified <code>CertStoreParameters</code> object is
+     * <p>The {@code CertStore} that is returned is initialized with the
+     * specified {@code CertStoreParameters}. The type of parameters
+     * needed may vary between different types of {@code CertStore}s.
+     * Note that the specified {@code CertStoreParameters} object is
      * cloned.
      *
-     * @param type the requested <code>CertStore</code> type.
+     * @param type the requested {@code CertStore} type.
      * See the CertStore section in the <a href=
      * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertStore">
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard types.
      *
-     * @param params the initialization parameters (may be <code>null</code>).
+     * @param params the initialization parameters (may be {@code null}).
      *
      * @param provider the provider.
      *
-     * @return a <code>CertStore</code> object that implements the
+     * @return a {@code CertStore} object that implements the
      *          specified type.
      *
      * @exception NoSuchAlgorithmException if a CertStoreSpi
@@ -347,9 +347,9 @@
      *
      * @throws InvalidAlgorithmParameterException if the specified
      *          initialization parameters are inappropriate for this
-     *          <code>CertStore</code>
+     *          {@code CertStore}
      *
-     * @exception IllegalArgumentException if the <code>provider</code> is
+     * @exception IllegalArgumentException if the {@code provider} is
      *          null.
      *
      * @see java.security.Provider
@@ -368,55 +368,53 @@
     }
 
     /**
-     * Returns the parameters used to initialize this <code>CertStore</code>.
-     * Note that the <code>CertStoreParameters</code> object is cloned before
+     * Returns the parameters used to initialize this {@code CertStore}.
+     * Note that the {@code CertStoreParameters} object is cloned before
      * it is returned.
      *
-     * @return the parameters used to initialize this <code>CertStore</code>
-     * (may be <code>null</code>)
+     * @return the parameters used to initialize this {@code CertStore}
+     * (may be {@code null})
      */
     public final CertStoreParameters getCertStoreParameters() {
         return (params == null ? null : (CertStoreParameters) params.clone());
     }
 
     /**
-     * Returns the type of this <code>CertStore</code>.
+     * Returns the type of this {@code CertStore}.
      *
-     * @return the type of this <code>CertStore</code>
+     * @return the type of this {@code CertStore}
      */
     public final String getType() {
         return this.type;
     }
 
     /**
-     * Returns the provider of this <code>CertStore</code>.
+     * Returns the provider of this {@code CertStore}.
      *
-     * @return the provider of this <code>CertStore</code>
+     * @return the provider of this {@code CertStore}
      */
     public final Provider getProvider() {
         return this.provider;
     }
 
     /**
-     * Returns the default <code>CertStore</code> type as specified in the
-     * Java security properties file, or the string &quot;LDAP&quot; if no
-     * such property exists. The Java security properties file is located in
-     * the file named &lt;JAVA_HOME&gt;/lib/security/java.security.
-     * &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
-     * and specifies the directory where the JRE is installed.
+     * Returns the default {@code CertStore} type as specified by the
+     * {@code certstore.type} security property, or the string
+     * {@literal "LDAP"} if no such property exists.
      *
-     * <p>The default <code>CertStore</code> type can be used by applications
+     * <p>The default {@code CertStore} type can be used by applications
      * that do not want to use a hard-coded type when calling one of the
-     * <code>getInstance</code> methods, and want to provide a default
-     * <code>CertStore</code> type in case a user does not specify its own.
+     * {@code getInstance} methods, and want to provide a default
+     * {@code CertStore} type in case a user does not specify its own.
      *
-     * <p>The default <code>CertStore</code> type can be changed by setting
-     * the value of the "certstore.type" security property (in the Java
-     * security properties file) to the desired type.
+     * <p>The default {@code CertStore} type can be changed by setting
+     * the value of the {@code certstore.type} security property to the
+     * desired type.
      *
-     * @return the default <code>CertStore</code> type as specified in the
-     * Java security properties file, or the string &quot;LDAP&quot;
-     * if no such property exists.
+     * @see java.security.Security security properties
+     * @return the default {@code CertStore} type as specified by the
+     * {@code certstore.type} security property, or the string
+     * {@literal "LDAP"} if no such property exists.
      */
     public final static String getDefaultType() {
         String cstype;
diff --git a/ojluni/src/main/java/java/security/cert/CertStoreException.java b/ojluni/src/main/java/java/security/cert/CertStoreException.java
index 31baf64..77b1c23 100644
--- a/ojluni/src/main/java/java/security/cert/CertStoreException.java
+++ b/ojluni/src/main/java/java/security/cert/CertStoreException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -29,9 +29,9 @@
 
 /**
  * An exception indicating one of a variety of problems retrieving
- * certificates and CRLs from a <code>CertStore</code>.
+ * certificates and CRLs from a {@code CertStore}.
  * <p>
- * A <code>CertStoreException</code> provides support for wrapping
+ * A {@code CertStoreException} provides support for wrapping
  * exceptions. The {@link #getCause getCause} method returns the throwable,
  * if any, that caused this exception to be thrown.
  * <p>
@@ -53,7 +53,7 @@
     private static final long serialVersionUID = 2395296107471573245L;
 
     /**
-     * Creates a <code>CertStoreException</code> with <code>null</code> as
+     * Creates a {@code CertStoreException} with {@code null} as
      * its detail message.
      */
     public CertStoreException() {
@@ -61,8 +61,8 @@
     }
 
     /**
-     * Creates a <code>CertStoreException</code> with the given detail
-     * message. A detail message is a <code>String</code> that describes this
+     * Creates a {@code CertStoreException} with the given detail
+     * message. A detail message is a {@code String} that describes this
      * particular exception.
      *
      * @param msg the detail message
@@ -72,15 +72,15 @@
     }
 
     /**
-     * Creates a <code>CertStoreException</code> that wraps the specified
+     * Creates a {@code CertStoreException} that wraps the specified
      * throwable. This allows any exception to be converted into a
-     * <code>CertStoreException</code>, while retaining information about the
+     * {@code CertStoreException}, while retaining information about the
      * cause, which may be useful for debugging. The detail message is
-     * set to (<code>cause==null ? null : cause.toString()</code>) (which
+     * set to ({@code cause==null ? null : cause.toString()}) (which
      * typically contains the class and detail message of cause).
      *
      * @param cause the cause (which is saved for later retrieval by the
-     * {@link #getCause getCause()} method). (A <code>null</code> value is
+     * {@link #getCause getCause()} method). (A {@code null} value is
      * permitted, and indicates that the cause is nonexistent or unknown.)
      */
     public CertStoreException(Throwable cause) {
@@ -88,12 +88,12 @@
     }
 
     /**
-     * Creates a <code>CertStoreException</code> with the specified detail
+     * Creates a {@code CertStoreException} with the specified detail
      * message and cause.
      *
      * @param msg the detail message
      * @param cause the cause (which is saved for later retrieval by the
-     * {@link #getCause getCause()} method). (A <code>null</code> value is
+     * {@link #getCause getCause()} method). (A {@code null} value is
      * permitted, and indicates that the cause is nonexistent or unknown.)
      */
     public CertStoreException(String msg, Throwable cause) {
diff --git a/ojluni/src/main/java/java/security/cert/CertStoreParameters.java b/ojluni/src/main/java/java/security/cert/CertStoreParameters.java
index d410dc7..9938ba2 100644
--- a/ojluni/src/main/java/java/security/cert/CertStoreParameters.java
+++ b/ojluni/src/main/java/java/security/cert/CertStoreParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,20 +26,20 @@
 package java.security.cert;
 
 /**
- * A specification of <code>CertStore</code> parameters.
+ * A specification of {@code CertStore} parameters.
  * <p>
  * The purpose of this interface is to group (and provide type safety for)
- * all <code>CertStore</code> parameter specifications. All
- * <code>CertStore</code> parameter specifications must implement this
+ * all {@code CertStore} parameter specifications. All
+ * {@code CertStore} parameter specifications must implement this
  * interface.
  * <p>
- * Typically, a <code>CertStoreParameters</code> object is passed as a parameter
+ * Typically, a {@code CertStoreParameters} object is passed as a parameter
  * to one of the {@link CertStore#getInstance CertStore.getInstance} methods.
- * The <code>getInstance</code> method returns a <code>CertStore</code> that
- * is used for retrieving <code>Certificate</code>s and <code>CRL</code>s. The
- * <code>CertStore</code> that is returned is initialized with the specified
+ * The {@code getInstance} method returns a {@code CertStore} that
+ * is used for retrieving {@code Certificate}s and {@code CRL}s. The
+ * {@code CertStore} that is returned is initialized with the specified
  * parameters. The type of parameters needed may vary between different types
- * of <code>CertStore</code>s.
+ * of {@code CertStore}s.
  *
  * @see CertStore#getInstance
  *
@@ -49,32 +49,32 @@
 public interface CertStoreParameters extends Cloneable {
 
     /**
-     * Makes a copy of this <code>CertStoreParameters</code>.
+     * Makes a copy of this {@code CertStoreParameters}.
      * <p>
      * The precise meaning of "copy" may depend on the class of
-     * the <code>CertStoreParameters</code> object. A typical implementation
+     * the {@code CertStoreParameters} object. A typical implementation
      * performs a "deep copy" of this object, but this is not an absolute
      * requirement. Some implementations may perform a "shallow copy" of some
      * or all of the fields of this object.
      * <p>
-     * Note that the <code>CertStore.getInstance</code> methods make a copy
-     * of the specified <code>CertStoreParameters</code>. A deep copy
-     * implementation of <code>clone</code> is safer and more robust, as it
-     * prevents the caller from corrupting a shared <code>CertStore</code> by
+     * Note that the {@code CertStore.getInstance} methods make a copy
+     * of the specified {@code CertStoreParameters}. A deep copy
+     * implementation of {@code clone} is safer and more robust, as it
+     * prevents the caller from corrupting a shared {@code CertStore} by
      * subsequently modifying the contents of its initialization parameters.
-     * However, a shallow copy implementation of <code>clone</code> is more
+     * However, a shallow copy implementation of {@code clone} is more
      * appropriate for applications that need to hold a reference to a
-     * parameter contained in the <code>CertStoreParameters</code>. For example,
+     * parameter contained in the {@code CertStoreParameters}. For example,
      * a shallow copy clone allows an application to release the resources of
-     * a particular <code>CertStore</code> initialization parameter immediately,
+     * a particular {@code CertStore} initialization parameter immediately,
      * rather than waiting for the garbage collection mechanism. This should
-     * be done with the utmost care, since the <code>CertStore</code> may still
+     * be done with the utmost care, since the {@code CertStore} may still
      * be in use by other threads.
      * <p>
      * Each subclass should state the precise behavior of this method so
      * that users and developers know what to expect.
      *
-     * @return a copy of this <code>CertStoreParameters</code>
+     * @return a copy of this {@code CertStoreParameters}
      */
     Object clone();
 }
diff --git a/ojluni/src/main/java/java/security/cert/CertStoreSpi.java b/ojluni/src/main/java/java/security/cert/CertStoreSpi.java
index ddcf2bc..fc98e9e 100644
--- a/ojluni/src/main/java/java/security/cert/CertStoreSpi.java
+++ b/ojluni/src/main/java/java/security/cert/CertStoreSpi.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -30,26 +30,26 @@
 
 /**
  * The <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the {@link CertStore CertStore} class. All <code>CertStore</code>
+ * for the {@link CertStore CertStore} class. All {@code CertStore}
  * implementations must include a class (the SPI class) that extends
- * this class (<code>CertStoreSpi</code>), provides a constructor with
- * a single argument of type <code>CertStoreParameters</code>, and implements
+ * this class ({@code CertStoreSpi}), provides a constructor with
+ * a single argument of type {@code CertStoreParameters}, and implements
  * all of its methods. In general, instances of this class should only be
- * accessed through the <code>CertStore</code> class.
+ * accessed through the {@code CertStore} class.
  * For details, see the Java Cryptography Architecture.
  * <p>
  * <b>Concurrent Access</b>
  * <p>
- * The public methods of all <code>CertStoreSpi</code> objects must be
+ * The public methods of all {@code CertStoreSpi} objects must be
  * thread-safe. That is, multiple threads may concurrently invoke these
- * methods on a single <code>CertStoreSpi</code> object (or more than one)
- * with no ill effects. This allows a <code>CertPathBuilder</code> to search
+ * methods on a single {@code CertStoreSpi} object (or more than one)
+ * with no ill effects. This allows a {@code CertPathBuilder} to search
  * for a CRL while simultaneously searching for further certificates, for
  * instance.
  * <p>
- * Simple <code>CertStoreSpi</code> implementations will probably ensure
- * thread safety by adding a <code>synchronized</code> keyword to their
- * <code>engineGetCertificates</code> and <code>engineGetCRLs</code> methods.
+ * Simple {@code CertStoreSpi} implementations will probably ensure
+ * thread safety by adding a {@code synchronized} keyword to their
+ * {@code engineGetCertificates} and {@code engineGetCRLs} methods.
  * More sophisticated ones may allow truly concurrent access.
  *
  * @since       1.4
@@ -60,64 +60,64 @@
     /**
      * The sole constructor.
      *
-     * @param params the initialization parameters (may be <code>null</code>)
+     * @param params the initialization parameters (may be {@code null})
      * @throws InvalidAlgorithmParameterException if the initialization
-     * parameters are inappropriate for this <code>CertStoreSpi</code>
+     * parameters are inappropriate for this {@code CertStoreSpi}
      */
     public CertStoreSpi(CertStoreParameters params)
     throws InvalidAlgorithmParameterException { }
 
     /**
-     * Returns a <code>Collection</code> of <code>Certificate</code>s that
-     * match the specified selector. If no <code>Certificate</code>s
-     * match the selector, an empty <code>Collection</code> will be returned.
+     * Returns a {@code Collection} of {@code Certificate}s that
+     * match the specified selector. If no {@code Certificate}s
+     * match the selector, an empty {@code Collection} will be returned.
      * <p>
-     * For some <code>CertStore</code> types, the resulting
-     * <code>Collection</code> may not contain <b>all</b> of the
-     * <code>Certificate</code>s that match the selector. For instance,
-     * an LDAP <code>CertStore</code> may not search all entries in the
+     * For some {@code CertStore} types, the resulting
+     * {@code Collection} may not contain <b>all</b> of the
+     * {@code Certificate}s that match the selector. For instance,
+     * an LDAP {@code CertStore} may not search all entries in the
      * directory. Instead, it may just search entries that are likely to
-     * contain the <code>Certificate</code>s it is looking for.
+     * contain the {@code Certificate}s it is looking for.
      * <p>
-     * Some <code>CertStore</code> implementations (especially LDAP
-     * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
-     * unless a non-null <code>CertSelector</code> is provided that includes
+     * Some {@code CertStore} implementations (especially LDAP
+     * {@code CertStore}s) may throw a {@code CertStoreException}
+     * unless a non-null {@code CertSelector} is provided that includes
      * specific criteria that can be used to find the certificates. Issuer
      * and/or subject names are especially useful criteria.
      *
-     * @param selector A <code>CertSelector</code> used to select which
-     *  <code>Certificate</code>s should be returned. Specify <code>null</code>
-     *  to return all <code>Certificate</code>s (if supported).
-     * @return A <code>Collection</code> of <code>Certificate</code>s that
-     *         match the specified selector (never <code>null</code>)
+     * @param selector A {@code CertSelector} used to select which
+     *  {@code Certificate}s should be returned. Specify {@code null}
+     *  to return all {@code Certificate}s (if supported).
+     * @return A {@code Collection} of {@code Certificate}s that
+     *         match the specified selector (never {@code null})
      * @throws CertStoreException if an exception occurs
      */
     public abstract Collection<? extends Certificate> engineGetCertificates
             (CertSelector selector) throws CertStoreException;
 
     /**
-     * Returns a <code>Collection</code> of <code>CRL</code>s that
-     * match the specified selector. If no <code>CRL</code>s
-     * match the selector, an empty <code>Collection</code> will be returned.
+     * Returns a {@code Collection} of {@code CRL}s that
+     * match the specified selector. If no {@code CRL}s
+     * match the selector, an empty {@code Collection} will be returned.
      * <p>
-     * For some <code>CertStore</code> types, the resulting
-     * <code>Collection</code> may not contain <b>all</b> of the
-     * <code>CRL</code>s that match the selector. For instance,
-     * an LDAP <code>CertStore</code> may not search all entries in the
+     * For some {@code CertStore} types, the resulting
+     * {@code Collection} may not contain <b>all</b> of the
+     * {@code CRL}s that match the selector. For instance,
+     * an LDAP {@code CertStore} may not search all entries in the
      * directory. Instead, it may just search entries that are likely to
-     * contain the <code>CRL</code>s it is looking for.
+     * contain the {@code CRL}s it is looking for.
      * <p>
-     * Some <code>CertStore</code> implementations (especially LDAP
-     * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
-     * unless a non-null <code>CRLSelector</code> is provided that includes
+     * Some {@code CertStore} implementations (especially LDAP
+     * {@code CertStore}s) may throw a {@code CertStoreException}
+     * unless a non-null {@code CRLSelector} is provided that includes
      * specific criteria that can be used to find the CRLs. Issuer names
      * and/or the certificate to be checked are especially useful.
      *
-     * @param selector A <code>CRLSelector</code> used to select which
-     *  <code>CRL</code>s should be returned. Specify <code>null</code>
-     *  to return all <code>CRL</code>s (if supported).
-     * @return A <code>Collection</code> of <code>CRL</code>s that
-     *         match the specified selector (never <code>null</code>)
+     * @param selector A {@code CRLSelector} used to select which
+     *  {@code CRL}s should be returned. Specify {@code null}
+     *  to return all {@code CRL}s (if supported).
+     * @return A {@code Collection} of {@code CRL}s that
+     *         match the specified selector (never {@code null})
      * @throws CertStoreException if an exception occurs
      */
     public abstract Collection<? extends CRL> engineGetCRLs
diff --git a/ojluni/src/main/java/java/security/cert/CertificateEncodingException.java b/ojluni/src/main/java/java/security/cert/CertificateEncodingException.java
index dbfc22c..618ee0a 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateEncodingException.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateEncodingException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -56,13 +56,13 @@
     }
 
     /**
-     * Creates a <code>CertificateEncodingException</code> with the specified
+     * Creates a {@code CertificateEncodingException} with the specified
      * detail message and cause.
      *
      * @param message the detail message (which is saved for later retrieval
      *        by the {@link #getMessage()} method).
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
@@ -71,14 +71,14 @@
     }
 
     /**
-     * Creates a <code>CertificateEncodingException</code>
+     * Creates a {@code CertificateEncodingException}
      * with the specified cause and a detail message of
-     * <tt>(cause==null ? null : cause.toString())</tt>
+     * {@code (cause==null ? null : cause.toString())}
      * (which typically contains the class and detail message of
-     * <tt>cause</tt>).
+     * {@code cause}).
      *
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
diff --git a/ojluni/src/main/java/java/security/cert/CertificateException.java b/ojluni/src/main/java/java/security/cert/CertificateException.java
index 1c91f9f..f663054 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateException.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -57,13 +57,13 @@
     }
 
     /**
-     * Creates a <code>CertificateException</code> with the specified
+     * Creates a {@code CertificateException} with the specified
      * detail message and cause.
      *
      * @param message the detail message (which is saved for later retrieval
      *        by the {@link #getMessage()} method).
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
@@ -72,13 +72,13 @@
     }
 
     /**
-     * Creates a <code>CertificateException</code> with the specified cause
-     * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+     * Creates a {@code CertificateException} with the specified cause
+     * and a detail message of {@code (cause==null ? null : cause.toString())}
      * (which typically contains the class and detail message of
-     * <tt>cause</tt>).
+     * {@code cause}).
      *
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
diff --git a/ojluni/src/main/java/java/security/cert/CertificateExpiredException.java b/ojluni/src/main/java/java/security/cert/CertificateExpiredException.java
index e5644fa..9de0c23 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateExpiredException.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateExpiredException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,8 +27,8 @@
 
 /**
  * Certificate Expired Exception. This is thrown whenever the current
- * <code>Date</code> or the specified <code>Date</code> is after the
- * <code>notAfter</code> date/time specified in the validity period
+ * {@code Date} or the specified {@code Date} is after the
+ * {@code notAfter} date/time specified in the validity period
  * of the certificate.
  *
  * @author Hemma Prafullchandra
diff --git a/ojluni/src/main/java/java/security/cert/CertificateFactory.java b/ojluni/src/main/java/java/security/cert/CertificateFactory.java
index bd0ae8c..e82a579 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateFactory.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -41,31 +41,31 @@
 
 /**
  * This class defines the functionality of a certificate factory, which is
- * used to generate certificate, certification path (<code>CertPath</code>)
+ * used to generate certificate, certification path ({@code CertPath})
  * and certificate revocation list (CRL) objects from their encodings.
  *
  * <p>For encodings consisting of multiple certificates, use
- * <code>generateCertificates</code> when you want to
+ * {@code generateCertificates} when you want to
  * parse a collection of possibly unrelated certificates. Otherwise,
- * use <code>generateCertPath</code> when you want to generate
- * a <code>CertPath</code> (a certificate chain) and subsequently
- * validate it with a <code>CertPathValidator</code>.
+ * use {@code generateCertPath} when you want to generate
+ * a {@code CertPath} (a certificate chain) and subsequently
+ * validate it with a {@code CertPathValidator}.
  *
  * <p>A certificate factory for X.509 must return certificates that are an
- * instance of <code>java.security.cert.X509Certificate</code>, and CRLs
- * that are an instance of <code>java.security.cert.X509CRL</code>.
+ * instance of {@code java.security.cert.X509Certificate}, and CRLs
+ * that are an instance of {@code java.security.cert.X509CRL}.
  *
  * <p>The following example reads a file with Base64 encoded certificates,
  * which are each bounded at the beginning by -----BEGIN CERTIFICATE-----, and
  * bounded at the end by -----END CERTIFICATE-----. We convert the
- * <code>FileInputStream</code> (which does not support <code>mark</code>
- * and <code>reset</code>) to a <code>BufferedInputStream</code> (which
+ * {@code FileInputStream} (which does not support {@code mark}
+ * and {@code reset}) to a {@code BufferedInputStream} (which
  * supports those methods), so that each call to
- * <code>generateCertificate</code> consumes only one certificate, and the
+ * {@code generateCertificate} consumes only one certificate, and the
  * read position of the input stream is positioned to the next certificate in
- * the file:<p>
+ * the file:
  *
- * <pre>
+ * <pre>{@code
  * FileInputStream fis = new FileInputStream(filename);
  * BufferedInputStream bis = new BufferedInputStream(fis);
  *
@@ -75,10 +75,10 @@
  *    Certificate cert = cf.generateCertificate(bis);
  *    System.out.println(cert.toString());
  * }
- * </pre>
+ * }</pre>
  *
  * <p>The following example parses a PKCS#7-formatted certificate reply stored
- * in a file and extracts all the certificates from it:<p>
+ * in a file and extracts all the certificates from it:
  *
  * <pre>
  * FileInputStream fis = new FileInputStream(filename);
@@ -281,7 +281,7 @@
      *          implementation for the specified algorithm is not available
      *          from the specified Provider object.
      *
-     * @exception IllegalArgumentException if the <code>provider</code> is
+     * @exception IllegalArgumentException if the {@code provider} is
      *          null.
      *
      * @see java.security.Provider
@@ -322,17 +322,17 @@
 
     /**
      * Generates a certificate object and initializes it with
-     * the data read from the input stream <code>inStream</code>.
+     * the data read from the input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized certificate format
      * supported by this certificate factory,
      * the returned certificate object can be typecast to the corresponding
      * certificate class. For example, if this certificate
      * factory implements X.509 certificates, the returned certificate object
-     * can be typecast to the <code>X509Certificate</code> class.
+     * can be typecast to the {@code X509Certificate} class.
      *
      * <p>In the case of a certificate factory for X.509 certificates, the
-     * certificate provided in <code>inStream</code> must be DER-encoded and
+     * certificate provided in {@code inStream} must be DER-encoded and
      * may be supplied in binary or printable (Base64) encoding. If the
      * certificate is provided in Base64 encoding, it must be bounded at
      * the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at
@@ -347,7 +347,7 @@
      * the inherent end-of-certificate marker. If the data in the input stream
      * does not contain an inherent end-of-certificate marker (other
      * than EOF) and there is trailing data after the certificate is parsed, a
-     * <code>CertificateException</code> is thrown.
+     * {@code CertificateException} is thrown.
      *
      * @param inStream an input stream with the certificate data.
      *
@@ -363,19 +363,19 @@
     }
 
     /**
-     * Returns an iteration of the <code>CertPath</code> encodings supported
+     * Returns an iteration of the {@code CertPath} encodings supported
      * by this certificate factory, with the default encoding first. See
      * the CertPath Encodings section in the <a href=
      * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertPathEncodings">
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard encoding names and their formats.
      * <p>
-     * Attempts to modify the returned <code>Iterator</code> via its
-     * <code>remove</code> method result in an
-     * <code>UnsupportedOperationException</code>.
+     * Attempts to modify the returned {@code Iterator} via its
+     * {@code remove} method result in an
+     * {@code UnsupportedOperationException}.
      *
-     * @return an <code>Iterator</code> over the names of the supported
-     *         <code>CertPath</code> encodings (as <code>String</code>s)
+     * @return an {@code Iterator} over the names of the supported
+     *         {@code CertPath} encodings (as {@code String}s)
      * @since 1.4
      */
     public final Iterator<String> getCertPathEncodings() {
@@ -383,15 +383,15 @@
     }
 
     /**
-     * Generates a <code>CertPath</code> object and initializes it with
-     * the data read from the <code>InputStream</code> inStream. The data
+     * Generates a {@code CertPath} object and initializes it with
+     * the data read from the {@code InputStream} inStream. The data
      * is assumed to be in the default encoding. The name of the default
-     * encoding is the first element of the <code>Iterator</code> returned by
+     * encoding is the first element of the {@code Iterator} returned by
      * the {@link #getCertPathEncodings getCertPathEncodings} method.
      *
-     * @param inStream an <code>InputStream</code> containing the data
-     * @return a <code>CertPath</code> initialized with the data from the
-     *   <code>InputStream</code>
+     * @param inStream an {@code InputStream} containing the data
+     * @return a {@code CertPath} initialized with the data from the
+     *   {@code InputStream}
      * @exception CertificateException if an exception occurs while decoding
      * @since 1.4
      */
@@ -402,18 +402,18 @@
     }
 
     /**
-     * Generates a <code>CertPath</code> object and initializes it with
-     * the data read from the <code>InputStream</code> inStream. The data
+     * Generates a {@code CertPath} object and initializes it with
+     * the data read from the {@code InputStream} inStream. The data
      * is assumed to be in the specified encoding. See
      * the CertPath Encodings section in the <a href=
      * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertPathEncodings">
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard encoding names and their formats.
      *
-     * @param inStream an <code>InputStream</code> containing the data
+     * @param inStream an {@code InputStream} containing the data
      * @param encoding the encoding used for the data
-     * @return a <code>CertPath</code> initialized with the data from the
-     *   <code>InputStream</code>
+     * @return a {@code CertPath} initialized with the data from the
+     *   {@code InputStream}
      * @exception CertificateException if an exception occurs while decoding or
      *   the encoding requested is not supported
      * @since 1.4
@@ -425,15 +425,15 @@
     }
 
     /**
-     * Generates a <code>CertPath</code> object and initializes it with
-     * a <code>List</code> of <code>Certificate</code>s.
+     * Generates a {@code CertPath} object and initializes it with
+     * a {@code List} of {@code Certificate}s.
      * <p>
      * The certificates supplied must be of a type supported by the
-     * <code>CertificateFactory</code>. They will be copied out of the supplied
-     * <code>List</code> object.
+     * {@code CertificateFactory}. They will be copied out of the supplied
+     * {@code List} object.
      *
-     * @param certificates a <code>List</code> of <code>Certificate</code>s
-     * @return a <code>CertPath</code> initialized with the supplied list of
+     * @param certificates a {@code List} of {@code Certificate}s
+     * @return a {@code CertPath} initialized with the supplied list of
      *   certificates
      * @exception CertificateException if an exception occurs
      * @since 1.4
@@ -447,20 +447,20 @@
 
     /**
      * Returns a (possibly empty) collection view of the certificates read
-     * from the given input stream <code>inStream</code>.
+     * from the given input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized certificate format
      * supported by this certificate factory, each element in
      * the returned collection view can be typecast to the corresponding
      * certificate class. For example, if this certificate
      * factory implements X.509 certificates, the elements in the returned
-     * collection can be typecast to the <code>X509Certificate</code> class.
+     * collection can be typecast to the {@code X509Certificate} class.
      *
      * <p>In the case of a certificate factory for X.509 certificates,
-     * <code>inStream</code> may contain a sequence of DER-encoded certificates
+     * {@code inStream} may contain a sequence of DER-encoded certificates
      * in the formats described for
      * {@link #generateCertificate(java.io.InputStream) generateCertificate}.
-     * In addition, <code>inStream</code> may contain a PKCS#7 certificate
+     * In addition, {@code inStream} may contain a PKCS#7 certificate
      * chain. This is a PKCS#7 <i>SignedData</i> object, with the only
      * significant field being <i>certificates</i>. In particular, the
      * signature and the contents are ignored. This format allows multiple
@@ -487,14 +487,14 @@
 
     /**
      * Generates a certificate revocation list (CRL) object and initializes it
-     * with the data read from the input stream <code>inStream</code>.
+     * with the data read from the input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized CRL format
      * supported by this certificate factory,
      * the returned CRL object can be typecast to the corresponding
      * CRL class. For example, if this certificate
      * factory implements X.509 CRLs, the returned CRL object
-     * can be typecast to the <code>X509CRL</code> class.
+     * can be typecast to the {@code X509CRL} class.
      *
      * <p>Note that if the given input stream does not support
      * {@link java.io.InputStream#mark(int) mark} and
@@ -505,7 +505,7 @@
      * end-of-CRL marker. If the data in the
      * input stream does not contain an inherent end-of-CRL marker (other
      * than EOF) and there is trailing data after the CRL is parsed, a
-     * <code>CRLException</code> is thrown.
+     * {@code CRLException} is thrown.
      *
      * @param inStream an input stream with the CRL data.
      *
@@ -522,18 +522,18 @@
 
     /**
      * Returns a (possibly empty) collection view of the CRLs read
-     * from the given input stream <code>inStream</code>.
+     * from the given input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized CRL format
      * supported by this certificate factory, each element in
      * the returned collection view can be typecast to the corresponding
      * CRL class. For example, if this certificate
      * factory implements X.509 CRLs, the elements in the returned
-     * collection can be typecast to the <code>X509CRL</code> class.
+     * collection can be typecast to the {@code X509CRL} class.
      *
      * <p>In the case of a certificate factory for X.509 CRLs,
-     * <code>inStream</code> may contain a sequence of DER-encoded CRLs.
-     * In addition, <code>inStream</code> may contain a PKCS#7 CRL
+     * {@code inStream} may contain a sequence of DER-encoded CRLs.
+     * In addition, {@code inStream} may contain a PKCS#7 CRL
      * set. This is a PKCS#7 <i>SignedData</i> object, with the only
      * significant field being <i>crls</i>. In particular, the
      * signature and the contents are ignored. This format allows multiple
diff --git a/ojluni/src/main/java/java/security/cert/CertificateFactorySpi.java b/ojluni/src/main/java/java/security/cert/CertificateFactorySpi.java
index ca64665..5e13831 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateFactorySpi.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateFactorySpi.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -35,18 +35,18 @@
 
 /**
  * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>CertificateFactory</code> class.
+ * for the {@code CertificateFactory} class.
  * All the abstract methods in this class must be implemented by each
  * cryptographic service provider who wishes to supply the implementation
  * of a certificate factory for a particular certificate type, e.g., X.509.
  *
  * <p>Certificate factories are used to generate certificate, certification path
- * (<code>CertPath</code>) and certificate revocation list (CRL) objects from
+ * ({@code CertPath}) and certificate revocation list (CRL) objects from
  * their encodings.
  *
  * <p>A certificate factory for X.509 must return certificates that are an
- * instance of <code>java.security.cert.X509Certificate</code>, and CRLs
- * that are an instance of <code>java.security.cert.X509CRL</code>.
+ * instance of {@code java.security.cert.X509Certificate}, and CRLs
+ * that are an instance of {@code java.security.cert.X509CRL}.
  *
  * @author Hemma Prafullchandra
  * @author Jan Luehe
@@ -67,17 +67,17 @@
 
     /**
      * Generates a certificate object and initializes it with
-     * the data read from the input stream <code>inStream</code>.
+     * the data read from the input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized certificate format
      * supported by this certificate factory,
      * the returned certificate object can be typecast to the corresponding
      * certificate class. For example, if this certificate
      * factory implements X.509 certificates, the returned certificate object
-     * can be typecast to the <code>X509Certificate</code> class.
+     * can be typecast to the {@code X509Certificate} class.
      *
      * <p>In the case of a certificate factory for X.509 certificates, the
-     * certificate provided in <code>inStream</code> must be DER-encoded and
+     * certificate provided in {@code inStream} must be DER-encoded and
      * may be supplied in binary or printable (Base64) encoding. If the
      * certificate is provided in Base64 encoding, it must be bounded at
      * the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at
@@ -92,7 +92,7 @@
      * end-of-certificate marker. If the data in the
      * input stream does not contain an inherent end-of-certificate marker (other
      * than EOF) and there is trailing data after the certificate is parsed, a
-     * <code>CertificateException</code> is thrown.
+     * {@code CertificateException} is thrown.
      *
      * @param inStream an input stream with the certificate data.
      *
@@ -105,18 +105,18 @@
         throws CertificateException;
 
     /**
-     * Generates a <code>CertPath</code> object and initializes it with
-     * the data read from the <code>InputStream</code> inStream. The data
+     * Generates a {@code CertPath} object and initializes it with
+     * the data read from the {@code InputStream} inStream. The data
      * is assumed to be in the default encoding.
      *
      * <p> This method was added to version 1.4 of the Java 2 Platform
      * Standard Edition. In order to maintain backwards compatibility with
-     * existing service providers, this method cannot be <code>abstract</code>
-     * and by default throws an <code>UnsupportedOperationException</code>.
+     * existing service providers, this method cannot be {@code abstract}
+     * and by default throws an {@code UnsupportedOperationException}.
      *
-     * @param inStream an <code>InputStream</code> containing the data
-     * @return a <code>CertPath</code> initialized with the data from the
-     *   <code>InputStream</code>
+     * @param inStream an {@code InputStream} containing the data
+     * @return a {@code CertPath} initialized with the data from the
+     *   {@code InputStream}
      * @exception CertificateException if an exception occurs while decoding
      * @exception UnsupportedOperationException if the method is not supported
      * @since 1.4
@@ -128,19 +128,19 @@
     }
 
     /**
-     * Generates a <code>CertPath</code> object and initializes it with
-     * the data read from the <code>InputStream</code> inStream. The data
+     * Generates a {@code CertPath} object and initializes it with
+     * the data read from the {@code InputStream} inStream. The data
      * is assumed to be in the specified encoding.
      *
      * <p> This method was added to version 1.4 of the Java 2 Platform
      * Standard Edition. In order to maintain backwards compatibility with
-     * existing service providers, this method cannot be <code>abstract</code>
-     * and by default throws an <code>UnsupportedOperationException</code>.
+     * existing service providers, this method cannot be {@code abstract}
+     * and by default throws an {@code UnsupportedOperationException}.
      *
-     * @param inStream an <code>InputStream</code> containing the data
+     * @param inStream an {@code InputStream} containing the data
      * @param encoding the encoding used for the data
-     * @return a <code>CertPath</code> initialized with the data from the
-     *   <code>InputStream</code>
+     * @return a {@code CertPath} initialized with the data from the
+     *   {@code InputStream}
      * @exception CertificateException if an exception occurs while decoding or
      *   the encoding requested is not supported
      * @exception UnsupportedOperationException if the method is not supported
@@ -153,20 +153,20 @@
     }
 
     /**
-     * Generates a <code>CertPath</code> object and initializes it with
-     * a <code>List</code> of <code>Certificate</code>s.
+     * Generates a {@code CertPath} object and initializes it with
+     * a {@code List} of {@code Certificate}s.
      * <p>
      * The certificates supplied must be of a type supported by the
-     * <code>CertificateFactory</code>. They will be copied out of the supplied
-     * <code>List</code> object.
+     * {@code CertificateFactory}. They will be copied out of the supplied
+     * {@code List} object.
      *
      * <p> This method was added to version 1.4 of the Java 2 Platform
      * Standard Edition. In order to maintain backwards compatibility with
-     * existing service providers, this method cannot be <code>abstract</code>
-     * and by default throws an <code>UnsupportedOperationException</code>.
+     * existing service providers, this method cannot be {@code abstract}
+     * and by default throws an {@code UnsupportedOperationException}.
      *
-     * @param certificates a <code>List</code> of <code>Certificate</code>s
-     * @return a <code>CertPath</code> initialized with the supplied list of
+     * @param certificates a {@code List} of {@code Certificate}s
+     * @return a {@code CertPath} initialized with the supplied list of
      *   certificates
      * @exception CertificateException if an exception occurs
      * @exception UnsupportedOperationException if the method is not supported
@@ -180,24 +180,24 @@
     }
 
     /**
-     * Returns an iteration of the <code>CertPath</code> encodings supported
+     * Returns an iteration of the {@code CertPath} encodings supported
      * by this certificate factory, with the default encoding first. See
      * the CertPath Encodings section in the <a href=
      * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertPathEncodings">
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard encoding names.
      * <p>
-     * Attempts to modify the returned <code>Iterator</code> via its
-     * <code>remove</code> method result in an
-     * <code>UnsupportedOperationException</code>.
+     * Attempts to modify the returned {@code Iterator} via its
+     * {@code remove} method result in an
+     * {@code UnsupportedOperationException}.
      *
      * <p> This method was added to version 1.4 of the Java 2 Platform
      * Standard Edition. In order to maintain backwards compatibility with
-     * existing service providers, this method cannot be <code>abstract</code>
-     * and by default throws an <code>UnsupportedOperationException</code>.
+     * existing service providers, this method cannot be {@code abstract}
+     * and by default throws an {@code UnsupportedOperationException}.
      *
-     * @return an <code>Iterator</code> over the names of the supported
-     *         <code>CertPath</code> encodings (as <code>String</code>s)
+     * @return an {@code Iterator} over the names of the supported
+     *         {@code CertPath} encodings (as {@code String}s)
      * @exception UnsupportedOperationException if the method is not supported
      * @since 1.4
      */
@@ -207,21 +207,21 @@
 
     /**
      * Returns a (possibly empty) collection view of the certificates read
-     * from the given input stream <code>inStream</code>.
+     * from the given input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized certificate format
      * supported by this certificate factory, each element in
      * the returned collection view can be typecast to the corresponding
      * certificate class. For example, if this certificate
      * factory implements X.509 certificates, the elements in the returned
-     * collection can be typecast to the <code>X509Certificate</code> class.
+     * collection can be typecast to the {@code X509Certificate} class.
      *
      * <p>In the case of a certificate factory for X.509 certificates,
-     * <code>inStream</code> may contain a single DER-encoded certificate
+     * {@code inStream} may contain a single DER-encoded certificate
      * in the formats described for
      * {@link CertificateFactory#generateCertificate(java.io.InputStream)
      * generateCertificate}.
-     * In addition, <code>inStream</code> may contain a PKCS#7 certificate
+     * In addition, {@code inStream} may contain a PKCS#7 certificate
      * chain. This is a PKCS#7 <i>SignedData</i> object, with the only
      * significant field being <i>certificates</i>. In particular, the
      * signature and the contents are ignored. This format allows multiple
@@ -247,14 +247,14 @@
 
     /**
      * Generates a certificate revocation list (CRL) object and initializes it
-     * with the data read from the input stream <code>inStream</code>.
+     * with the data read from the input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized CRL format
      * supported by this certificate factory,
      * the returned CRL object can be typecast to the corresponding
      * CRL class. For example, if this certificate
      * factory implements X.509 CRLs, the returned CRL object
-     * can be typecast to the <code>X509CRL</code> class.
+     * can be typecast to the {@code X509CRL} class.
      *
      * <p>Note that if the given input stream does not support
      * {@link java.io.InputStream#mark(int) mark} and
@@ -265,7 +265,7 @@
      * end-of-CRL marker. If the data in the
      * input stream does not contain an inherent end-of-CRL marker (other
      * than EOF) and there is trailing data after the CRL is parsed, a
-     * <code>CRLException</code> is thrown.
+     * {@code CRLException} is thrown.
      *
      * @param inStream an input stream with the CRL data.
      *
@@ -279,18 +279,18 @@
 
     /**
      * Returns a (possibly empty) collection view of the CRLs read
-     * from the given input stream <code>inStream</code>.
+     * from the given input stream {@code inStream}.
      *
      * <p>In order to take advantage of the specialized CRL format
      * supported by this certificate factory, each element in
      * the returned collection view can be typecast to the corresponding
      * CRL class. For example, if this certificate
      * factory implements X.509 CRLs, the elements in the returned
-     * collection can be typecast to the <code>X509CRL</code> class.
+     * collection can be typecast to the {@code X509CRL} class.
      *
      * <p>In the case of a certificate factory for X.509 CRLs,
-     * <code>inStream</code> may contain a single DER-encoded CRL.
-     * In addition, <code>inStream</code> may contain a PKCS#7 CRL
+     * {@code inStream} may contain a single DER-encoded CRL.
+     * In addition, {@code inStream} may contain a PKCS#7 CRL
      * set. This is a PKCS#7 <i>SignedData</i> object, with the only
      * significant field being <i>crls</i>. In particular, the
      * signature and the contents are ignored. This format allows multiple
diff --git a/ojluni/src/main/java/java/security/cert/CertificateNotYetValidException.java b/ojluni/src/main/java/java/security/cert/CertificateNotYetValidException.java
index 13da51d..e8722bd 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateNotYetValidException.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateNotYetValidException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,8 +27,8 @@
 
 /**
  * Certificate is not yet valid exception. This is thrown whenever
- * the current <code>Date</code> or the specified <code>Date</code>
- * is before the <code>notBefore</code> date/time in the Certificate
+ * the current {@code Date} or the specified {@code Date}
+ * is before the {@code notBefore} date/time in the Certificate
  * validity period.
  *
  * @author Hemma Prafullchandra
diff --git a/ojluni/src/main/java/java/security/cert/CertificateParsingException.java b/ojluni/src/main/java/java/security/cert/CertificateParsingException.java
index 3432fb0..06a7d60 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateParsingException.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateParsingException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -57,13 +57,13 @@
     }
 
     /**
-     * Creates a <code>CertificateParsingException</code> with the specified
+     * Creates a {@code CertificateParsingException} with the specified
      * detail message and cause.
      *
      * @param message the detail message (which is saved for later retrieval
      *        by the {@link #getMessage()} method).
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
@@ -72,14 +72,14 @@
     }
 
     /**
-     * Creates a <code>CertificateParsingException</code> with the
+     * Creates a {@code CertificateParsingException} with the
      * specified cause and a detail message of
-     * <tt>(cause==null ? null : cause.toString())</tt>
+     * {@code (cause==null ? null : cause.toString())}
      * (which typically contains the class and detail message of
-     * <tt>cause</tt>).
+     * {@code cause}).
      *
      * @param cause the cause (which is saved for later retrieval by the
-     *        {@link #getCause()} method).  (A <tt>null</tt> value is permitted,
+     *        {@link #getCause()} method).  (A {@code null} value is permitted,
      *        and indicates that the cause is nonexistent or unknown.)
      * @since 1.5
      */
diff --git a/ojluni/src/main/java/java/security/cert/CertificateRevokedException.java b/ojluni/src/main/java/java/security/cert/CertificateRevokedException.java
index a76299c..505a007 100644
--- a/ojluni/src/main/java/java/security/cert/CertificateRevokedException.java
+++ b/ojluni/src/main/java/java/security/cert/CertificateRevokedException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -32,7 +32,6 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Map.Entry;
 import javax.security.auth.x500.X500Principal;
 
 import sun.security.util.ObjectIdentifier;
@@ -40,7 +39,7 @@
 
 /**
  * An exception that indicates an X.509 certificate is revoked. A
- * <code>CertificateRevokedException</code> contains additional information
+ * {@code CertificateRevokedException} contains additional information
  * about the revoked certificate, such as the date on which the
  * certificate was revoked and the reason it was revoked.
  *
@@ -61,7 +60,7 @@
      */
     private final CRLReason reason;
     /**
-     * @serial the <code>X500Principal</code> that represents the name of the
+     * @serial the {@code X500Principal} that represents the name of the
      * authority that signed the certificate's revocation status information
      */
     private final X500Principal authority;
@@ -69,7 +68,7 @@
     private transient Map<String, Extension> extensions;
 
     /**
-     * Constructs a <code>CertificateRevokedException</code> with
+     * Constructs a {@code CertificateRevokedException} with
      * the specified revocation date, reason code, authority name, and map
      * of extensions.
      *
@@ -79,12 +78,12 @@
      * @param extensions a map of X.509 Extensions. Each key is an OID String
      *    that maps to the corresponding Extension. The map is copied to
      *    prevent subsequent modification.
-     * @param authority the <code>X500Principal</code> that represents the name
+     * @param authority the {@code X500Principal} that represents the name
      *    of the authority that signed the certificate's revocation status
      *    information
-     * @throws NullPointerException if <code>revocationDate</code>,
-     *    <code>reason</code>, <code>authority</code>, or
-     *    <code>extensions</code> is <code>null</code>
+     * @throws NullPointerException if {@code revocationDate},
+     *    {@code reason}, {@code authority}, or
+     *    {@code extensions} is {@code null}
      */
     public CertificateRevokedException(Date revocationDate, CRLReason reason,
         X500Principal authority, Map<String, Extension> extensions) {
@@ -95,7 +94,10 @@
         this.revocationDate = new Date(revocationDate.getTime());
         this.reason = reason;
         this.authority = authority;
-        this.extensions = new HashMap(extensions);
+        // make sure Map only contains correct types
+        this.extensions = Collections.checkedMap(new HashMap<>(),
+                                                 String.class, Extension.class);
+        this.extensions.putAll(extensions);
     }
 
     /**
@@ -122,7 +124,7 @@
      * Returns the name of the authority that signed the certificate's
      * revocation status information.
      *
-     * @return the <code>X500Principal</code> that represents the name of the
+     * @return the {@code X500Principal} that represents the name of the
      *     authority that signed the certificate's revocation status information
      */
     public X500Principal getAuthorityName() {
@@ -130,17 +132,17 @@
     }
 
     /**
-     * Returns the invalidity date, as specifed in the Invalidity Date
-     * extension of this <code>CertificateRevokedException</code>. The
+     * Returns the invalidity date, as specified in the Invalidity Date
+     * extension of this {@code CertificateRevokedException}. The
      * invalidity date is the date on which it is known or suspected that the
      * private key was compromised or that the certificate otherwise became
-     * invalid. This implementation calls <code>getExtensions()</code> and
+     * invalid. This implementation calls {@code getExtensions()} and
      * checks the returned map for an entry for the Invalidity Date extension
      * OID ("2.5.29.24"). If found, it returns the invalidity date in the
      * extension; otherwise null. A new Date object is returned each time the
      * method is invoked to protect against subsequent modification.
      *
-     * @return the invalidity date, or <code>null</code> if not specified
+     * @return the invalidity date, or {@code null} if not specified
      */
     public Date getInvalidityDate() {
         Extension ext = getExtensions().get("2.5.29.24");
@@ -148,8 +150,7 @@
             return null;
         } else {
             try {
-                Date invalidity =
-                    (Date) InvalidityDateExtension.toImpl(ext).get("DATE");
+                Date invalidity = InvalidityDateExtension.toImpl(ext).get("DATE");
                 return new Date(invalidity.getTime());
             } catch (IOException ioe) {
                 return null;
@@ -174,11 +175,12 @@
     public String getMessage() {
         return "Certificate has been revoked, reason: "
                + reason + ", revocation date: " + revocationDate
-               + ", authority: " + authority + ", extensions: " + extensions;
+               + ", authority: " + authority + ", extension OIDs: "
+               + extensions.keySet();
     }
 
     /**
-     * Serialize this <code>CertificateRevokedException</code> instance.
+     * Serialize this {@code CertificateRevokedException} instance.
      *
      * @serialData the size of the extensions map (int), followed by all of
      * the extensions in the map, in no particular order. For each extension,
@@ -210,7 +212,7 @@
     }
 
     /**
-     * Deserialize the <code>CertificateRevokedException</code> instance.
+     * Deserialize the {@code CertificateRevokedException} instance.
      */
     private void readObject(ObjectInputStream ois)
         throws IOException, ClassNotFoundException {
diff --git a/ojluni/src/main/java/java/security/cert/CollectionCertStoreParameters.java b/ojluni/src/main/java/java/security/cert/CollectionCertStoreParameters.java
index ddeea61..12bd358 100644
--- a/ojluni/src/main/java/java/security/cert/CollectionCertStoreParameters.java
+++ b/ojluni/src/main/java/java/security/cert/CollectionCertStoreParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, 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
@@ -30,13 +30,13 @@
 import java.util.Collections;
 
 /**
- * Parameters used as input for the Collection <code>CertStore</code>
+ * Parameters used as input for the Collection {@code CertStore}
  * algorithm.
  * <p>
  * This class is used to provide necessary configuration parameters
- * to implementations of the Collection <code>CertStore</code>
+ * to implementations of the Collection {@code CertStore}
  * algorithm. The only parameter included in this class is the
- * <code>Collection</code> from which the <code>CertStore</code> will
+ * {@code Collection} from which the {@code CertStore} will
  * retrieve certificates and CRLs.
  * <p>
  * <b>Concurrent Access</b>
@@ -58,30 +58,30 @@
     private Collection<?> coll;
 
     /**
-     * Creates an instance of <code>CollectionCertStoreParameters</code>
+     * Creates an instance of {@code CollectionCertStoreParameters}
      * which will allow certificates and CRLs to be retrieved from the
-     * specified <code>Collection</code>. If the specified
-     * <code>Collection</code> contains an object that is not a
-     * <code>Certificate</code> or <code>CRL</code>, that object will be
-     * ignored by the Collection <code>CertStore</code>.
+     * specified {@code Collection}. If the specified
+     * {@code Collection} contains an object that is not a
+     * {@code Certificate} or {@code CRL}, that object will be
+     * ignored by the Collection {@code CertStore}.
      * <p>
-     * The <code>Collection</code> is <b>not</b> copied. Instead, a
+     * The {@code Collection} is <b>not</b> copied. Instead, a
      * reference is used. This allows the caller to subsequently add or
-     * remove <code>Certificates</code> or <code>CRL</code>s from the
-     * <code>Collection</code>, thus changing the set of
-     * <code>Certificates</code> or <code>CRL</code>s available to the
-     * Collection <code>CertStore</code>. The Collection <code>CertStore</code>
-     * will not modify the contents of the <code>Collection</code>.
+     * remove {@code Certificates} or {@code CRL}s from the
+     * {@code Collection}, thus changing the set of
+     * {@code Certificates} or {@code CRL}s available to the
+     * Collection {@code CertStore}. The Collection {@code CertStore}
+     * will not modify the contents of the {@code Collection}.
      * <p>
-     * If the <code>Collection</code> will be modified by one thread while
-     * another thread is calling a method of a Collection <code>CertStore</code>
-     * that has been initialized with this <code>Collection</code>, the
-     * <code>Collection</code> must have fail-fast iterators.
+     * If the {@code Collection} will be modified by one thread while
+     * another thread is calling a method of a Collection {@code CertStore}
+     * that has been initialized with this {@code Collection}, the
+     * {@code Collection} must have fail-fast iterators.
      *
-     * @param collection a <code>Collection</code> of
-     *        <code>Certificate</code>s and <code>CRL</code>s
-     * @exception NullPointerException if <code>collection</code> is
-     * <code>null</code>
+     * @param collection a {@code Collection} of
+     *        {@code Certificate}s and {@code CRL}s
+     * @exception NullPointerException if {@code collection} is
+     * {@code null}
      */
     public CollectionCertStoreParameters(Collection<?> collection) {
         if (collection == null)
@@ -90,22 +90,22 @@
     }
 
     /**
-     * Creates an instance of <code>CollectionCertStoreParameters</code> with
+     * Creates an instance of {@code CollectionCertStoreParameters} with
      * the default parameter values (an empty and immutable
-     * <code>Collection</code>).
+     * {@code Collection}).
      */
     public CollectionCertStoreParameters() {
         coll = Collections.EMPTY_SET;
     }
 
     /**
-     * Returns the <code>Collection</code> from which <code>Certificate</code>s
-     * and <code>CRL</code>s are retrieved. This is <b>not</b> a copy of the
-     * <code>Collection</code>, it is a reference. This allows the caller to
-     * subsequently add or remove <code>Certificates</code> or
-     * <code>CRL</code>s from the <code>Collection</code>.
+     * Returns the {@code Collection} from which {@code Certificate}s
+     * and {@code CRL}s are retrieved. This is <b>not</b> a copy of the
+     * {@code Collection}, it is a reference. This allows the caller to
+     * subsequently add or remove {@code Certificates} or
+     * {@code CRL}s from the {@code Collection}.
      *
-     * @return the <code>Collection</code> (never null)
+     * @return the {@code Collection} (never null)
      */
     public Collection<?> getCollection() {
         return coll;
@@ -113,7 +113,7 @@
 
     /**
      * Returns a copy of this object. Note that only a reference to the
-     * <code>Collection</code> is copied, and not the contents.
+     * {@code Collection} is copied, and not the contents.
      *
      * @return the copy
      */
@@ -122,7 +122,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
diff --git a/ojluni/src/main/java/java/security/cert/Extension.java b/ojluni/src/main/java/java/security/cert/Extension.java
index cbf89d5..98e827c 100644
--- a/ojluni/src/main/java/java/security/cert/Extension.java
+++ b/ojluni/src/main/java/java/security/cert/Extension.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -84,7 +84,7 @@
      * that are encoded as an OCTET STRING. It does not include the OCTET
      * STRING tag and length.
      *
-     * @return a copy of the extension's value, or <code>null</code> if no
+     * @return a copy of the extension's value, or {@code null} if no
      *    extension value is present.
      */
     byte[] getValue();
@@ -95,7 +95,7 @@
      *
      * @param out the output stream
      * @exception IOException on encoding or output error.
-     * @exception NullPointerException if <code>out</code> is <code>null</code>.
+     * @exception NullPointerException if {@code out} is {@code null}.
      */
     void encode(OutputStream out) throws IOException;
 }
diff --git a/ojluni/src/main/java/java/security/cert/LDAPCertStoreParameters.java b/ojluni/src/main/java/java/security/cert/LDAPCertStoreParameters.java
index 00bf2af..96fe9cd 100644
--- a/ojluni/src/main/java/java/security/cert/LDAPCertStoreParameters.java
+++ b/ojluni/src/main/java/java/security/cert/LDAPCertStoreParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,10 +26,10 @@
 package java.security.cert;
 
 /**
- * Parameters used as input for the LDAP <code>CertStore</code> algorithm.
+ * Parameters used as input for the LDAP {@code CertStore} algorithm.
  * <p>
  * This class is used to provide necessary configuration parameters (server
- * name and port number) to implementations of the LDAP <code>CertStore</code>
+ * name and port number) to implementations of the LDAP {@code CertStore}
  * algorithm.
  * <p>
  * <b>Concurrent Access</b>
@@ -59,13 +59,13 @@
     private String serverName;
 
     /**
-     * Creates an instance of <code>LDAPCertStoreParameters</code> with the
+     * Creates an instance of {@code LDAPCertStoreParameters} with the
      * specified parameter values.
      *
      * @param serverName the DNS name of the LDAP server
      * @param port the port number of the LDAP server
-     * @exception NullPointerException if <code>serverName</code> is
-     * <code>null</code>
+     * @exception NullPointerException if {@code serverName} is
+     * {@code null}
      */
     public LDAPCertStoreParameters(String serverName, int port) {
         if (serverName == null)
@@ -75,19 +75,19 @@
     }
 
     /**
-     * Creates an instance of <code>LDAPCertStoreParameters</code> with the
+     * Creates an instance of {@code LDAPCertStoreParameters} with the
      * specified server name and a default port of 389.
      *
      * @param serverName the DNS name of the LDAP server
-     * @exception NullPointerException if <code>serverName</code> is
-     * <code>null</code>
+     * @exception NullPointerException if {@code serverName} is
+     * {@code null}
      */
     public LDAPCertStoreParameters(String serverName) {
         this(serverName, LDAP_DEFAULT_PORT);
     }
 
     /**
-     * Creates an instance of <code>LDAPCertStoreParameters</code> with the
+     * Creates an instance of {@code LDAPCertStoreParameters} with the
      * default parameter values (server name "localhost", port 389).
      */
     public LDAPCertStoreParameters() {
@@ -97,7 +97,7 @@
     /**
      * Returns the DNS name of the LDAP server.
      *
-     * @return the name (not <code>null</code>)
+     * @return the name (not {@code null})
      */
     public String getServerName() {
         return serverName;
@@ -117,7 +117,7 @@
      * the original and vice versa.
      * <p>
      * Note: this method currently performs a shallow copy of the object
-     * (simply calls <code>Object.clone()</code>). This may be changed in a
+     * (simply calls {@code Object.clone()}). This may be changed in a
      * future revision to perform a deep copy if new parameters are added
      * that should not be shared.
      *
@@ -128,7 +128,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
diff --git a/ojluni/src/main/java/java/security/cert/PKIXBuilderParameters.java b/ojluni/src/main/java/java/security/cert/PKIXBuilderParameters.java
index d1b27c6..b33e1f8 100644
--- a/ojluni/src/main/java/java/security/cert/PKIXBuilderParameters.java
+++ b/ojluni/src/main/java/java/security/cert/PKIXBuilderParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -32,35 +32,35 @@
 import java.util.Set;
 
 /**
- * Parameters used as input for the PKIX <code>CertPathBuilder</code>
+ * Parameters used as input for the PKIX {@code CertPathBuilder}
  * algorithm.
  * <p>
- * A PKIX <code>CertPathBuilder</code> uses these parameters to {@link
- * CertPathBuilder#build build} a <code>CertPath</code> which has been
+ * A PKIX {@code CertPathBuilder} uses these parameters to {@link
+ * CertPathBuilder#build build} a {@code CertPath} which has been
  * validated according to the PKIX certification path validation algorithm.
  *
- * <p>To instantiate a <code>PKIXBuilderParameters</code> object, an
+ * <p>To instantiate a {@code PKIXBuilderParameters} object, an
  * application must specify one or more <i>most-trusted CAs</i> as defined by
  * the PKIX certification path validation algorithm. The most-trusted CA
  * can be specified using one of two constructors. An application
  * can call {@link #PKIXBuilderParameters(Set, CertSelector)
  * PKIXBuilderParameters(Set, CertSelector)}, specifying a
- * <code>Set</code> of <code>TrustAnchor</code> objects, each of which
+ * {@code Set} of {@code TrustAnchor} objects, each of which
  * identifies a most-trusted CA. Alternatively, an application can call
  * {@link #PKIXBuilderParameters(KeyStore, CertSelector)
  * PKIXBuilderParameters(KeyStore, CertSelector)}, specifying a
- * <code>KeyStore</code> instance containing trusted certificate entries, each
+ * {@code KeyStore} instance containing trusted certificate entries, each
  * of which will be considered as a most-trusted CA.
  *
  * <p>In addition, an application must specify constraints on the target
- * certificate that the <code>CertPathBuilder</code> will attempt
+ * certificate that the {@code CertPathBuilder} will attempt
  * to build a path to. The constraints are specified as a
- * <code>CertSelector</code> object. These constraints should provide the
- * <code>CertPathBuilder</code> with enough search criteria to find the target
- * certificate. Minimal criteria for an <code>X509Certificate</code> usually
+ * {@code CertSelector} object. These constraints should provide the
+ * {@code CertPathBuilder} with enough search criteria to find the target
+ * certificate. Minimal criteria for an {@code X509Certificate} usually
  * include the subject name and/or one or more subject alternative names.
- * If enough criteria is not specified, the <code>CertPathBuilder</code>
- * may throw a <code>CertPathBuilderException</code>.
+ * If enough criteria is not specified, the {@code CertPathBuilder}
+ * may throw a {@code CertPathBuilderException}.
  * <p>
  * <b>Concurrent Access</b>
  * <p>
@@ -80,23 +80,23 @@
     private int maxPathLength = 5;
 
     /**
-     * Creates an instance of <code>PKIXBuilderParameters</code> with
-     * the specified <code>Set</code> of most-trusted CAs.
+     * Creates an instance of {@code PKIXBuilderParameters} with
+     * the specified {@code Set} of most-trusted CAs.
      * Each element of the set is a {@link TrustAnchor TrustAnchor}.
      *
-     * <p>Note that the <code>Set</code> is copied to protect against
+     * <p>Note that the {@code Set} is copied to protect against
      * subsequent modifications.
      *
-     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
-     * @param targetConstraints a <code>CertSelector</code> specifying the
+     * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
+     * @param targetConstraints a {@code CertSelector} specifying the
      * constraints on the target certificate
-     * @throws InvalidAlgorithmParameterException if <code>trustAnchors</code>
-     * is empty <code>(trustAnchors.isEmpty() == true)</code>
-     * @throws NullPointerException if <code>trustAnchors</code> is
-     * <code>null</code>
+     * @throws InvalidAlgorithmParameterException if {@code trustAnchors}
+     * is empty {@code (trustAnchors.isEmpty() == true)}
+     * @throws NullPointerException if {@code trustAnchors} is
+     * {@code null}
      * @throws ClassCastException if any of the elements of
-     * <code>trustAnchors</code> are not of type
-     * <code>java.security.cert.TrustAnchor</code>
+     * {@code trustAnchors} are not of type
+     * {@code java.security.cert.TrustAnchor}
      */
     public PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector
         targetConstraints) throws InvalidAlgorithmParameterException
@@ -106,22 +106,22 @@
     }
 
     /**
-     * Creates an instance of <code>PKIXBuilderParameters</code> that
+     * Creates an instance of {@code PKIXBuilderParameters} that
      * populates the set of most-trusted CAs from the trusted
-     * certificate entries contained in the specified <code>KeyStore</code>.
-     * Only keystore entries that contain trusted <code>X509Certificate</code>s
+     * certificate entries contained in the specified {@code KeyStore}.
+     * Only keystore entries that contain trusted {@code X509Certificate}s
      * are considered; all other certificate types are ignored.
      *
-     * @param keystore a <code>KeyStore</code> from which the set of
+     * @param keystore a {@code KeyStore} from which the set of
      * most-trusted CAs will be populated
-     * @param targetConstraints a <code>CertSelector</code> specifying the
+     * @param targetConstraints a {@code CertSelector} specifying the
      * constraints on the target certificate
-     * @throws KeyStoreException if <code>keystore</code> has not been
+     * @throws KeyStoreException if {@code keystore} has not been
      * initialized
-     * @throws InvalidAlgorithmParameterException if <code>keystore</code> does
+     * @throws InvalidAlgorithmParameterException if {@code keystore} does
      * not contain at least one trusted certificate entry
-     * @throws NullPointerException if <code>keystore</code> is
-     * <code>null</code>
+     * @throws NullPointerException if {@code keystore} is
+     * {@code null}
      */
     public PKIXBuilderParameters(KeyStore keystore,
         CertSelector targetConstraints)
@@ -139,7 +139,7 @@
      * in a certification path is not an intermediate certificate, and is not
      * included in this limit. Usually the last certificate is an end entity
      * certificate, but it can be a CA certificate. A PKIX
-     * <code>CertPathBuilder</code> instance must not build
+     * {@code CertPathBuilder} instance must not build
      * paths longer than the length specified.
      *
      * <p> A value of 0 implies that the path can only contain
@@ -149,14 +149,14 @@
      * Setting a value less than -1 will cause an exception to be thrown.
      *
      * <p> If any of the CA certificates contain the
-     * <code>BasicConstraintsExtension</code>, the value of the
-     * <code>pathLenConstraint</code> field of the extension overrides
+     * {@code BasicConstraintsExtension}, the value of the
+     * {@code pathLenConstraint} field of the extension overrides
      * the maximum path length parameter whenever the result is a
      * certification path of smaller length.
      *
      * @param maxPathLength the maximum number of non-self-issued intermediate
      *  certificates that may exist in a certification path
-     * @throws InvalidParameterException if <code>maxPathLength</code> is set
+     * @throws InvalidParameterException if {@code maxPathLength} is set
      *  to a value less than -1
      *
      * @see #getMaxPathLength
diff --git a/ojluni/src/main/java/java/security/cert/PKIXCertPathBuilderResult.java b/ojluni/src/main/java/java/security/cert/PKIXCertPathBuilderResult.java
index d5efbb3..3255a3b 100644
--- a/ojluni/src/main/java/java/security/cert/PKIXCertPathBuilderResult.java
+++ b/ojluni/src/main/java/java/security/cert/PKIXCertPathBuilderResult.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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,14 +33,14 @@
  * returned using this algorithm are also validated according to the PKIX
  * certification path validation algorithm.
  *
- * <p>Instances of <code>PKIXCertPathBuilderResult</code> are returned by
- * the <code>build</code> method of <code>CertPathBuilder</code>
+ * <p>Instances of {@code PKIXCertPathBuilderResult} are returned by
+ * the {@code build} method of {@code CertPathBuilder}
  * objects implementing the PKIX algorithm.
  *
- * <p>All <code>PKIXCertPathBuilderResult</code> objects contain the
+ * <p>All {@code PKIXCertPathBuilderResult} objects contain the
  * certification path constructed by the build algorithm, the
  * valid policy tree and subject public key resulting from the build
- * algorithm, and a <code>TrustAnchor</code> describing the certification
+ * algorithm, and a {@code TrustAnchor} describing the certification
  * authority (CA) that served as a trust anchor for the certification path.
  * <p>
  * <b>Concurrent Access</b>
@@ -62,18 +62,18 @@
     private CertPath certPath;
 
     /**
-     * Creates an instance of <code>PKIXCertPathBuilderResult</code>
+     * Creates an instance of {@code PKIXCertPathBuilderResult}
      * containing the specified parameters.
      *
-     * @param certPath the validated <code>CertPath</code>
-     * @param trustAnchor a <code>TrustAnchor</code> describing the CA that
+     * @param certPath the validated {@code CertPath}
+     * @param trustAnchor a {@code TrustAnchor} describing the CA that
      * served as a trust anchor for the certification path
-     * @param policyTree the immutable valid policy tree, or <code>null</code>
+     * @param policyTree the immutable valid policy tree, or {@code null}
      * if there are no valid policies
      * @param subjectPublicKey the public key of the subject
-     * @throws NullPointerException if the <code>certPath</code>,
-     * <code>trustAnchor</code> or <code>subjectPublicKey</code> parameters
-     * are <code>null</code>
+     * @throws NullPointerException if the {@code certPath},
+     * {@code trustAnchor} or {@code subjectPublicKey} parameters
+     * are {@code null}
      */
     public PKIXCertPathBuilderResult(CertPath certPath,
         TrustAnchor trustAnchor, PolicyNode policyTree,
@@ -87,13 +87,13 @@
 
     /**
      * Returns the built and validated certification path. The
-     * <code>CertPath</code> object does not include the trust anchor.
+     * {@code CertPath} object does not include the trust anchor.
      * Instead, use the {@link #getTrustAnchor() getTrustAnchor()} method to
-     * obtain the <code>TrustAnchor</code> that served as the trust anchor
+     * obtain the {@code TrustAnchor} that served as the trust anchor
      * for the certification path.
      *
-     * @return the built and validated <code>CertPath</code> (never
-     * <code>null</code>)
+     * @return the built and validated {@code CertPath} (never
+     * {@code null})
      */
     public CertPath getCertPath() {
         return certPath;
@@ -101,10 +101,10 @@
 
     /**
      * Return a printable representation of this
-     * <code>PKIXCertPathBuilderResult</code>.
+     * {@code PKIXCertPathBuilderResult}.
      *
-     * @return a <code>String</code> describing the contents of this
-     *         <code>PKIXCertPathBuilderResult</code>
+     * @return a {@code String} describing the contents of this
+     *         {@code PKIXCertPathBuilderResult}
      */
     public String toString() {
         StringBuffer sb = new StringBuffer();
diff --git a/ojluni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java b/ojluni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
index caea7a2..b40cd39 100644
--- a/ojluni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
+++ b/ojluni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -31,13 +31,13 @@
  * This class represents the successful result of the PKIX certification
  * path validation algorithm.
  *
- * <p>Instances of <code>PKIXCertPathValidatorResult</code> are returned by the
+ * <p>Instances of {@code PKIXCertPathValidatorResult} are returned by the
  * {@link CertPathValidator#validate validate} method of
- * <code>CertPathValidator</code> objects implementing the PKIX algorithm.
+ * {@code CertPathValidator} objects implementing the PKIX algorithm.
  *
- * <p> All <code>PKIXCertPathValidatorResult</code> objects contain the
+ * <p> All {@code PKIXCertPathValidatorResult} objects contain the
  * valid policy tree and subject public key resulting from the
- * validation algorithm, as well as a <code>TrustAnchor</code> describing
+ * validation algorithm, as well as a {@code TrustAnchor} describing
  * the certification authority (CA) that served as a trust anchor for the
  * certification path.
  * <p>
@@ -62,16 +62,16 @@
     private PublicKey subjectPublicKey;
 
     /**
-     * Creates an instance of <code>PKIXCertPathValidatorResult</code>
+     * Creates an instance of {@code PKIXCertPathValidatorResult}
      * containing the specified parameters.
      *
-     * @param trustAnchor a <code>TrustAnchor</code> describing the CA that
+     * @param trustAnchor a {@code TrustAnchor} describing the CA that
      * served as a trust anchor for the certification path
-     * @param policyTree the immutable valid policy tree, or <code>null</code>
+     * @param policyTree the immutable valid policy tree, or {@code null}
      * if there are no valid policies
      * @param subjectPublicKey the public key of the subject
-     * @throws NullPointerException if the <code>subjectPublicKey</code> or
-     * <code>trustAnchor</code> parameters are <code>null</code>
+     * @throws NullPointerException if the {@code subjectPublicKey} or
+     * {@code trustAnchor} parameters are {@code null}
      */
     public PKIXCertPathValidatorResult(TrustAnchor trustAnchor,
         PolicyNode policyTree, PublicKey subjectPublicKey)
@@ -86,10 +86,10 @@
     }
 
     /**
-     * Returns the <code>TrustAnchor</code> describing the CA that served
+     * Returns the {@code TrustAnchor} describing the CA that served
      * as a trust anchor for the certification path.
      *
-     * @return the <code>TrustAnchor</code> (never <code>null</code>)
+     * @return the {@code TrustAnchor} (never {@code null})
      */
     public TrustAnchor getTrustAnchor() {
         return trustAnchor;
@@ -98,18 +98,18 @@
     /**
      * Returns the root node of the valid policy tree resulting from the
      * PKIX certification path validation algorithm. The
-     * <code>PolicyNode</code> object that is returned and any objects that
+     * {@code PolicyNode} object that is returned and any objects that
      * it returns through public methods are immutable.
      *
      * <p>Most applications will not need to examine the valid policy tree.
      * They can achieve their policy processing goals by setting the
-     * policy-related parameters in <code>PKIXParameters</code>. However, more
+     * policy-related parameters in {@code PKIXParameters}. However, more
      * sophisticated applications, especially those that process policy
      * qualifiers, may need to traverse the valid policy tree using the
      * {@link PolicyNode#getParent PolicyNode.getParent} and
      * {@link PolicyNode#getChildren PolicyNode.getChildren} methods.
      *
-     * @return the root node of the valid policy tree, or <code>null</code>
+     * @return the root node of the valid policy tree, or {@code null}
      * if there are no valid policies
      */
     public PolicyNode getPolicyTree() {
@@ -120,7 +120,7 @@
      * Returns the public key of the subject (target) of the certification
      * path, including any inherited public key parameters if applicable.
      *
-     * @return the public key of the subject (never <code>null</code>)
+     * @return the public key of the subject (never {@code null})
      */
     public PublicKey getPublicKey() {
         return subjectPublicKey;
@@ -136,16 +136,16 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
     /**
      * Return a printable representation of this
-     * <code>PKIXCertPathValidatorResult</code>.
+     * {@code PKIXCertPathValidatorResult}.
      *
-     * @return a <code>String</code> describing the contents of this
-     *         <code>PKIXCertPathValidatorResult</code>
+     * @return a {@code String} describing the contents of this
+     *         {@code PKIXCertPathValidatorResult}
      */
     public String toString() {
         StringBuffer sb = new StringBuffer();
diff --git a/ojluni/src/main/java/java/security/cert/PKIXParameters.java b/ojluni/src/main/java/java/security/cert/PKIXParameters.java
index 6f4d385..4d8a344 100644
--- a/ojluni/src/main/java/java/security/cert/PKIXParameters.java
+++ b/ojluni/src/main/java/java/security/cert/PKIXParameters.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
@@ -38,34 +38,34 @@
 import java.util.Set;
 
 /**
- * Parameters used as input for the PKIX <code>CertPathValidator</code>
+ * Parameters used as input for the PKIX {@code CertPathValidator}
  * algorithm.
  * <p>
- * A PKIX <code>CertPathValidator</code> uses these parameters to
- * validate a <code>CertPath</code> according to the PKIX certification path
+ * A PKIX {@code CertPathValidator} uses these parameters to
+ * validate a {@code CertPath} according to the PKIX certification path
  * validation algorithm.
  *
- * <p>To instantiate a <code>PKIXParameters</code> object, an
+ * <p>To instantiate a {@code PKIXParameters} object, an
  * application must specify one or more <i>most-trusted CAs</i> as defined by
  * the PKIX certification path validation algorithm. The most-trusted CAs
  * can be specified using one of two constructors. An application
  * can call {@link #PKIXParameters(Set) PKIXParameters(Set)},
- * specifying a <code>Set</code> of <code>TrustAnchor</code> objects, each
+ * specifying a {@code Set} of {@code TrustAnchor} objects, each
  * of which identify a most-trusted CA. Alternatively, an application can call
  * {@link #PKIXParameters(KeyStore) PKIXParameters(KeyStore)}, specifying a
- * <code>KeyStore</code> instance containing trusted certificate entries, each
+ * {@code KeyStore} instance containing trusted certificate entries, each
  * of which will be considered as a most-trusted CA.
  * <p>
- * Once a <code>PKIXParameters</code> object has been created, other parameters
+ * Once a {@code PKIXParameters} object has been created, other parameters
  * can be specified (by calling {@link #setInitialPolicies setInitialPolicies}
  * or {@link #setDate setDate}, for instance) and then the
- * <code>PKIXParameters</code> is passed along with the <code>CertPath</code>
+ * {@code PKIXParameters} is passed along with the {@code CertPath}
  * to be validated to {@link CertPathValidator#validate
  * CertPathValidator.validate}.
  * <p>
- * Any parameter that is not set (or is set to <code>null</code>) will
+ * Any parameter that is not set (or is set to {@code null}) will
  * be set to the default value for that parameter. The default value for the
- * <code>date</code> parameter is <code>null</code>, which indicates
+ * {@code date} parameter is {@code null}, which indicates
  * the current time when the path is validated. The default for the
  * remaining parameters is the least constrained.
  * <p>
@@ -99,20 +99,20 @@
     private CertSelector certSelector;
 
     /**
-     * Creates an instance of <code>PKIXParameters</code> with the specified
-     * <code>Set</code> of most-trusted CAs. Each element of the
+     * Creates an instance of {@code PKIXParameters} with the specified
+     * {@code Set} of most-trusted CAs. Each element of the
      * set is a {@link TrustAnchor TrustAnchor}.
      * <p>
-     * Note that the <code>Set</code> is copied to protect against
+     * Note that the {@code Set} is copied to protect against
      * subsequent modifications.
      *
-     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
+     * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
      * @throws InvalidAlgorithmParameterException if the specified
-     * <code>Set</code> is empty <code>(trustAnchors.isEmpty() == true)</code>
-     * @throws NullPointerException if the specified <code>Set</code> is
-     * <code>null</code>
-     * @throws ClassCastException if any of the elements in the <code>Set</code>
-     * are not of type <code>java.security.cert.TrustAnchor</code>
+     * {@code Set} is empty {@code (trustAnchors.isEmpty() == true)}
+     * @throws NullPointerException if the specified {@code Set} is
+     * {@code null}
+     * @throws ClassCastException if any of the elements in the {@code Set}
+     * are not of type {@code java.security.cert.TrustAnchor}
      */
     public PKIXParameters(Set<TrustAnchor> trustAnchors)
         throws InvalidAlgorithmParameterException
@@ -125,18 +125,18 @@
     }
 
     /**
-     * Creates an instance of <code>PKIXParameters</code> that
+     * Creates an instance of {@code PKIXParameters} that
      * populates the set of most-trusted CAs from the trusted
-     * certificate entries contained in the specified <code>KeyStore</code>.
-     * Only keystore entries that contain trusted <code>X509Certificates</code>
+     * certificate entries contained in the specified {@code KeyStore}.
+     * Only keystore entries that contain trusted {@code X509Certificates}
      * are considered; all other certificate types are ignored.
      *
-     * @param keystore a <code>KeyStore</code> from which the set of
+     * @param keystore a {@code KeyStore} from which the set of
      * most-trusted CAs will be populated
      * @throws KeyStoreException if the keystore has not been initialized
      * @throws InvalidAlgorithmParameterException if the keystore does
      * not contain at least one trusted certificate entry
-     * @throws NullPointerException if the keystore is <code>null</code>
+     * @throws NullPointerException if the keystore is {@code null}
      */
     public PKIXParameters(KeyStore keystore)
         throws KeyStoreException, InvalidAlgorithmParameterException
@@ -161,11 +161,11 @@
     }
 
     /**
-     * Returns an immutable <code>Set</code> of the most-trusted
+     * Returns an immutable {@code Set} of the most-trusted
      * CAs.
      *
-     * @return an immutable <code>Set</code> of <code>TrustAnchor</code>s
-     * (never <code>null</code>)
+     * @return an immutable {@code Set} of {@code TrustAnchor}s
+     * (never {@code null})
      *
      * @see #setTrustAnchors
      */
@@ -174,18 +174,18 @@
     }
 
     /**
-     * Sets the <code>Set</code> of most-trusted CAs.
+     * Sets the {@code Set} of most-trusted CAs.
      * <p>
-     * Note that the <code>Set</code> is copied to protect against
+     * Note that the {@code Set} is copied to protect against
      * subsequent modifications.
      *
-     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
+     * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
      * @throws InvalidAlgorithmParameterException if the specified
-     * <code>Set</code> is empty <code>(trustAnchors.isEmpty() == true)</code>
-     * @throws NullPointerException if the specified <code>Set</code> is
-     * <code>null</code>
+     * {@code Set} is empty {@code (trustAnchors.isEmpty() == true)}
+     * @throws NullPointerException if the specified {@code Set} is
+     * {@code null}
      * @throws ClassCastException if any of the elements in the set
-     * are not of type <code>java.security.cert.TrustAnchor</code>
+     * are not of type {@code java.security.cert.TrustAnchor}
      *
      * @see #getTrustAnchors
      */
@@ -211,16 +211,16 @@
     }
 
     /**
-     * Returns an immutable <code>Set</code> of initial
+     * Returns an immutable {@code Set} of initial
      * policy identifiers (OID strings), indicating that any one of these
      * policies would be acceptable to the certificate user for the purposes of
      * certification path processing. The default return value is an empty
-     * <code>Set</code>, which is interpreted as meaning that any policy would
+     * {@code Set}, which is interpreted as meaning that any policy would
      * be acceptable.
      *
-     * @return an immutable <code>Set</code> of initial policy OIDs in
-     * <code>String</code> format, or an empty <code>Set</code> (implying any
-     * policy is acceptable). Never returns <code>null</code>.
+     * @return an immutable {@code Set} of initial policy OIDs in
+     * {@code String} format, or an empty {@code Set} (implying any
+     * policy is acceptable). Never returns {@code null}.
      *
      * @see #setInitialPolicies
      */
@@ -229,21 +229,21 @@
     }
 
     /**
-     * Sets the <code>Set</code> of initial policy identifiers
+     * Sets the {@code Set} of initial policy identifiers
      * (OID strings), indicating that any one of these
      * policies would be acceptable to the certificate user for the purposes of
      * certification path processing. By default, any policy is acceptable
      * (i.e. all policies), so a user that wants to allow any policy as
      * acceptable does not need to call this method, or can call it
-     * with an empty <code>Set</code> (or <code>null</code>).
+     * with an empty {@code Set} (or {@code null}).
      * <p>
-     * Note that the <code>Set</code> is copied to protect against
+     * Note that the {@code Set} is copied to protect against
      * subsequent modifications.
      *
-     * @param initialPolicies a <code>Set</code> of initial policy
-     * OIDs in <code>String</code> format (or <code>null</code>)
+     * @param initialPolicies a {@code Set} of initial policy
+     * OIDs in {@code String} format (or {@code null})
      * @throws ClassCastException if any of the elements in the set are
-     * not of type <code>String</code>
+     * not of type {@code String}
      *
      * @see #getInitialPolicies
      */
@@ -262,19 +262,19 @@
     }
 
     /**
-     * Sets the list of <code>CertStore</code>s to be used in finding
-     * certificates and CRLs. May be <code>null</code>, in which case
-     * no <code>CertStore</code>s will be used. The first
-     * <code>CertStore</code>s in the list may be preferred to those that
+     * Sets the list of {@code CertStore}s to be used in finding
+     * certificates and CRLs. May be {@code null}, in which case
+     * no {@code CertStore}s will be used. The first
+     * {@code CertStore}s in the list may be preferred to those that
      * appear later.
      * <p>
-     * Note that the <code>List</code> is copied to protect against
+     * Note that the {@code List} is copied to protect against
      * subsequent modifications.
      *
-     * @param stores a <code>List</code> of <code>CertStore</code>s (or
-     * <code>null</code>)
+     * @param stores a {@code List} of {@code CertStore}s (or
+     * {@code null})
      * @throws ClassCastException if any of the elements in the list are
-     * not of type <code>java.security.cert.CertStore</code>
+     * not of type {@code java.security.cert.CertStore}
      *
      * @see #getCertStores
      */
@@ -293,10 +293,10 @@
     }
 
     /**
-     * Adds a <code>CertStore</code> to the end of the list of
-     * <code>CertStore</code>s used in finding certificates and CRLs.
+     * Adds a {@code CertStore} to the end of the list of
+     * {@code CertStore}s used in finding certificates and CRLs.
      *
-     * @param store the <code>CertStore</code> to add. If <code>null</code>,
+     * @param store the {@code CertStore} to add. If {@code null},
      * the store is ignored (not added to list).
      */
     public void addCertStore(CertStore store) {
@@ -306,11 +306,11 @@
     }
 
     /**
-     * Returns an immutable <code>List</code> of <code>CertStore</code>s that
+     * Returns an immutable {@code List} of {@code CertStore}s that
      * are used to find certificates and CRLs.
      *
-     * @return an immutable <code>List</code> of <code>CertStore</code>s
-     * (may be empty, but never <code>null</code>)
+     * @return an immutable {@code List} of {@code CertStore}s
+     * (may be empty, but never {@code null})
      *
      * @see #setCertStores
      */
@@ -325,7 +325,7 @@
      * will be used. If this flag is false, the default revocation checking
      * mechanism will be disabled (not used).
      * <p>
-     * When a <code>PKIXParameters</code> object is created, this flag is set
+     * When a {@code PKIXParameters} object is created, this flag is set
      * to true. This setting reflects the most common strategy for checking
      * revocation, since each service provider must support revocation
      * checking to be PKIX compliant. Sophisticated applications should set
@@ -360,8 +360,8 @@
      * acceptable policy needs to be explicitly identified in every certificate.
      * By default, the ExplicitPolicyRequired flag is false.
      *
-     * @param val <code>true</code> if explicit policy is to be required,
-     * <code>false</code> otherwise
+     * @param val {@code true} if explicit policy is to be required,
+     * {@code false} otherwise
      */
     public void setExplicitPolicyRequired(boolean val) {
         explicitPolicyRequired = val;
@@ -372,8 +372,8 @@
      * acceptable policy needs to be explicitly identified in every certificate.
      * By default, the ExplicitPolicyRequired flag is false.
      *
-     * @return <code>true</code> if explicit policy is required,
-     * <code>false</code> otherwise
+     * @return {@code true} if explicit policy is required,
+     * {@code false} otherwise
      */
     public boolean isExplicitPolicyRequired() {
         return explicitPolicyRequired;
@@ -384,8 +384,8 @@
      * mapping is inhibited. By default, policy mapping is not inhibited (the
      * flag is false).
      *
-     * @param val <code>true</code> if policy mapping is to be inhibited,
-     * <code>false</code> otherwise
+     * @param val {@code true} if policy mapping is to be inhibited,
+     * {@code false} otherwise
      */
     public void setPolicyMappingInhibited(boolean val) {
         policyMappingInhibited = val;
@@ -406,10 +406,10 @@
      * Sets state to determine if the any policy OID should be processed
      * if it is included in a certificate. By default, the any policy OID
      * is not inhibited ({@link #isAnyPolicyInhibited isAnyPolicyInhibited()}
-     * returns <code>false</code>).
+     * returns {@code false}).
      *
-     * @param val <code>true</code> if the any policy OID is to be
-     * inhibited, <code>false</code> otherwise
+     * @param val {@code true} if the any policy OID is to be
+     * inhibited, {@code false} otherwise
      */
     public void setAnyPolicyInhibited(boolean val) {
         anyPolicyInhibited = val;
@@ -419,8 +419,8 @@
      * Checks whether the any policy OID should be processed if it
      * is included in a certificate.
      *
-     * @return <code>true</code> if the any policy OID is inhibited,
-     * <code>false</code> otherwise
+     * @return {@code true} if the any policy OID is inhibited,
+     * {@code false} otherwise
      */
     public boolean isAnyPolicyInhibited() {
         return anyPolicyInhibited;
@@ -432,7 +432,7 @@
      * policies extension that is marked critical are rejected.
      * If the flag is false, certificates are not rejected on this basis.
      *
-     * <p> When a <code>PKIXParameters</code> object is created, this flag is
+     * <p> When a {@code PKIXParameters} object is created, this flag is
      * set to true. This setting reflects the most common (and simplest)
      * strategy for processing policy qualifiers. Applications that want to use
      * a more sophisticated policy must set this flag to false.
@@ -459,7 +459,7 @@
      * extension that is marked critical are rejected.
      * If the flag is false, certificates are not rejected on this basis.
      *
-     * <p> When a <code>PKIXParameters</code> object is created, this flag is
+     * <p> When a {@code PKIXParameters} object is created, this flag is
      * set to true. This setting reflects the most common (and simplest)
      * strategy for processing policy qualifiers. Applications that want to use
      * a more sophisticated policy must set this flag to false.
@@ -473,12 +473,12 @@
 
     /**
      * Returns the time for which the validity of the certification path
-     * should be determined. If <code>null</code>, the current time is used.
+     * should be determined. If {@code null}, the current time is used.
      * <p>
-     * Note that the <code>Date</code> returned is copied to protect against
+     * Note that the {@code Date} returned is copied to protect against
      * subsequent modifications.
      *
-     * @return the <code>Date</code>, or <code>null</code> if not set
+     * @return the {@code Date}, or {@code null} if not set
      * @see #setDate
      */
     public Date getDate() {
@@ -490,12 +490,12 @@
 
     /**
      * Sets the time for which the validity of the certification path
-     * should be determined. If <code>null</code>, the current time is used.
+     * should be determined. If {@code null}, the current time is used.
      * <p>
-     * Note that the <code>Date</code> supplied here is copied to protect
+     * Note that the {@code Date} supplied here is copied to protect
      * against subsequent modifications.
      *
-     * @param date the <code>Date</code>, or <code>null</code> for the
+     * @param date the {@code Date}, or {@code null} for the
      * current time
      * @see #getDate
      */
@@ -507,39 +507,39 @@
     }
 
     /**
-     * Sets a <code>List</code> of additional certification path checkers. If
-     * the specified <code>List</code> contains an object that is not a
-     * <code>PKIXCertPathChecker</code>, it is ignored.
+     * Sets a {@code List} of additional certification path checkers. If
+     * the specified {@code List} contains an object that is not a
+     * {@code PKIXCertPathChecker}, it is ignored.
      * <p>
-     * Each <code>PKIXCertPathChecker</code> specified implements
+     * Each {@code PKIXCertPathChecker} specified implements
      * additional checks on a certificate. Typically, these are checks to
      * process and verify private extensions contained in certificates.
-     * Each <code>PKIXCertPathChecker</code> should be instantiated with any
+     * Each {@code PKIXCertPathChecker} should be instantiated with any
      * initialization parameters needed to execute the check.
      * <p>
      * This method allows sophisticated applications to extend a PKIX
-     * <code>CertPathValidator</code> or <code>CertPathBuilder</code>.
-     * Each of the specified <code>PKIXCertPathChecker</code>s will be called,
-     * in turn, by a PKIX <code>CertPathValidator</code> or
-     * <code>CertPathBuilder</code> for each certificate processed or
+     * {@code CertPathValidator} or {@code CertPathBuilder}.
+     * Each of the specified {@code PKIXCertPathChecker}s will be called,
+     * in turn, by a PKIX {@code CertPathValidator} or
+     * {@code CertPathBuilder} for each certificate processed or
      * validated.
      * <p>
-     * Regardless of whether these additional <code>PKIXCertPathChecker</code>s
-     * are set, a PKIX <code>CertPathValidator</code> or
-     * <code>CertPathBuilder</code> must perform all of the required PKIX
+     * Regardless of whether these additional {@code PKIXCertPathChecker}s
+     * are set, a PKIX {@code CertPathValidator} or
+     * {@code CertPathBuilder} must perform all of the required PKIX
      * checks on each certificate. The one exception to this rule is if the
      * RevocationEnabled flag is set to false (see the {@link
      * #setRevocationEnabled setRevocationEnabled} method).
      * <p>
-     * Note that the <code>List</code> supplied here is copied and each
-     * <code>PKIXCertPathChecker</code> in the list is cloned to protect
+     * Note that the {@code List} supplied here is copied and each
+     * {@code PKIXCertPathChecker} in the list is cloned to protect
      * against subsequent modifications.
      *
-     * @param checkers a <code>List</code> of <code>PKIXCertPathChecker</code>s.
-     * May be <code>null</code>, in which case no additional checkers will be
+     * @param checkers a {@code List} of {@code PKIXCertPathChecker}s.
+     * May be {@code null}, in which case no additional checkers will be
      * used.
      * @throws ClassCastException if any of the elements in the list
-     * are not of type <code>java.security.cert.PKIXCertPathChecker</code>
+     * are not of type {@code java.security.cert.PKIXCertPathChecker}
      * @see #getCertPathCheckers
      */
     public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) {
@@ -556,14 +556,14 @@
     }
 
     /**
-     * Returns the <code>List</code> of certification path checkers.
-     * The returned <code>List</code> is immutable, and each
-     * <code>PKIXCertPathChecker</code> in the <code>List</code> is cloned
+     * Returns the {@code List} of certification path checkers.
+     * The returned {@code List} is immutable, and each
+     * {@code PKIXCertPathChecker} in the {@code List} is cloned
      * to protect against subsequent modifications.
      *
-     * @return an immutable <code>List</code> of
-     * <code>PKIXCertPathChecker</code>s (may be empty, but not
-     * <code>null</code>)
+     * @return an immutable {@code List} of
+     * {@code PKIXCertPathChecker}s (may be empty, but not
+     * {@code null})
      * @see #setCertPathCheckers
      */
     public List<PKIXCertPathChecker> getCertPathCheckers() {
@@ -575,15 +575,15 @@
     }
 
     /**
-     * Adds a <code>PKIXCertPathChecker</code> to the list of certification
+     * Adds a {@code PKIXCertPathChecker} to the list of certification
      * path checkers. See the {@link #setCertPathCheckers setCertPathCheckers}
      * method for more details.
      * <p>
-     * Note that the <code>PKIXCertPathChecker</code> is cloned to protect
+     * Note that the {@code PKIXCertPathChecker} is cloned to protect
      * against subsequent modifications.
      *
-     * @param checker a <code>PKIXCertPathChecker</code> to add to the list of
-     * checks. If <code>null</code>, the checker is ignored (not added to list).
+     * @param checker a {@code PKIXCertPathChecker} to add to the list of
+     * checks. If {@code null}, the checker is ignored (not added to list).
      */
     public void addCertPathChecker(PKIXCertPathChecker checker) {
         if (checker != null) {
@@ -592,10 +592,10 @@
     }
 
     /**
-     * Returns the signature provider's name, or <code>null</code>
+     * Returns the signature provider's name, or {@code null}
      * if not set.
      *
-     * @return the signature provider's name (or <code>null</code>)
+     * @return the signature provider's name (or {@code null})
      * @see #setSigProvider
      */
     public String getSigProvider() {
@@ -605,10 +605,10 @@
     /**
      * Sets the signature provider's name. The specified provider will be
      * preferred when creating {@link java.security.Signature Signature}
-     * objects. If <code>null</code> or not set, the first provider found
+     * objects. If {@code null} or not set, the first provider found
      * supporting the algorithm will be used.
      *
-     * @param sigProvider the signature provider's name (or <code>null</code>)
+     * @param sigProvider the signature provider's name (or {@code null})
      * @see #getSigProvider
     */
     public void setSigProvider(String sigProvider) {
@@ -617,14 +617,14 @@
 
     /**
      * Returns the required constraints on the target certificate.
-     * The constraints are returned as an instance of <code>CertSelector</code>.
-     * If <code>null</code>, no constraints are defined.
+     * The constraints are returned as an instance of {@code CertSelector}.
+     * If {@code null}, no constraints are defined.
      *
-     * <p>Note that the <code>CertSelector</code> returned is cloned
+     * <p>Note that the {@code CertSelector} returned is cloned
      * to protect against subsequent modifications.
      *
-     * @return a <code>CertSelector</code> specifying the constraints
-     * on the target certificate (or <code>null</code>)
+     * @return a {@code CertSelector} specifying the constraints
+     * on the target certificate (or {@code null})
      * @see #setTargetCertConstraints
      */
     public CertSelector getTargetCertConstraints() {
@@ -638,14 +638,14 @@
     /**
      * Sets the required constraints on the target certificate.
      * The constraints are specified as an instance of
-     * <code>CertSelector</code>. If <code>null</code>, no constraints are
+     * {@code CertSelector}. If {@code null}, no constraints are
      * defined.
      *
-     * <p>Note that the <code>CertSelector</code> specified is cloned
+     * <p>Note that the {@code CertSelector} specified is cloned
      * to protect against subsequent modifications.
      *
-     * @param selector a <code>CertSelector</code> specifying the constraints
-     * on the target certificate (or <code>null</code>)
+     * @param selector a {@code CertSelector} specifying the constraints
+     * on the target certificate (or {@code null})
      * @see #getTargetCertConstraints
      */
     public void setTargetCertConstraints(CertSelector selector) {
@@ -656,10 +656,10 @@
     }
 
     /**
-     * Makes a copy of this <code>PKIXParameters</code> object. Changes
+     * Makes a copy of this {@code PKIXParameters} object. Changes
      * to the copy will not affect the original and vice versa.
      *
-     * @return a copy of this <code>PKIXParameters</code> object
+     * @return a copy of this {@code PKIXParameters} object
      */
     public Object clone() {
         try {
@@ -683,7 +683,7 @@
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
diff --git a/ojluni/src/main/java/java/security/cert/PKIXReason.java b/ojluni/src/main/java/java/security/cert/PKIXReason.java
index 9d81b13..d58ded9 100644
--- a/ojluni/src/main/java/java/security/cert/PKIXReason.java
+++ b/ojluni/src/main/java/java/security/cert/PKIXReason.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -26,10 +26,10 @@
 package java.security.cert;
 
 /**
- * The <code>PKIXReason</code> enumerates the potential PKIX-specific reasons
+ * The {@code PKIXReason} enumerates the potential PKIX-specific reasons
  * that an X.509 certification path may be invalid according to the PKIX
  * (RFC 3280) standard. These reasons are in addition to those of the
- * <code>CertPathValidatorException.BasicReason</code> enumeration.
+ * {@code CertPathValidatorException.BasicReason} enumeration.
  *
  * @since 1.7
  */
diff --git a/ojluni/src/main/java/java/security/cert/PolicyNode.java b/ojluni/src/main/java/java/security/cert/PolicyNode.java
index 7b16dfe..1633dcb 100644
--- a/ojluni/src/main/java/java/security/cert/PolicyNode.java
+++ b/ojluni/src/main/java/java/security/cert/PolicyNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -41,7 +41,7 @@
  *
  * <p>Most applications will not need to examine the valid policy tree.
  * They can achieve their policy processing goals by setting the
- * policy-related parameters in <code>PKIXParameters</code>. However,
+ * policy-related parameters in {@code PKIXParameters}. However,
  * the valid policy tree is available for more sophisticated applications,
  * especially those that process policy qualifiers.
  *
@@ -50,12 +50,12 @@
  * valid policy tree. The tree can be traversed using the
  * {@link #getChildren getChildren} and {@link #getParent getParent} methods.
  * Data about a particular node can be retrieved using other methods of
- * <code>PolicyNode</code>.
+ * {@code PolicyNode}.
  *
  * <p><b>Concurrent Access</b>
- * <p>All <code>PolicyNode</code> objects must be immutable and
+ * <p>All {@code PolicyNode} objects must be immutable and
  * thread-safe. Multiple threads may concurrently invoke the methods defined
- * in this class on a single <code>PolicyNode</code> object (or more than one)
+ * in this class on a single {@code PolicyNode} object (or more than one)
  * with no ill effects. This stipulation applies to all public fields and
  * methods of this class and any added or overridden by subclasses.
  *
@@ -65,10 +65,10 @@
 public interface PolicyNode {
 
     /**
-     * Returns the parent of this node, or <code>null</code> if this is the
+     * Returns the parent of this node, or {@code null} if this is the
      * root node.
      *
-     * @return the parent of this node, or <code>null</code> if this is the
+     * @return the parent of this node, or {@code null} if this is the
      * root node
      */
     PolicyNode getParent();
@@ -76,8 +76,8 @@
     /**
      * Returns an iterator over the children of this node. Any attempts to
      * modify the children of this node through the
-     * <code>Iterator</code>'s remove method must throw an
-     * <code>UnsupportedOperationException</code>.
+     * {@code Iterator}'s remove method must throw an
+     * {@code UnsupportedOperationException}.
      *
      * @return an iterator over the children of this node
      */
@@ -94,7 +94,7 @@
     /**
      * Returns the valid policy represented by this node.
      *
-     * @return the <code>String</code> OID of the valid policy
+     * @return the {@code String} OID of the valid policy
      * represented by this node. For the root node, this method always returns
      * the special anyPolicy OID: "2.5.29.32.0".
      */
@@ -104,9 +104,9 @@
      * Returns the set of policy qualifiers associated with the
      * valid policy represented by this node.
      *
-     * @return an immutable <code>Set</code> of
-     * <code>PolicyQualifierInfo</code>s. For the root node, this
-     * is always an empty <code>Set</code>.
+     * @return an immutable {@code Set} of
+     * {@code PolicyQualifierInfo}s. For the root node, this
+     * is always an empty {@code Set}.
      */
     Set<? extends PolicyQualifierInfo> getPolicyQualifiers();
 
@@ -114,9 +114,9 @@
      * Returns the set of expected policies that would satisfy this
      * node's valid policy in the next certificate to be processed.
      *
-     * @return an immutable <code>Set</code> of expected policy
-     * <code>String</code> OIDs. For the root node, this method
-     * always returns a <code>Set</code> with one element, the
+     * @return an immutable {@code Set} of expected policy
+     * {@code String} OIDs. For the root node, this method
+     * always returns a {@code Set} with one element, the
      * special anyPolicy OID: "2.5.29.32.0".
      */
     Set<String> getExpectedPolicies();
@@ -125,8 +125,8 @@
      * Returns the criticality indicator of the certificate policy extension
      * in the most recently processed certificate.
      *
-     * @return <code>true</code> if extension marked critical,
-     * <code>false</code> otherwise. For the root node, <code>false</code>
+     * @return {@code true} if extension marked critical,
+     * {@code false} otherwise. For the root node, {@code false}
      * is always returned.
      */
     boolean isCritical();
diff --git a/ojluni/src/main/java/java/security/cert/PolicyQualifierInfo.java b/ojluni/src/main/java/java/security/cert/PolicyQualifierInfo.java
index 75a8702..ec06a88 100644
--- a/ojluni/src/main/java/java/security/cert/PolicyQualifierInfo.java
+++ b/ojluni/src/main/java/java/security/cert/PolicyQualifierInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -35,7 +35,7 @@
  * structure.
  *
  * <p>The ASN.1 definition is as follows:
- * <p><pre>
+ * <pre>
  *   PolicyQualifierInfo ::= SEQUENCE {
  *        policyQualifierId       PolicyQualifierId,
  *        qualifier               ANY DEFINED BY policyQualifierId }
@@ -50,12 +50,12 @@
  * policy information terms limit the set of policies for certification paths
  * which include this certificate.
  * <p>
- * A <code>Set</code> of <code>PolicyQualifierInfo</code> objects are returned
+ * A {@code Set} of {@code PolicyQualifierInfo} objects are returned
  * by the {@link PolicyNode#getPolicyQualifiers PolicyNode.getPolicyQualifiers}
  * method. This allows applications with specific policy requirements to
  * process and validate each policy qualifier. Applications that need to
  * process policy qualifiers should explicitly set the
- * <code>policyQualifiersRejected</code> flag to false (by calling the
+ * {@code policyQualifiersRejected} flag to false (by calling the
  * {@link PKIXParameters#setPolicyQualifiersRejected
  * PKIXParameters.setPolicyQualifiersRejected} method) before validating
  * a certification path.
@@ -64,17 +64,17 @@
  * that any policy qualifier in a certificate policies extension that is
  * marked critical must be processed and validated. Otherwise the
  * certification path must be rejected. If the
- * <code>policyQualifiersRejected</code> flag is set to false, it is up to
+ * {@code policyQualifiersRejected} flag is set to false, it is up to
  * the application to validate all policy qualifiers in this manner in order
  * to be PKIX compliant.
  *
  * <p><b>Concurrent Access</b>
  *
- * <p>All <code>PolicyQualifierInfo</code> objects must be immutable and
+ * <p>All {@code PolicyQualifierInfo} objects must be immutable and
  * thread-safe. That is, multiple threads may concurrently invoke the
- * methods defined in this class on a single <code>PolicyQualifierInfo</code>
+ * methods defined in this class on a single {@code PolicyQualifierInfo}
  * object (or more than one) with no ill effects. Requiring
- * <code>PolicyQualifierInfo</code> objects to be immutable and thread-safe
+ * {@code PolicyQualifierInfo} objects to be immutable and thread-safe
  * allows them to be passed around to various pieces of code without
  * worrying about coordinating access.
  *
@@ -90,7 +90,7 @@
     private String pqiString;
 
     /**
-     * Creates an instance of <code>PolicyQualifierInfo</code> from the
+     * Creates an instance of {@code PolicyQualifierInfo} from the
      * encoded bytes. The encoded byte array is copied on construction.
      *
      * @param encoded a byte array containing the qualifier in DER encoding
@@ -115,12 +115,12 @@
     }
 
     /**
-     * Returns the <code>policyQualifierId</code> field of this
-     * <code>PolicyQualifierInfo</code>. The <code>policyQualifierId</code>
+     * Returns the {@code policyQualifierId} field of this
+     * {@code PolicyQualifierInfo}. The {@code policyQualifierId}
      * is an Object Identifier (OID) represented by a set of nonnegative
      * integers separated by periods.
      *
-     * @return the OID (never <code>null</code>)
+     * @return the OID (never {@code null})
      */
     public final String getPolicyQualifierId() {
         return mId;
@@ -128,9 +128,9 @@
 
     /**
      * Returns the ASN.1 DER encoded form of this
-     * <code>PolicyQualifierInfo</code>.
+     * {@code PolicyQualifierInfo}.
      *
-     * @return the ASN.1 DER encoded bytes (never <code>null</code>).
+     * @return the ASN.1 DER encoded bytes (never {@code null}).
      * Note that a copy is returned, so the data is cloned each time
      * this method is called.
      */
@@ -139,10 +139,10 @@
     }
 
     /**
-     * Returns the ASN.1 DER encoded form of the <code>qualifier</code>
-     * field of this <code>PolicyQualifierInfo</code>.
+     * Returns the ASN.1 DER encoded form of the {@code qualifier}
+     * field of this {@code PolicyQualifierInfo}.
      *
-     * @return the ASN.1 DER encoded bytes of the <code>qualifier</code>
+     * @return the ASN.1 DER encoded bytes of the {@code qualifier}
      * field. Note that a copy is returned, so the data is cloned each
      * time this method is called.
      */
@@ -152,10 +152,10 @@
 
     /**
      * Return a printable representation of this
-     * <code>PolicyQualifierInfo</code>.
+     * {@code PolicyQualifierInfo}.
      *
-     * @return a <code>String</code> describing the contents of this
-     *         <code>PolicyQualifierInfo</code>
+     * @return a {@code String} describing the contents of this
+     *         {@code PolicyQualifierInfo}
      */
     public String toString() {
         if (pqiString != null)
diff --git a/ojluni/src/main/java/java/security/cert/TrustAnchor.java b/ojluni/src/main/java/java/security/cert/TrustAnchor.java
index d9c88f4..c98bf81 100644
--- a/ojluni/src/main/java/java/security/cert/TrustAnchor.java
+++ b/ojluni/src/main/java/java/security/cert/TrustAnchor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -40,16 +40,15 @@
  * for validating X.509 certification paths. A most-trusted CA includes the
  * public key of the CA, the CA's name, and any constraints upon the set of
  * paths which may be validated using this key. These parameters can be
- * specified in the form of a trusted <code>X509Certificate</code> or as
+ * specified in the form of a trusted {@code X509Certificate} or as
  * individual parameters.
  * <p>
  * <b>Concurrent Access</b>
- * <p>
- * <p>All <code>TrustAnchor</code> objects must be immutable and
+ * <p>All {@code TrustAnchor} objects must be immutable and
  * thread-safe. That is, multiple threads may concurrently invoke the
- * methods defined in this class on a single <code>TrustAnchor</code>
+ * methods defined in this class on a single {@code TrustAnchor}
  * object (or more than one) with no ill effects. Requiring
- * <code>TrustAnchor</code> objects to be immutable and thread-safe
+ * {@code TrustAnchor} objects to be immutable and thread-safe
  * allows them to be passed around to various pieces of code without
  * worrying about coordinating access. This stipulation applies to all
  * public fields and methods of this class and any added or overridden
@@ -71,8 +70,8 @@
     private NameConstraintsExtension nc;
 
     /**
-     * Creates an instance of <code>TrustAnchor</code> with the specified
-     * <code>X509Certificate</code> and optional name constraints, which
+     * Creates an instance of {@code TrustAnchor} with the specified
+     * {@code X509Certificate} and optional name constraints, which
      * are intended to be used as additional constraints when validating
      * an X.509 certification path.
      * <p>
@@ -82,7 +81,7 @@
      * <a href="http://www.ietf.org/rfc/rfc3280">RFC 3280</a>
      * and X.509. The ASN.1 definition of this structure appears below.
      *
-     * <pre><code>
+     * <pre>{@code
      *  NameConstraints ::= SEQUENCE {
      *       permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
      *       excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
@@ -106,20 +105,20 @@
      *       uniformResourceIdentifier       [6]     IA5String,
      *       iPAddress                       [7]     OCTET STRING,
      *       registeredID                    [8]     OBJECT IDENTIFIER}
-     * </code></pre>
+     * }</pre>
      * <p>
      * Note that the name constraints byte array supplied is cloned to protect
      * against subsequent modifications.
      *
-     * @param trustedCert a trusted <code>X509Certificate</code>
+     * @param trustedCert a trusted {@code X509Certificate}
      * @param nameConstraints a byte array containing the ASN.1 DER encoding of
      * a NameConstraints extension to be used for checking name constraints.
      * Only the value of the extension is included, not the OID or criticality
-     * flag. Specify <code>null</code> to omit the parameter.
+     * flag. Specify {@code null} to omit the parameter.
      * @throws IllegalArgumentException if the name constraints cannot be
      * decoded
      * @throws NullPointerException if the specified
-     * <code>X509Certificate</code> is <code>null</code>
+     * {@code X509Certificate} is {@code null}
      */
     public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)
     {
@@ -134,7 +133,7 @@
     }
 
     /**
-     * Creates an instance of <code>TrustAnchor</code> where the
+     * Creates an instance of {@code TrustAnchor} where the
      * most-trusted CA is specified as an X500Principal and public key.
      * Name constraints are an optional parameter, and are intended to be used
      * as additional constraints when validating an X.509 certification path.
@@ -155,9 +154,9 @@
      * @param nameConstraints a byte array containing the ASN.1 DER encoding of
      * a NameConstraints extension to be used for checking name constraints.
      * Only the value of the extension is included, not the OID or criticality
-     * flag. Specify <code>null</code> to omit the parameter.
-     * @throws NullPointerException if the specified <code>caPrincipal</code> or
-     * <code>pubKey</code> parameter is <code>null</code>
+     * flag. Specify {@code null} to omit the parameter.
+     * @throws NullPointerException if the specified {@code caPrincipal} or
+     * {@code pubKey} parameter is {@code null}
      * @since 1.5
      */
     public TrustAnchor(X500Principal caPrincipal, PublicKey pubKey,
@@ -173,7 +172,7 @@
     }
 
     /**
-     * Creates an instance of <code>TrustAnchor</code> where the
+     * Creates an instance of {@code TrustAnchor} where the
      * most-trusted CA is specified as a distinguished name and public key.
      * Name constraints are an optional parameter, and are intended to be used
      * as additional constraints when validating an X.509 certification path.
@@ -191,17 +190,17 @@
      *
      * @param caName the X.500 distinguished name of the most-trusted CA in
      * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
-     * <code>String</code> format
+     * {@code String} format
      * @param pubKey the public key of the most-trusted CA
      * @param nameConstraints a byte array containing the ASN.1 DER encoding of
      * a NameConstraints extension to be used for checking name constraints.
      * Only the value of the extension is included, not the OID or criticality
-     * flag. Specify <code>null</code> to omit the parameter.
-     * @throws IllegalArgumentException if the specified <code>
-     * caName</code> parameter is empty <code>(caName.length() == 0)</code>
+     * flag. Specify {@code null} to omit the parameter.
+     * @throws IllegalArgumentException if the specified
+     * {@code caName} parameter is empty {@code (caName.length() == 0)}
      * or incorrectly formatted or the name constraints cannot be decoded
-     * @throws NullPointerException if the specified <code>caName</code> or
-     * <code>pubKey</code> parameter is <code>null</code>
+     * @throws NullPointerException if the specified {@code caName} or
+     * {@code pubKey} parameter is {@code null}
      */
     public TrustAnchor(String caName, PublicKey pubKey, byte[] nameConstraints)
     {
@@ -225,7 +224,7 @@
     /**
      * Returns the most-trusted CA certificate.
      *
-     * @return a trusted <code>X509Certificate</code> or <code>null</code>
+     * @return a trusted {@code X509Certificate} or {@code null}
      * if the trust anchor was not specified as a trusted certificate
      */
     public final X509Certificate getTrustedCert() {
@@ -236,7 +235,7 @@
      * Returns the name of the most-trusted CA as an X500Principal.
      *
      * @return the X.500 distinguished name of the most-trusted CA, or
-     * <code>null</code> if the trust anchor was not specified as a trusted
+     * {@code null} if the trust anchor was not specified as a trusted
      * public key and name or X500Principal pair
      * @since 1.5
      */
@@ -245,11 +244,11 @@
     }
 
     /**
-     * Returns the name of the most-trusted CA in RFC 2253 <code>String</code>
+     * Returns the name of the most-trusted CA in RFC 2253 {@code String}
      * format.
      *
      * @return the X.500 distinguished name of the most-trusted CA, or
-     * <code>null</code> if the trust anchor was not specified as a trusted
+     * {@code null} if the trust anchor was not specified as a trusted
      * public key and name or X500Principal pair
      */
     public final String getCAName() {
@@ -259,7 +258,7 @@
     /**
      * Returns the public key of the most-trusted CA.
      *
-     * @return the public key of the most-trusted CA, or <code>null</code>
+     * @return the public key of the most-trusted CA, or {@code null}
      * if the trust anchor was not specified as a trusted public key and name
      * or X500Principal pair
      */
@@ -306,16 +305,16 @@
      *
      * @return a byte array containing the ASN.1 DER encoding of
      *         a NameConstraints extension used for checking name constraints,
-     *         or <code>null</code> if not set.
+     *         or {@code null} if not set.
      */
     public final byte [] getNameConstraints() {
         return ncBytes == null ? null : ncBytes.clone();
     }
 
     /**
-     * Returns a formatted string describing the <code>TrustAnchor</code>.
+     * Returns a formatted string describing the {@code TrustAnchor}.
      *
-     * @return a formatted string describing the <code>TrustAnchor</code>
+     * @return a formatted string describing the {@code TrustAnchor}
      */
     public String toString() {
         StringBuffer sb = new StringBuffer();
diff --git a/ojluni/src/main/java/java/security/cert/X509CRLEntry.java b/ojluni/src/main/java/java/security/cert/X509CRLEntry.java
index 517bbd2..268fa81 100644
--- a/ojluni/src/main/java/java/security/cert/X509CRLEntry.java
+++ b/ojluni/src/main/java/java/security/cert/X509CRLEntry.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -43,11 +43,11 @@
  *     crlEntryExtensions Extensions OPTIONAL
  *                        -- if present, must be v2
  * }  OPTIONAL
- *<p>
+ *
  * CertificateSerialNumber  ::=  INTEGER
- *<p>
+ *
  * Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
- *<p>
+ *
  * Extension  ::=  SEQUENCE  {
  *     extnId        OBJECT IDENTIFIER,
  *     critical      BOOLEAN DEFAULT FALSE,
@@ -68,8 +68,8 @@
 
     /**
      * Compares this CRL entry for equality with the given
-     * object. If the <code>other</code> object is an
-     * <code>instanceof</code> <code>X509CRLEntry</code>, then
+     * object. If the {@code other} object is an
+     * {@code instanceof} {@code X509CRLEntry}, then
      * its encoded form (the inner SEQUENCE) is retrieved and compared
      * with the encoded form of this CRL entry.
      *
@@ -178,7 +178,7 @@
      * in the Reason Code extension of this CRL entry.
      *
      * @return the reason the certificate has been revoked, or
-     *    <code>null</code> if this CRL entry does not have
+     *    {@code null} if this CRL entry does not have
      *    a Reason Code extension
      * @since 1.7
      */
diff --git a/ojluni/src/main/java/java/security/cert/X509CRLSelector.java b/ojluni/src/main/java/java/security/cert/X509CRLSelector.java
index 7e702d2..face5ff 100644
--- a/ojluni/src/main/java/java/security/cert/X509CRLSelector.java
+++ b/ojluni/src/main/java/java/security/cert/X509CRLSelector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -37,18 +37,18 @@
 import sun.security.x509.X500Name;
 
 /**
- * A <code>CRLSelector</code> that selects <code>X509CRLs</code> that
+ * A {@code CRLSelector} that selects {@code X509CRLs} that
  * match all specified criteria. This class is particularly useful when
- * selecting CRLs from a <code>CertStore</code> to check revocation status
+ * selecting CRLs from a {@code CertStore} to check revocation status
  * of a particular certificate.
  * <p>
- * When first constructed, an <code>X509CRLSelector</code> has no criteria
- * enabled and each of the <code>get</code> methods return a default
- * value (<code>null</code>). Therefore, the {@link #match match} method
- * would return <code>true</code> for any <code>X509CRL</code>. Typically,
+ * When first constructed, an {@code X509CRLSelector} has no criteria
+ * enabled and each of the {@code get} methods return a default
+ * value ({@code null}). Therefore, the {@link #match match} method
+ * would return {@code true} for any {@code X509CRL}. Typically,
  * several criteria are enabled (by calling {@link #setIssuers setIssuers}
  * or {@link #setDateAndTime setDateAndTime}, for instance) and then the
- * <code>X509CRLSelector</code> is passed to
+ * {@code X509CRLSelector} is passed to
  * {@link CertStore#getCRLs CertStore.getCRLs} or some similar
  * method.
  * <p>
@@ -86,35 +86,35 @@
     private long skew = 0;
 
     /**
-     * Creates an <code>X509CRLSelector</code>. Initially, no criteria are set
-     * so any <code>X509CRL</code> will match.
+     * Creates an {@code X509CRLSelector}. Initially, no criteria are set
+     * so any {@code X509CRL} will match.
      */
     public X509CRLSelector() {}
 
     /**
      * Sets the issuerNames criterion. The issuer distinguished name in the
-     * <code>X509CRL</code> must match at least one of the specified
-     * distinguished names. If <code>null</code>, any issuer distinguished name
+     * {@code X509CRL} must match at least one of the specified
+     * distinguished names. If {@code null}, any issuer distinguished name
      * will do.
      * <p>
      * This method allows the caller to specify, with a single method call,
-     * the complete set of issuer names which <code>X509CRLs</code> may contain.
+     * the complete set of issuer names which {@code X509CRLs} may contain.
      * The specified value replaces the previous value for the issuerNames
      * criterion.
      * <p>
-     * The <code>names</code> parameter (if not <code>null</code>) is a
-     * <code>Collection</code> of <code>X500Principal</code>s.
+     * The {@code names} parameter (if not {@code null}) is a
+     * {@code Collection} of {@code X500Principal}s.
      * <p>
-     * Note that the <code>names</code> parameter can contain duplicate
+     * Note that the {@code names} parameter can contain duplicate
      * distinguished names, but they may be removed from the
-     * <code>Collection</code> of names returned by the
+     * {@code Collection} of names returned by the
      * {@link #getIssuers getIssuers} method.
      * <p>
-     * Note that a copy is performed on the <code>Collection</code> to
+     * Note that a copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @param issuers a <code>Collection</code> of X500Principals
-     *   (or <code>null</code>)
+     * @param issuers a {@code Collection} of X500Principals
+     *   (or {@code null})
      * @see #getIssuers
      * @since 1.5
      */
@@ -138,31 +138,31 @@
      * this method. See {@link #addIssuerName(String)} for more information.
      * <p>
      * Sets the issuerNames criterion. The issuer distinguished name in the
-     * <code>X509CRL</code> must match at least one of the specified
-     * distinguished names. If <code>null</code>, any issuer distinguished name
+     * {@code X509CRL} must match at least one of the specified
+     * distinguished names. If {@code null}, any issuer distinguished name
      * will do.
      * <p>
      * This method allows the caller to specify, with a single method call,
-     * the complete set of issuer names which <code>X509CRLs</code> may contain.
+     * the complete set of issuer names which {@code X509CRLs} may contain.
      * The specified value replaces the previous value for the issuerNames
      * criterion.
      * <p>
-     * The <code>names</code> parameter (if not <code>null</code>) is a
-     * <code>Collection</code> of names. Each name is a <code>String</code>
+     * The {@code names} parameter (if not {@code null}) is a
+     * {@code Collection} of names. Each name is a {@code String}
      * or a byte array representing a distinguished name (in
      * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> or
-     * ASN.1 DER encoded form, respectively). If <code>null</code> is supplied
+     * ASN.1 DER encoded form, respectively). If {@code null} is supplied
      * as the value for this argument, no issuerNames check will be performed.
      * <p>
-     * Note that the <code>names</code> parameter can contain duplicate
+     * Note that the {@code names} parameter can contain duplicate
      * distinguished names, but they may be removed from the
-     * <code>Collection</code> of names returned by the
+     * {@code Collection} of names returned by the
      * {@link #getIssuerNames getIssuerNames} method.
      * <p>
      * If a name is specified as a byte array, it should contain a single DER
      * encoded distinguished name, as defined in X.501. The ASN.1 notation for
      * this structure is as follows.
-     * <pre><code>
+     * <pre>{@code
      * Name ::= CHOICE {
      *   RDNSequence }
      *
@@ -185,12 +185,12 @@
      *       universalString         UniversalString (SIZE (1..MAX)),
      *       utf8String              UTF8String (SIZE (1.. MAX)),
      *       bmpString               BMPString (SIZE (1..MAX)) }
-     * </code></pre>
+     * }</pre>
      * <p>
-     * Note that a deep copy is performed on the <code>Collection</code> to
+     * Note that a deep copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @param names a <code>Collection</code> of names (or <code>null</code>)
+     * @param names a {@code Collection} of names (or {@code null})
      * @throws IOException if a parsing error occurs
      * @see #getIssuerNames
      */
@@ -208,11 +208,11 @@
 
     /**
      * Adds a name to the issuerNames criterion. The issuer distinguished
-     * name in the <code>X509CRL</code> must match at least one of the specified
+     * name in the {@code X509CRL} must match at least one of the specified
      * distinguished names.
      * <p>
      * This method allows the caller to add a name to the set of issuer names
-     * which <code>X509CRLs</code> may contain. The specified name is added to
+     * which {@code X509CRLs} may contain. The specified name is added to
      * any previous value for the issuerNames criterion.
      * If the specified name is a duplicate, it may be ignored.
      *
@@ -232,11 +232,11 @@
      * names.
      * <p>
      * Adds a name to the issuerNames criterion. The issuer distinguished
-     * name in the <code>X509CRL</code> must match at least one of the specified
+     * name in the {@code X509CRL} must match at least one of the specified
      * distinguished names.
      * <p>
      * This method allows the caller to add a name to the set of issuer names
-     * which <code>X509CRLs</code> may contain. The specified name is added to
+     * which {@code X509CRLs} may contain. The specified name is added to
      * any previous value for the issuerNames criterion.
      * If the specified name is a duplicate, it may be ignored.
      *
@@ -249,11 +249,11 @@
 
     /**
      * Adds a name to the issuerNames criterion. The issuer distinguished
-     * name in the <code>X509CRL</code> must match at least one of the specified
+     * name in the {@code X509CRL} must match at least one of the specified
      * distinguished names.
      * <p>
      * This method allows the caller to add a name to the set of issuer names
-     * which <code>X509CRLs</code> may contain. The specified name is added to
+     * which {@code X509CRLs} may contain. The specified name is added to
      * any previous value for the issuerNames criterion. If the specified name
      * is a duplicate, it may be ignored.
      * If a name is specified as a byte array, it should contain a single DER
@@ -279,7 +279,7 @@
     /**
      * A private method that adds a name (String or byte array) to the
      * issuerNames criterion. The issuer distinguished
-     * name in the <code>X509CRL</code> must match at least one of the specified
+     * name in the {@code X509CRL} must match at least one of the specified
      * distinguished names.
      *
      * @param name the name in string or byte array form
@@ -301,11 +301,11 @@
      * Clone and check an argument of the form passed to
      * setIssuerNames. Throw an IOException if the argument is malformed.
      *
-     * @param names a <code>Collection</code> of names. Each entry is a
+     * @param names a {@code Collection} of names. Each entry is a
      *              String or a byte array (the name, in string or ASN.1
-     *              DER encoded form, respectively). <code>null</code> is
+     *              DER encoded form, respectively). {@code null} is
      *              not an acceptable value.
-     * @return a deep copy of the specified <code>Collection</code>
+     * @return a deep copy of the specified {@code Collection}
      * @throws IOException if a parsing error occurs
      */
     private static HashSet<Object> cloneAndCheckIssuerNames(Collection<?> names)
@@ -334,11 +334,11 @@
      * into a RuntimeException. This method should be used when the object being
      * cloned has already been checked, so there should never be any exceptions.
      *
-     * @param names a <code>Collection</code> of names. Each entry is a
+     * @param names a {@code Collection} of names. Each entry is a
      *              String or a byte array (the name, in string or ASN.1
-     *              DER encoded form, respectively). <code>null</code> is
+     *              DER encoded form, respectively). {@code null} is
      *              not an acceptable value.
-     * @return a deep copy of the specified <code>Collection</code>
+     * @return a deep copy of the specified {@code Collection}
      * @throws RuntimeException if a parsing error occurs
      */
     private static HashSet<Object> cloneIssuerNames(Collection<Object> names) {
@@ -354,7 +354,7 @@
      * returning a Collection of issuerX500Principals.
      * Throw an IOException if the argument is malformed.
      *
-     * @param names a <code>Collection</code> of names. Each entry is a
+     * @param names a {@code Collection} of names. Each entry is a
      *              String or a byte array (the name, in string or ASN.1
      *              DER encoded form, respectively). <Code>Null</Code> is
      *              not an acceptable value.
@@ -380,24 +380,24 @@
     }
 
     /**
-     * Sets the minCRLNumber criterion. The <code>X509CRL</code> must have a
+     * Sets the minCRLNumber criterion. The {@code X509CRL} must have a
      * CRL number extension whose value is greater than or equal to the
-     * specified value. If <code>null</code>, no minCRLNumber check will be
+     * specified value. If {@code null}, no minCRLNumber check will be
      * done.
      *
-     * @param minCRL the minimum CRL number accepted (or <code>null</code>)
+     * @param minCRL the minimum CRL number accepted (or {@code null})
      */
     public void setMinCRLNumber(BigInteger minCRL) {
         this.minCRL = minCRL;
     }
 
     /**
-     * Sets the maxCRLNumber criterion. The <code>X509CRL</code> must have a
+     * Sets the maxCRLNumber criterion. The {@code X509CRL} must have a
      * CRL number extension whose value is less than or equal to the
-     * specified value. If <code>null</code>, no maxCRLNumber check will be
+     * specified value. If {@code null}, no maxCRLNumber check will be
      * done.
      *
-     * @param maxCRL the maximum CRL number accepted (or <code>null</code>)
+     * @param maxCRL the maximum CRL number accepted (or {@code null})
      */
     public void setMaxCRLNumber(BigInteger maxCRL) {
         this.maxCRL = maxCRL;
@@ -406,16 +406,16 @@
     /**
      * Sets the dateAndTime criterion. The specified date must be
      * equal to or later than the value of the thisUpdate component
-     * of the <code>X509CRL</code> and earlier than the value of the
-     * nextUpdate component. There is no match if the <code>X509CRL</code>
+     * of the {@code X509CRL} and earlier than the value of the
+     * nextUpdate component. There is no match if the {@code X509CRL}
      * does not contain a nextUpdate component.
-     * If <code>null</code>, no dateAndTime check will be done.
+     * If {@code null}, no dateAndTime check will be done.
      * <p>
-     * Note that the <code>Date</code> supplied here is cloned to protect
+     * Note that the {@code Date} supplied here is cloned to protect
      * against subsequent modifications.
      *
-     * @param dateAndTime the <code>Date</code> to match against
-     *                    (or <code>null</code>)
+     * @param dateAndTime the {@code Date} to match against
+     *                    (or {@code null})
      * @see #getDateAndTime
      */
     public void setDateAndTime(Date dateAndTime) {
@@ -438,13 +438,13 @@
 
     /**
      * Sets the certificate being checked. This is not a criterion. Rather,
-     * it is optional information that may help a <code>CertStore</code>
+     * it is optional information that may help a {@code CertStore}
      * find CRLs that would be relevant when checking revocation for the
-     * specified certificate. If <code>null</code> is specified, then no
+     * specified certificate. If {@code null} is specified, then no
      * such optional information is provided.
      *
-     * @param cert the <code>X509Certificate</code> being checked
-     *             (or <code>null</code>)
+     * @param cert the {@code X509Certificate} being checked
+     *             (or {@code null})
      * @see #getCertificateChecking
      */
     public void setCertificateChecking(X509Certificate cert) {
@@ -453,15 +453,15 @@
 
     /**
      * Returns the issuerNames criterion. The issuer distinguished
-     * name in the <code>X509CRL</code> must match at least one of the specified
-     * distinguished names. If the value returned is <code>null</code>, any
+     * name in the {@code X509CRL} must match at least one of the specified
+     * distinguished names. If the value returned is {@code null}, any
      * issuer distinguished name will do.
      * <p>
-     * If the value returned is not <code>null</code>, it is a
-     * unmodifiable <code>Collection</code> of <code>X500Principal</code>s.
+     * If the value returned is not {@code null}, it is a
+     * unmodifiable {@code Collection} of {@code X500Principal}s.
      *
-     * @return an unmodifiable <code>Collection</code> of names
-     *   (or <code>null</code>)
+     * @return an unmodifiable {@code Collection} of names
+     *   (or {@code null})
      * @see #setIssuers
      * @since 1.5
      */
@@ -474,25 +474,25 @@
 
     /**
      * Returns a copy of the issuerNames criterion. The issuer distinguished
-     * name in the <code>X509CRL</code> must match at least one of the specified
-     * distinguished names. If the value returned is <code>null</code>, any
+     * name in the {@code X509CRL} must match at least one of the specified
+     * distinguished names. If the value returned is {@code null}, any
      * issuer distinguished name will do.
      * <p>
-     * If the value returned is not <code>null</code>, it is a
-     * <code>Collection</code> of names. Each name is a <code>String</code>
+     * If the value returned is not {@code null}, it is a
+     * {@code Collection} of names. Each name is a {@code String}
      * or a byte array representing a distinguished name (in RFC 2253 or
      * ASN.1 DER encoded form, respectively).  Note that the
-     * <code>Collection</code> returned may contain duplicate names.
+     * {@code Collection} returned may contain duplicate names.
      * <p>
      * If a name is specified as a byte array, it should contain a single DER
      * encoded distinguished name, as defined in X.501. The ASN.1 notation for
      * this structure is given in the documentation for
      * {@link #setIssuerNames setIssuerNames(Collection names)}.
      * <p>
-     * Note that a deep copy is performed on the <code>Collection</code> to
+     * Note that a deep copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @return a <code>Collection</code> of names (or <code>null</code>)
+     * @return a {@code Collection} of names (or {@code null})
      * @see #setIssuerNames
      */
     public Collection<Object> getIssuerNames() {
@@ -503,23 +503,23 @@
     }
 
     /**
-     * Returns the minCRLNumber criterion. The <code>X509CRL</code> must have a
+     * Returns the minCRLNumber criterion. The {@code X509CRL} must have a
      * CRL number extension whose value is greater than or equal to the
-     * specified value. If <code>null</code>, no minCRLNumber check will be done.
+     * specified value. If {@code null}, no minCRLNumber check will be done.
      *
-     * @return the minimum CRL number accepted (or <code>null</code>)
+     * @return the minimum CRL number accepted (or {@code null})
      */
     public BigInteger getMinCRL() {
         return minCRL;
     }
 
     /**
-     * Returns the maxCRLNumber criterion. The <code>X509CRL</code> must have a
+     * Returns the maxCRLNumber criterion. The {@code X509CRL} must have a
      * CRL number extension whose value is less than or equal to the
-     * specified value. If <code>null</code>, no maxCRLNumber check will be
+     * specified value. If {@code null}, no maxCRLNumber check will be
      * done.
      *
-     * @return the maximum CRL number accepted (or <code>null</code>)
+     * @return the maximum CRL number accepted (or {@code null})
      */
     public BigInteger getMaxCRL() {
         return maxCRL;
@@ -528,15 +528,15 @@
     /**
      * Returns the dateAndTime criterion. The specified date must be
      * equal to or later than the value of the thisUpdate component
-     * of the <code>X509CRL</code> and earlier than the value of the
+     * of the {@code X509CRL} and earlier than the value of the
      * nextUpdate component. There is no match if the
-     * <code>X509CRL</code> does not contain a nextUpdate component.
-     * If <code>null</code>, no dateAndTime check will be done.
+     * {@code X509CRL} does not contain a nextUpdate component.
+     * If {@code null}, no dateAndTime check will be done.
      * <p>
-     * Note that the <code>Date</code> returned is cloned to protect against
+     * Note that the {@code Date} returned is cloned to protect against
      * subsequent modifications.
      *
-     * @return the <code>Date</code> to match against (or <code>null</code>)
+     * @return the {@code Date} to match against (or {@code null})
      * @see #setDateAndTime
      */
     public Date getDateAndTime() {
@@ -547,12 +547,12 @@
 
     /**
      * Returns the certificate being checked. This is not a criterion. Rather,
-     * it is optional information that may help a <code>CertStore</code>
+     * it is optional information that may help a {@code CertStore}
      * find CRLs that would be relevant when checking revocation for the
-     * specified certificate. If the value returned is <code>null</code>, then
+     * specified certificate. If the value returned is {@code null}, then
      * no such optional information is provided.
      *
-     * @return the certificate being checked (or <code>null</code>)
+     * @return the certificate being checked (or {@code null})
      * @see #setCertificateChecking
      */
     public X509Certificate getCertificateChecking() {
@@ -560,10 +560,10 @@
     }
 
     /**
-     * Returns a printable representation of the <code>X509CRLSelector</code>.
+     * Returns a printable representation of the {@code X509CRLSelector}.
      *
-     * @return a <code>String</code> describing the contents of the
-     *         <code>X509CRLSelector</code>.
+     * @return a {@code String} describing the contents of the
+     *         {@code X509CRLSelector}.
      */
     public String toString() {
         StringBuffer sb = new StringBuffer();
@@ -587,11 +587,11 @@
     }
 
     /**
-     * Decides whether a <code>CRL</code> should be selected.
+     * Decides whether a {@code CRL} should be selected.
      *
-     * @param crl the <code>CRL</code> to be checked
-     * @return <code>true</code> if the <code>CRL</code> should be selected,
-     *         <code>false</code> otherwise
+     * @param crl the {@code CRL} to be checked
+     * @return {@code true} if the {@code CRL} should be selected,
+     *         {@code false} otherwise
      */
     public boolean match(CRL crl) {
         if (!(crl instanceof X509CRL)) {
@@ -632,7 +632,7 @@
                 byte[] encoded = in.getOctetString();
                 CRLNumberExtension crlNumExt =
                     new CRLNumberExtension(Boolean.FALSE, encoded);
-                crlNum = (BigInteger)crlNumExt.get(CRLNumberExtension.NUMBER);
+                crlNum = crlNumExt.get(CRLNumberExtension.NUMBER);
             } catch (IOException ex) {
                 if (debug != null) {
                     debug.println("X509CRLSelector.match: exception in "
@@ -679,10 +679,14 @@
                 nowPlusSkew = new Date(dateAndTime.getTime() + skew);
                 nowMinusSkew = new Date(dateAndTime.getTime() - skew);
             }
+
+            // Check that the test date is within the validity interval:
+            //   [ thisUpdate - MAX_CLOCK_SKEW,
+            //     nextUpdate + MAX_CLOCK_SKEW ]
             if (nowMinusSkew.after(nextUpdate)
                 || nowPlusSkew.before(crlThisUpdate)) {
                 if (debug != null) {
-                    debug.println("X509CRLSelector.match: update out of range");
+                    debug.println("X509CRLSelector.match: update out-of-range");
                 }
                 return false;
             }
@@ -708,7 +712,7 @@
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
diff --git a/ojluni/src/main/java/java/security/cert/X509CertSelector.java b/ojluni/src/main/java/java/security/cert/X509CertSelector.java
index 9900080..d4952da 100644
--- a/ojluni/src/main/java/java/security/cert/X509CertSelector.java
+++ b/ojluni/src/main/java/java/security/cert/X509CertSelector.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2008, 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
@@ -40,27 +40,27 @@
 import sun.security.x509.*;
 
 /**
- * A <code>CertSelector</code> that selects <code>X509Certificates</code> that
+ * A {@code CertSelector} that selects {@code X509Certificates} that
  * match all specified criteria. This class is particularly useful when
- * selecting certificates from a <code>CertStore</code> to build a
+ * selecting certificates from a {@code CertStore} to build a
  * PKIX-compliant certification path.
  * <p>
- * When first constructed, an <code>X509CertSelector</code> has no criteria
- * enabled and each of the <code>get</code> methods return a default value
- * (<code>null</code>, or <code>-1</code> for the {@link #getBasicConstraints
+ * When first constructed, an {@code X509CertSelector} has no criteria
+ * enabled and each of the {@code get} methods return a default value
+ * ({@code null}, or {@code -1} for the {@link #getBasicConstraints
  * getBasicConstraints} method). Therefore, the {@link #match match}
- * method would return <code>true</code> for any <code>X509Certificate</code>.
+ * method would return {@code true} for any {@code X509Certificate}.
  * Typically, several criteria are enabled (by calling
  * {@link #setIssuer setIssuer} or
  * {@link #setKeyUsage setKeyUsage}, for instance) and then the
- * <code>X509CertSelector</code> is passed to
+ * {@code X509CertSelector} is passed to
  * {@link CertStore#getCertificates CertStore.getCertificates} or some similar
  * method.
  * <p>
  * Several criteria can be enabled (by calling {@link #setIssuer setIssuer}
  * and {@link #setSerialNumber setSerialNumber},
- * for example) such that the <code>match</code> method
- * usually uniquely matches a single <code>X509Certificate</code>. We say
+ * for example) such that the {@code match} method
+ * usually uniquely matches a single {@code X509Certificate}. We say
  * usually, since it is possible for two issuing CAs to have the same
  * distinguished name and each issue a certificate with the same serial
  * number. Other unique combinations include the issuer, subject,
@@ -150,8 +150,8 @@
     static final int NAME_OID = 8;
 
     /**
-     * Creates an <code>X509CertSelector</code>. Initially, no criteria are set
-     * so any <code>X509Certificate</code> will match.
+     * Creates an {@code X509CertSelector}. Initially, no criteria are set
+     * so any {@code X509Certificate} will match.
      */
     public X509CertSelector() {
         // empty
@@ -159,17 +159,17 @@
 
     /**
      * Sets the certificateEquals criterion. The specified
-     * <code>X509Certificate</code> must be equal to the
-     * <code>X509Certificate</code> passed to the <code>match</code> method.
-     * If <code>null</code>, then this check is not applied.
+     * {@code X509Certificate} must be equal to the
+     * {@code X509Certificate} passed to the {@code match} method.
+     * If {@code null}, then this check is not applied.
      *
      * <p>This method is particularly useful when it is necessary to
      * match a single certificate. Although other criteria can be specified
      * in conjunction with the certificateEquals criterion, it is usually not
      * practical or necessary.
      *
-     * @param cert the <code>X509Certificate</code> to match (or
-     * <code>null</code>)
+     * @param cert the {@code X509Certificate} to match (or
+     * {@code null})
      * @see #getCertificate
      */
     public void setCertificate(X509Certificate cert) {
@@ -179,11 +179,11 @@
     /**
      * Sets the serialNumber criterion. The specified serial number
      * must match the certificate serial number in the
-     * <code>X509Certificate</code>. If <code>null</code>, any certificate
+     * {@code X509Certificate}. If {@code null}, any certificate
      * serial number will do.
      *
      * @param serial the certificate serial number to match
-     *        (or <code>null</code>)
+     *        (or {@code null})
      * @see #getSerialNumber
      */
     public void setSerialNumber(BigInteger serial) {
@@ -193,11 +193,11 @@
     /**
      * Sets the issuer criterion. The specified distinguished name
      * must match the issuer distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, any issuer
+     * {@code X509Certificate}. If {@code null}, any issuer
      * distinguished name will do.
      *
      * @param issuer a distinguished name as X500Principal
-     *                 (or <code>null</code>)
+     *                 (or {@code null})
      * @since 1.5
      */
     public void setIssuer(X500Principal issuer) {
@@ -214,14 +214,14 @@
      * <p>
      * Sets the issuer criterion. The specified distinguished name
      * must match the issuer distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, any issuer
+     * {@code X509Certificate}. If {@code null}, any issuer
      * distinguished name will do.
      * <p>
-     * If <code>issuerDN</code> is not <code>null</code>, it should contain a
+     * If {@code issuerDN} is not {@code null}, it should contain a
      * distinguished name, in RFC 2253 format.
      *
      * @param issuerDN a distinguished name in RFC 2253 format
-     *                 (or <code>null</code>)
+     *                 (or {@code null})
      * @throws IOException if a parsing error occurs (incorrect form for DN)
      */
     public void setIssuer(String issuerDN) throws IOException {
@@ -235,14 +235,14 @@
     /**
      * Sets the issuer criterion. The specified distinguished name
      * must match the issuer distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code> is specified,
+     * {@code X509Certificate}. If {@code null} is specified,
      * the issuer criterion is disabled and any issuer distinguished name will
      * do.
      * <p>
-     * If <code>issuerDN</code> is not <code>null</code>, it should contain a
+     * If {@code issuerDN} is not {@code null}, it should contain a
      * single DER encoded distinguished name, as defined in X.501. The ASN.1
      * notation for this structure is as follows.
-     * <pre><code>
+     * <pre>{@code
      * Name ::= CHOICE {
      *   RDNSequence }
      *
@@ -265,31 +265,31 @@
      *       universalString         UniversalString (SIZE (1..MAX)),
      *       utf8String              UTF8String (SIZE (1.. MAX)),
      *       bmpString               BMPString (SIZE (1..MAX)) }
-     * </code></pre>
+     * }</pre>
      * <p>
      * Note that the byte array specified here is cloned to protect against
      * subsequent modifications.
      *
      * @param issuerDN a byte array containing the distinguished name
-     *                 in ASN.1 DER encoded form (or <code>null</code>)
+     *                 in ASN.1 DER encoded form (or {@code null})
      * @throws IOException if an encoding error occurs (incorrect form for DN)
      */
     public void setIssuer(byte[] issuerDN) throws IOException {
         try {
             issuer = (issuerDN == null ? null : new X500Principal(issuerDN));
         } catch (IllegalArgumentException e) {
-            throw (IOException)new IOException("Invalid name").initCause(e);
+            throw new IOException("Invalid name", e);
         }
     }
 
     /**
      * Sets the subject criterion. The specified distinguished name
      * must match the subject distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, any subject
+     * {@code X509Certificate}. If {@code null}, any subject
      * distinguished name will do.
      *
      * @param subject a distinguished name as X500Principal
-     *                  (or <code>null</code>)
+     *                  (or {@code null})
      * @since 1.5
      */
     public void setSubject(X500Principal subject) {
@@ -305,14 +305,14 @@
      * <p>
      * Sets the subject criterion. The specified distinguished name
      * must match the subject distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, any subject
+     * {@code X509Certificate}. If {@code null}, any subject
      * distinguished name will do.
      * <p>
-     * If <code>subjectDN</code> is not <code>null</code>, it should contain a
+     * If {@code subjectDN} is not {@code null}, it should contain a
      * distinguished name, in RFC 2253 format.
      *
      * @param subjectDN a distinguished name in RFC 2253 format
-     *                  (or <code>null</code>)
+     *                  (or {@code null})
      * @throws IOException if a parsing error occurs (incorrect form for DN)
      */
     public void setSubject(String subjectDN) throws IOException {
@@ -326,56 +326,56 @@
     /**
      * Sets the subject criterion. The specified distinguished name
      * must match the subject distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, any subject
+     * {@code X509Certificate}. If {@code null}, any subject
      * distinguished name will do.
      * <p>
-     * If <code>subjectDN</code> is not <code>null</code>, it should contain a
+     * If {@code subjectDN} is not {@code null}, it should contain a
      * single DER encoded distinguished name, as defined in X.501. For the ASN.1
      * notation for this structure, see
      * {@link #setIssuer(byte [] issuerDN) setIssuer(byte [] issuerDN)}.
      *
      * @param subjectDN a byte array containing the distinguished name in
-     *                  ASN.1 DER format (or <code>null</code>)
+     *                  ASN.1 DER format (or {@code null})
      * @throws IOException if an encoding error occurs (incorrect form for DN)
      */
     public void setSubject(byte[] subjectDN) throws IOException {
         try {
             subject = (subjectDN == null ? null : new X500Principal(subjectDN));
         } catch (IllegalArgumentException e) {
-            throw (IOException)new IOException("Invalid name").initCause(e);
+            throw new IOException("Invalid name", e);
         }
     }
 
     /**
      * Sets the subjectKeyIdentifier criterion. The
-     * <code>X509Certificate</code> must contain a SubjectKeyIdentifier
+     * {@code X509Certificate} must contain a SubjectKeyIdentifier
      * extension for which the contents of the extension
      * matches the specified criterion value.
-     * If the criterion value is <code>null</code>, no
+     * If the criterion value is {@code null}, no
      * subjectKeyIdentifier check will be done.
      * <p>
-     * If <code>subjectKeyID</code> is not <code>null</code>, it
+     * If {@code subjectKeyID} is not {@code null}, it
      * should contain a single DER encoded value corresponding to the contents
      * of the extension value (not including the object identifier,
      * criticality setting, and encapsulating OCTET STRING)
      * for a SubjectKeyIdentifier extension.
      * The ASN.1 notation for this structure follows.
-     * <p>
-     * <pre><code>
+     *
+     * <pre>{@code
      * SubjectKeyIdentifier ::= KeyIdentifier
      *
      * KeyIdentifier ::= OCTET STRING
-     * </code></pre>
+     * }</pre>
      * <p>
      * Since the format of subject key identifiers is not mandated by
      * any standard, subject key identifiers are not parsed by the
-     * <code>X509CertSelector</code>. Instead, the values are compared using
+     * {@code X509CertSelector}. Instead, the values are compared using
      * a byte-by-byte comparison.
      * <p>
      * Note that the byte array supplied here is cloned to protect against
      * subsequent modifications.
      *
-     * @param subjectKeyID the subject key identifier (or <code>null</code>)
+     * @param subjectKeyID the subject key identifier (or {@code null})
      * @see #getSubjectKeyIdentifier
      */
     public void setSubjectKeyIdentifier(byte[] subjectKeyID) {
@@ -388,46 +388,46 @@
 
     /**
      * Sets the authorityKeyIdentifier criterion. The
-     * <code>X509Certificate</code> must contain an
+     * {@code X509Certificate} must contain an
      * AuthorityKeyIdentifier extension for which the contents of the
      * extension value matches the specified criterion value.
-     * If the criterion value is <code>null</code>, no
+     * If the criterion value is {@code null}, no
      * authorityKeyIdentifier check will be done.
      * <p>
-     * If <code>authorityKeyID</code> is not <code>null</code>, it
+     * If {@code authorityKeyID} is not {@code null}, it
      * should contain a single DER encoded value corresponding to the contents
      * of the extension value (not including the object identifier,
      * criticality setting, and encapsulating OCTET STRING)
      * for an AuthorityKeyIdentifier extension.
      * The ASN.1 notation for this structure follows.
-     * <p>
-     * <pre><code>
+     *
+     * <pre>{@code
      * AuthorityKeyIdentifier ::= SEQUENCE {
      *    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
      *    authorityCertIssuer       [1] GeneralNames            OPTIONAL,
      *    authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  }
      *
      * KeyIdentifier ::= OCTET STRING
-     * </code></pre>
+     * }</pre>
      * <p>
      * Authority key identifiers are not parsed by the
-     * <code>X509CertSelector</code>.  Instead, the values are
+     * {@code X509CertSelector}.  Instead, the values are
      * compared using a byte-by-byte comparison.
      * <p>
-     * When the <code>keyIdentifier</code> field of
-     * <code>AuthorityKeyIdentifier</code> is populated, the value is
-     * usually taken from the <code>SubjectKeyIdentifier</code> extension
+     * When the {@code keyIdentifier} field of
+     * {@code AuthorityKeyIdentifier} is populated, the value is
+     * usually taken from the {@code SubjectKeyIdentifier} extension
      * in the issuer's certificate.  Note, however, that the result of
-     * <code>X509Certificate.getExtensionValue(&lt;SubjectKeyIdentifier Object
-     * Identifier&gt;)</code> on the issuer's certificate may NOT be used
-     * directly as the input to <code>setAuthorityKeyIdentifier</code>.
+     * {@code X509Certificate.getExtensionValue(<SubjectKeyIdentifier Object
+     * Identifier>)} on the issuer's certificate may NOT be used
+     * directly as the input to {@code setAuthorityKeyIdentifier}.
      * This is because the SubjectKeyIdentifier contains
      * only a KeyIdentifier OCTET STRING, and not a SEQUENCE of
      * KeyIdentifier, GeneralNames, and CertificateSerialNumber.
      * In order to use the extension value of the issuer certificate's
-     * <code>SubjectKeyIdentifier</code>
+     * {@code SubjectKeyIdentifier}
      * extension, it will be necessary to extract the value of the embedded
-     * <code>KeyIdentifier</code> OCTET STRING, then DER encode this OCTET
+     * {@code KeyIdentifier} OCTET STRING, then DER encode this OCTET
      * STRING inside a SEQUENCE.
      * For more details on SubjectKeyIdentifier, see
      * {@link #setSubjectKeyIdentifier(byte[] subjectKeyID)}.
@@ -436,7 +436,7 @@
      * subsequent modifications.
      *
      * @param authorityKeyID the authority key identifier
-     *        (or <code>null</code>)
+     *        (or {@code null})
      * @see #getAuthorityKeyIdentifier
      */
     public void setAuthorityKeyIdentifier(byte[] authorityKeyID) {
@@ -450,13 +450,13 @@
     /**
      * Sets the certificateValid criterion. The specified date must fall
      * within the certificate validity period for the
-     * <code>X509Certificate</code>. If <code>null</code>, no certificateValid
+     * {@code X509Certificate}. If {@code null}, no certificateValid
      * check will be done.
      * <p>
-     * Note that the <code>Date</code> supplied here is cloned to protect
+     * Note that the {@code Date} supplied here is cloned to protect
      * against subsequent modifications.
      *
-     * @param certValid the <code>Date</code> to check (or <code>null</code>)
+     * @param certValid the {@code Date} to check (or {@code null})
      * @see #getCertificateValid
      */
     public void setCertificateValid(Date certValid) {
@@ -470,14 +470,14 @@
     /**
      * Sets the privateKeyValid criterion. The specified date must fall
      * within the private key validity period for the
-     * <code>X509Certificate</code>. If <code>null</code>, no privateKeyValid
+     * {@code X509Certificate}. If {@code null}, no privateKeyValid
      * check will be done.
      * <p>
-     * Note that the <code>Date</code> supplied here is cloned to protect
+     * Note that the {@code Date} supplied here is cloned to protect
      * against subsequent modifications.
      *
-     * @param privateKeyValid the <code>Date</code> to check (or
-     *                        <code>null</code>)
+     * @param privateKeyValid the {@code Date} to check (or
+     *                        {@code null})
      * @see #getPrivateKeyValid
      */
     public void setPrivateKeyValid(Date privateKeyValid) {
@@ -490,12 +490,12 @@
 
     /**
      * Sets the subjectPublicKeyAlgID criterion. The
-     * <code>X509Certificate</code> must contain a subject public key
-     * with the specified algorithm. If <code>null</code>, no
+     * {@code X509Certificate} must contain a subject public key
+     * with the specified algorithm. If {@code null}, no
      * subjectPublicKeyAlgID check will be done.
      *
      * @param oid The object identifier (OID) of the algorithm to check
-     *            for (or <code>null</code>). An OID is represented by a
+     *            for (or {@code null}). An OID is represented by a
      *            set of nonnegative integers separated by periods.
      * @throws IOException if the OID is invalid, such as
      * the first component being not 0, 1 or 2 or the second component
@@ -513,10 +513,10 @@
 
     /**
      * Sets the subjectPublicKey criterion. The
-     * <code>X509Certificate</code> must contain the specified subject public
-     * key. If <code>null</code>, no subjectPublicKey check will be done.
+     * {@code X509Certificate} must contain the specified subject public
+     * key. If {@code null}, no subjectPublicKey check will be done.
      *
-     * @param key the subject public key to check for (or <code>null</code>)
+     * @param key the subject public key to check for (or {@code null})
      * @see #getSubjectPublicKey
      */
     public void setSubjectPublicKey(PublicKey key) {
@@ -530,17 +530,17 @@
     }
 
     /**
-     * Sets the subjectPublicKey criterion. The <code>X509Certificate</code>
-     * must contain the specified subject public key. If <code>null</code>,
+     * Sets the subjectPublicKey criterion. The {@code X509Certificate}
+     * must contain the specified subject public key. If {@code null},
      * no subjectPublicKey check will be done.
      * <p>
      * Because this method allows the public key to be specified as a byte
      * array, it may be used for unknown key types.
      * <p>
-     * If <code>key</code> is not <code>null</code>, it should contain a
+     * If {@code key} is not {@code null}, it should contain a
      * single DER encoded SubjectPublicKeyInfo structure, as defined in X.509.
      * The ASN.1 notation for this structure is as follows.
-     * <pre><code>
+     * <pre>{@code
      * SubjectPublicKeyInfo  ::=  SEQUENCE  {
      *   algorithm            AlgorithmIdentifier,
      *   subjectPublicKey     BIT STRING  }
@@ -551,13 +551,13 @@
      *                              -- contains a value of the type
      *                              -- registered for use with the
      *                              -- algorithm object identifier value
-     * </code></pre>
+     * }</pre>
      * <p>
      * Note that the byte array supplied here is cloned to protect against
      * subsequent modifications.
      *
      * @param key a byte array containing the subject public key in ASN.1 DER
-     *            form (or <code>null</code>)
+     *            form (or {@code null})
      * @throws IOException if an encoding error occurs (incorrect form for
      * subject public key)
      * @see #getSubjectPublicKey
@@ -573,9 +573,9 @@
     }
 
     /**
-     * Sets the keyUsage criterion. The <code>X509Certificate</code>
-     * must allow the specified keyUsage values. If <code>null</code>, no
-     * keyUsage check will be done. Note that an <code>X509Certificate</code>
+     * Sets the keyUsage criterion. The {@code X509Certificate}
+     * must allow the specified keyUsage values. If {@code null}, no
+     * keyUsage check will be done. Note that an {@code X509Certificate}
      * that has no keyUsage extension implicitly allows all keyUsage values.
      * <p>
      * Note that the boolean array supplied here is cloned to protect against
@@ -584,7 +584,7 @@
      * @param keyUsage a boolean array in the same format as the boolean
      *                 array returned by
      * {@link X509Certificate#getKeyUsage() X509Certificate.getKeyUsage()}.
-     *                 Or <code>null</code>.
+     *                 Or {@code null}.
      * @see #getKeyUsage
      */
     public void setKeyUsage(boolean[] keyUsage) {
@@ -596,18 +596,18 @@
     }
 
     /**
-     * Sets the extendedKeyUsage criterion. The <code>X509Certificate</code>
+     * Sets the extendedKeyUsage criterion. The {@code X509Certificate}
      * must allow the specified key purposes in its extended key usage
-     * extension. If <code>keyPurposeSet</code> is empty or <code>null</code>,
+     * extension. If {@code keyPurposeSet} is empty or {@code null},
      * no extendedKeyUsage check will be done. Note that an
-     * <code>X509Certificate</code> that has no extendedKeyUsage extension
+     * {@code X509Certificate} that has no extendedKeyUsage extension
      * implicitly allows all key purposes.
      * <p>
-     * Note that the <code>Set</code> is cloned to protect against
+     * Note that the {@code Set} is cloned to protect against
      * subsequent modifications.
      *
-     * @param keyPurposeSet a <code>Set</code> of key purpose OIDs in string
-     * format (or <code>null</code>). Each OID is represented by a set of
+     * @param keyPurposeSet a {@code Set} of key purpose OIDs in string
+     * format (or {@code null}). Each OID is represented by a set of
      * nonnegative integers separated by periods.
      * @throws IOException if the OID is invalid, such as
      * the first component being not 0, 1 or 2 or the second component
@@ -633,15 +633,15 @@
      * specified in the {@link #setSubjectAlternativeNames
      * setSubjectAlternativeNames} or {@link #addSubjectAlternativeName
      * addSubjectAlternativeName} methods. If enabled,
-     * the <code>X509Certificate</code> must contain all of the
+     * the {@code X509Certificate} must contain all of the
      * specified subject alternative names. If disabled, the
-     * <code>X509Certificate</code> must contain at least one of the
+     * {@code X509Certificate} must contain at least one of the
      * specified subject alternative names.
      *
-     * <p>The matchAllNames flag is <code>true</code> by default.
+     * <p>The matchAllNames flag is {@code true} by default.
      *
-     * @param matchAllNames if <code>true</code>, the flag is enabled;
-     * if <code>false</code>, the flag is disabled.
+     * @param matchAllNames if {@code true}, the flag is enabled;
+     * if {@code false}, the flag is disabled.
      * @see #getMatchAllSubjectAltNames
      */
     public void setMatchAllSubjectAltNames(boolean matchAllNames) {
@@ -650,7 +650,7 @@
 
     /**
      * Sets the subjectAlternativeNames criterion. The
-     * <code>X509Certificate</code> must contain all or at least one of the
+     * {@code X509Certificate} must contain all or at least one of the
      * specified subjectAlternativeNames, depending on the value of
      * the matchAllNames flag (see {@link #setMatchAllSubjectAltNames
      * setMatchAllSubjectAltNames}).
@@ -660,19 +660,19 @@
      * subjectAlternativeNames criterion. The specified value replaces
      * the previous value for the subjectAlternativeNames criterion.
      * <p>
-     * The <code>names</code> parameter (if not <code>null</code>) is a
-     * <code>Collection</code> with one
+     * The {@code names} parameter (if not {@code null}) is a
+     * {@code Collection} with one
      * entry for each name to be included in the subject alternative name
-     * criterion. Each entry is a <code>List</code> whose first entry is an
-     * <code>Integer</code> (the name type, 0-8) and whose second
-     * entry is a <code>String</code> or a byte array (the name, in
+     * criterion. Each entry is a {@code List} whose first entry is an
+     * {@code Integer} (the name type, 0-8) and whose second
+     * entry is a {@code String} or a byte array (the name, in
      * string or ASN.1 DER encoded form, respectively).
-     * There can be multiple names of the same type. If <code>null</code>
+     * There can be multiple names of the same type. If {@code null}
      * is supplied as the value for this argument, no
      * subjectAlternativeNames check will be performed.
      * <p>
-     * Each subject alternative name in the <code>Collection</code>
-     * may be specified either as a <code>String</code> or as an ASN.1 encoded
+     * Each subject alternative name in the {@code Collection}
+     * may be specified either as a {@code String} or as an ASN.1 encoded
      * byte array. For more details about the formats used, see
      * {@link #addSubjectAlternativeName(int type, String name)
      * addSubjectAlternativeName(int type, String name)} and
@@ -683,15 +683,15 @@
      * array form instead of the String form. See the note in
      * {@link #addSubjectAlternativeName(int, String)} for more information.
      * <p>
-     * Note that the <code>names</code> parameter can contain duplicate
+     * Note that the {@code names} parameter can contain duplicate
      * names (same name and name type), but they may be removed from the
-     * <code>Collection</code> of names returned by the
+     * {@code Collection} of names returned by the
      * {@link #getSubjectAlternativeNames getSubjectAlternativeNames} method.
      * <p>
-     * Note that a deep copy is performed on the <code>Collection</code> to
+     * Note that a deep copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @param names a <code>Collection</code> of names (or <code>null</code>)
+     * @param names a {@code Collection} of names (or {@code null})
      * @throws IOException if a parsing error occurs
      * @see #getSubjectAlternativeNames
      */
@@ -715,7 +715,7 @@
 
     /**
      * Adds a name to the subjectAlternativeNames criterion. The
-     * <code>X509Certificate</code> must contain all or at least one
+     * {@code X509Certificate} must contain all or at least one
      * of the specified subjectAlternativeNames, depending on the value of
      * the matchAllNames flag (see {@link #setMatchAllSubjectAltNames
      * setMatchAllSubjectAltNames}).
@@ -748,7 +748,7 @@
      *
      * @param type the name type (0-8, as specified in
      *             RFC 3280, section 4.2.1.7)
-     * @param name the name in string form (not <code>null</code>)
+     * @param name the name in string form (not {@code null})
      * @throws IOException if a parsing error occurs
      */
     public void addSubjectAlternativeName(int type, String name)
@@ -758,7 +758,7 @@
 
     /**
      * Adds a name to the subjectAlternativeNames criterion. The
-     * <code>X509Certificate</code> must contain all or at least one
+     * {@code X509Certificate} must contain all or at least one
      * of the specified subjectAlternativeNames, depending on the value of
      * the matchAllNames flag (see {@link #setMatchAllSubjectAltNames
      * setMatchAllSubjectAltNames}).
@@ -775,7 +775,7 @@
      * the encoded value of the name, and should not include the tag associated
      * with the name in the GeneralName structure. The ASN.1 definition of this
      * structure appears below.
-     * <pre><code>
+     * <pre>{@code
      *  GeneralName ::= CHOICE {
      *       otherName                       [0]     OtherName,
      *       rfc822Name                      [1]     IA5String,
@@ -786,7 +786,7 @@
      *       uniformResourceIdentifier       [6]     IA5String,
      *       iPAddress                       [7]     OCTET STRING,
      *       registeredID                    [8]     OBJECT IDENTIFIER}
-     * </code></pre>
+     * }</pre>
      * <p>
      * Note that the byte array supplied here is cloned to protect against
      * subsequent modifications.
@@ -803,7 +803,7 @@
 
     /**
      * A private method that adds a name (String or byte array) to the
-     * subjectAlternativeNames criterion. The <code>X509Certificate</code>
+     * subjectAlternativeNames criterion. The {@code X509Certificate}
      * must contain the specified subjectAlternativeName.
      *
      * @param type the name type (0-8, as specified in
@@ -830,19 +830,19 @@
 
     /**
      * Parse an argument of the form passed to setSubjectAlternativeNames,
-     * returning a <code>Collection</code> of
-     * <code>GeneralNameInterface</code>s.
+     * returning a {@code Collection} of
+     * {@code GeneralNameInterface}s.
      * Throw an IllegalArgumentException or a ClassCastException
      * if the argument is malformed.
      *
      * @param names a Collection with one entry per name.
-     *              Each entry is a <code>List</code> whose first entry
+     *              Each entry is a {@code List} whose first entry
      *              is an Integer (the name type, 0-8) and whose second
      *              entry is a String or a byte array (the name, in
      *              string or ASN.1 DER encoded form, respectively).
      *              There can be multiple names of the same type. Null is
      *              not an acceptable value.
-     * @return a Set of <code>GeneralNameInterface</code>s
+     * @return a Set of {@code GeneralNameInterface}s
      * @throws IOException if a parsing error occurs
      */
     private static Set<GeneralNameInterface> parseNames(Collection<List<?>> names) throws IOException {
@@ -866,14 +866,14 @@
     /**
      * Compare for equality two objects of the form passed to
      * setSubjectAlternativeNames (or X509CRLSelector.setIssuerNames).
-     * Throw an <code>IllegalArgumentException</code> or a
-     * <code>ClassCastException</code> if one of the objects is malformed.
+     * Throw an {@code IllegalArgumentException} or a
+     * {@code ClassCastException} if one of the objects is malformed.
      *
      * @param object1 a Collection containing the first object to compare
      * @param object2 a Collection containing the second object to compare
      * @return true if the objects are equal, false otherwise
      */
-    static boolean equalNames(Collection object1, Collection object2) {
+    static boolean equalNames(Collection<?> object1, Collection<?> object2) {
         if ((object1 == null) || (object2 == null)) {
             return object1 == object2;
         }
@@ -881,7 +881,7 @@
     }
 
     /**
-     * Make a <code>GeneralNameInterface</code> out of a name type (0-8) and an
+     * Make a {@code GeneralNameInterface} out of a name type (0-8) and an
      * Object that may be a byte array holding the ASN.1 DER encoded
      * name or a String form of the name.  Except for X.509
      * Distinguished Names, the String form of the name must not be the
@@ -990,7 +990,7 @@
 
 
     /**
-     * Sets the name constraints criterion. The <code>X509Certificate</code>
+     * Sets the name constraints criterion. The {@code X509Certificate}
      * must have subject and subject alternative names that
      * meet the specified name constraints.
      * <p>
@@ -999,7 +999,7 @@
      * would appear in the NameConstraints structure defined in RFC 3280
      * and X.509. The ASN.1 definition of this structure appears below.
      *
-     * <pre><code>
+     * <pre>{@code
      *  NameConstraints ::= SEQUENCE {
      *       permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
      *       excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
@@ -1023,7 +1023,7 @@
      *       uniformResourceIdentifier       [6]     IA5String,
      *       iPAddress                       [7]     OCTET STRING,
      *       registeredID                    [8]     OBJECT IDENTIFIER}
-     * </code></pre>
+     * }</pre>
      * <p>
      * Note that the byte array supplied here is cloned to protect against
      * subsequent modifications.
@@ -1032,7 +1032,7 @@
      *              a NameConstraints extension to be used for checking
      *              name constraints. Only the value of the extension is
      *              included, not the OID or criticality flag. Can be
-     *              <code>null</code>,
+     *              {@code null},
      *              in which case no name constraints check will be performed.
      * @throws IOException if a parsing error occurs
      * @see #getNameConstraints
@@ -1049,7 +1049,7 @@
 
     /**
      * Sets the basic constraints constraint. If the value is greater than or
-     * equal to zero, <code>X509Certificates</code> must include a
+     * equal to zero, {@code X509Certificates} must include a
      * basicConstraints extension with
      * a pathLen of at least this value. If the value is -2, only end-entity
      * certificates are accepted. If the value is -1, no check is done.
@@ -1071,18 +1071,18 @@
     }
 
     /**
-     * Sets the policy constraint. The <code>X509Certificate</code> must
+     * Sets the policy constraint. The {@code X509Certificate} must
      * include at least one of the specified policies in its certificate
-     * policies extension. If <code>certPolicySet</code> is empty, then the
-     * <code>X509Certificate</code> must include at least some specified policy
-     * in its certificate policies extension. If <code>certPolicySet</code> is
-     * <code>null</code>, no policy check will be performed.
+     * policies extension. If {@code certPolicySet} is empty, then the
+     * {@code X509Certificate} must include at least some specified policy
+     * in its certificate policies extension. If {@code certPolicySet} is
+     * {@code null}, no policy check will be performed.
      * <p>
-     * Note that the <code>Set</code> is cloned to protect against
+     * Note that the {@code Set} is cloned to protect against
      * subsequent modifications.
      *
-     * @param certPolicySet a <code>Set</code> of certificate policy OIDs in
-     *                      string format (or <code>null</code>). Each OID is
+     * @param certPolicySet a {@code Set} of certificate policy OIDs in
+     *                      string format (or {@code null}). Each OID is
      *                      represented by a set of nonnegative integers
      *                    separated by periods.
      * @throws IOException if a parsing error occurs on the OID such as
@@ -1116,12 +1116,12 @@
     }
 
     /**
-     * Sets the pathToNames criterion. The <code>X509Certificate</code> must
+     * Sets the pathToNames criterion. The {@code X509Certificate} must
      * not include name constraints that would prohibit building a
      * path to the specified names.
      * <p>
      * This method allows the caller to specify, with a single method call,
-     * the complete set of names which the <code>X509Certificates</code>'s
+     * the complete set of names which the {@code X509Certificates}'s
      * name constraints must permit. The specified value replaces
      * the previous value for the pathToNames criterion.
      * <p>
@@ -1130,19 +1130,19 @@
      * built, any candidate certificate must not include name constraints that
      * would prohibit building a path to any of the names in the partial path.
      * <p>
-     * The <code>names</code> parameter (if not <code>null</code>) is a
-     * <code>Collection</code> with one
+     * The {@code names} parameter (if not {@code null}) is a
+     * {@code Collection} with one
      * entry for each name to be included in the pathToNames
-     * criterion. Each entry is a <code>List</code> whose first entry is an
-     * <code>Integer</code> (the name type, 0-8) and whose second
-     * entry is a <code>String</code> or a byte array (the name, in
+     * criterion. Each entry is a {@code List} whose first entry is an
+     * {@code Integer} (the name type, 0-8) and whose second
+     * entry is a {@code String} or a byte array (the name, in
      * string or ASN.1 DER encoded form, respectively).
-     * There can be multiple names of the same type. If <code>null</code>
+     * There can be multiple names of the same type. If {@code null}
      * is supplied as the value for this argument, no
      * pathToNames check will be performed.
      * <p>
-     * Each name in the <code>Collection</code>
-     * may be specified either as a <code>String</code> or as an ASN.1 encoded
+     * Each name in the {@code Collection}
+     * may be specified either as a {@code String} or as an ASN.1 encoded
      * byte array. For more details about the formats used, see
      * {@link #addPathToName(int type, String name)
      * addPathToName(int type, String name)} and
@@ -1153,16 +1153,16 @@
      * array form instead of the String form. See the note in
      * {@link #addPathToName(int, String)} for more information.
      * <p>
-     * Note that the <code>names</code> parameter can contain duplicate
+     * Note that the {@code names} parameter can contain duplicate
      * names (same name and name type), but they may be removed from the
-     * <code>Collection</code> of names returned by the
+     * {@code Collection} of names returned by the
      * {@link #getPathToNames getPathToNames} method.
      * <p>
-     * Note that a deep copy is performed on the <code>Collection</code> to
+     * Note that a deep copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @param names a <code>Collection</code> with one entry per name
-     *              (or <code>null</code>)
+     * @param names a {@code Collection} with one entry per name
+     *              (or {@code null})
      * @throws IOException if a parsing error occurs
      * @see #getPathToNames
      */
@@ -1187,12 +1187,12 @@
     }
 
     /**
-     * Adds a name to the pathToNames criterion. The <code>X509Certificate</code>
+     * Adds a name to the pathToNames criterion. The {@code X509Certificate}
      * must not include name constraints that would prohibit building a
      * path to the specified name.
      * <p>
      * This method allows the caller to add a name to the set of names which
-     * the <code>X509Certificates</code>'s name constraints must permit.
+     * the {@code X509Certificates}'s name constraints must permit.
      * The specified name is added to any previous value for the
      * pathToNames criterion.  If the name is a duplicate, it may be ignored.
      * <p>
@@ -1224,12 +1224,12 @@
     }
 
     /**
-     * Adds a name to the pathToNames criterion. The <code>X509Certificate</code>
+     * Adds a name to the pathToNames criterion. The {@code X509Certificate}
      * must not include name constraints that would prohibit building a
      * path to the specified name.
      * <p>
      * This method allows the caller to add a name to the set of names which
-     * the <code>X509Certificates</code>'s name constraints must permit.
+     * the {@code X509Certificates}'s name constraints must permit.
      * The specified name is added to any previous value for the
      * pathToNames criterion. If the name is a duplicate, it may be ignored.
      * <p>
@@ -1255,7 +1255,7 @@
 
     /**
      * A private method that adds a name (String or byte array) to the
-     * pathToNames criterion. The <code>X509Certificate</code> must contain
+     * pathToNames criterion. The {@code X509Certificate} must contain
      * the specified pathToName.
      *
      * @param type the name type (0-8, as specified in
@@ -1280,11 +1280,11 @@
 
     /**
      * Returns the certificateEquals criterion. The specified
-     * <code>X509Certificate</code> must be equal to the
-     * <code>X509Certificate</code> passed to the <code>match</code> method.
-     * If <code>null</code>, this check is not applied.
+     * {@code X509Certificate} must be equal to the
+     * {@code X509Certificate} passed to the {@code match} method.
+     * If {@code null}, this check is not applied.
      *
-     * @return the <code>X509Certificate</code> to match (or <code>null</code>)
+     * @return the {@code X509Certificate} to match (or {@code null})
      * @see #setCertificate
      */
     public X509Certificate getCertificate() {
@@ -1294,11 +1294,11 @@
     /**
      * Returns the serialNumber criterion. The specified serial number
      * must match the certificate serial number in the
-     * <code>X509Certificate</code>. If <code>null</code>, any certificate
+     * {@code X509Certificate}. If {@code null}, any certificate
      * serial number will do.
      *
      * @return the certificate serial number to match
-     *                (or <code>null</code>)
+     *                (or {@code null})
      * @see #setSerialNumber
      */
     public BigInteger getSerialNumber() {
@@ -1306,13 +1306,13 @@
     }
 
     /**
-     * Returns the issuer criterion as an <code>X500Principal</code>. This
+     * Returns the issuer criterion as an {@code X500Principal}. This
      * distinguished name must match the issuer distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, the issuer criterion
+     * {@code X509Certificate}. If {@code null}, the issuer criterion
      * is disabled and any issuer distinguished name will do.
      *
      * @return the required issuer distinguished name as X500Principal
-     *         (or <code>null</code>)
+     *         (or {@code null})
      * @since 1.5
      */
     public X500Principal getIssuer() {
@@ -1326,16 +1326,16 @@
      * encoding information in the RFC 2253 String form of some distinguished
      * names.
      * <p>
-     * Returns the issuer criterion as a <code>String</code>. This
+     * Returns the issuer criterion as a {@code String}. This
      * distinguished name must match the issuer distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, the issuer criterion
+     * {@code X509Certificate}. If {@code null}, the issuer criterion
      * is disabled and any issuer distinguished name will do.
      * <p>
-     * If the value returned is not <code>null</code>, it is a
+     * If the value returned is not {@code null}, it is a
      * distinguished name, in RFC 2253 format.
      *
      * @return the required issuer distinguished name in RFC 2253 format
-     *         (or <code>null</code>)
+     *         (or {@code null})
      */
     public String getIssuerAsString() {
         return (issuer == null ? null : issuer.getName());
@@ -1344,10 +1344,10 @@
     /**
      * Returns the issuer criterion as a byte array. This distinguished name
      * must match the issuer distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, the issuer criterion
+     * {@code X509Certificate}. If {@code null}, the issuer criterion
      * is disabled and any issuer distinguished name will do.
      * <p>
-     * If the value returned is not <code>null</code>, it is a byte
+     * If the value returned is not {@code null}, it is a byte
      * array containing a single DER encoded distinguished name, as defined in
      * X.501. The ASN.1 notation for this structure is supplied in the
      * documentation for
@@ -1357,7 +1357,7 @@
      * subsequent modifications.
      *
      * @return a byte array containing the required issuer distinguished name
-     *         in ASN.1 DER format (or <code>null</code>)
+     *         in ASN.1 DER format (or {@code null})
      * @throws IOException if an encoding error occurs
      */
     public byte[] getIssuerAsBytes() throws IOException {
@@ -1365,13 +1365,13 @@
     }
 
     /**
-     * Returns the subject criterion as an <code>X500Principal</code>. This
+     * Returns the subject criterion as an {@code X500Principal}. This
      * distinguished name must match the subject distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, the subject criterion
+     * {@code X509Certificate}. If {@code null}, the subject criterion
      * is disabled and any subject distinguished name will do.
      *
      * @return the required subject distinguished name as X500Principal
-     *         (or <code>null</code>)
+     *         (or {@code null})
      * @since 1.5
      */
     public X500Principal getSubject() {
@@ -1385,16 +1385,16 @@
      * encoding information in the RFC 2253 String form of some distinguished
      * names.
      * <p>
-     * Returns the subject criterion as a <code>String</code>. This
+     * Returns the subject criterion as a {@code String}. This
      * distinguished name must match the subject distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, the subject criterion
+     * {@code X509Certificate}. If {@code null}, the subject criterion
      * is disabled and any subject distinguished name will do.
      * <p>
-     * If the value returned is not <code>null</code>, it is a
+     * If the value returned is not {@code null}, it is a
      * distinguished name, in RFC 2253 format.
      *
      * @return the required subject distinguished name in RFC 2253 format
-     *         (or <code>null</code>)
+     *         (or {@code null})
      */
     public String getSubjectAsString() {
         return (subject == null ? null : subject.getName());
@@ -1403,10 +1403,10 @@
     /**
      * Returns the subject criterion as a byte array. This distinguished name
      * must match the subject distinguished name in the
-     * <code>X509Certificate</code>. If <code>null</code>, the subject criterion
+     * {@code X509Certificate}. If {@code null}, the subject criterion
      * is disabled and any subject distinguished name will do.
      * <p>
-     * If the value returned is not <code>null</code>, it is a byte
+     * If the value returned is not {@code null}, it is a byte
      * array containing a single DER encoded distinguished name, as defined in
      * X.501. The ASN.1 notation for this structure is supplied in the
      * documentation for
@@ -1416,7 +1416,7 @@
      * subsequent modifications.
      *
      * @return a byte array containing the required subject distinguished name
-     *         in ASN.1 DER format (or <code>null</code>)
+     *         in ASN.1 DER format (or {@code null})
      * @throws IOException if an encoding error occurs
      */
     public byte[] getSubjectAsBytes() throws IOException {
@@ -1425,14 +1425,14 @@
 
     /**
      * Returns the subjectKeyIdentifier criterion. The
-     * <code>X509Certificate</code> must contain a SubjectKeyIdentifier
-     * extension with the specified value. If <code>null</code>, no
+     * {@code X509Certificate} must contain a SubjectKeyIdentifier
+     * extension with the specified value. If {@code null}, no
      * subjectKeyIdentifier check will be done.
      * <p>
      * Note that the byte array returned is cloned to protect against
      * subsequent modifications.
      *
-     * @return the key identifier (or <code>null</code>)
+     * @return the key identifier (or {@code null})
      * @see #setSubjectKeyIdentifier
      */
     public byte[] getSubjectKeyIdentifier() {
@@ -1444,14 +1444,14 @@
 
     /**
      * Returns the authorityKeyIdentifier criterion. The
-     * <code>X509Certificate</code> must contain a AuthorityKeyIdentifier
-     * extension with the specified value. If <code>null</code>, no
+     * {@code X509Certificate} must contain a AuthorityKeyIdentifier
+     * extension with the specified value. If {@code null}, no
      * authorityKeyIdentifier check will be done.
      * <p>
      * Note that the byte array returned is cloned to protect against
      * subsequent modifications.
      *
-     * @return the key identifier (or <code>null</code>)
+     * @return the key identifier (or {@code null})
      * @see #setAuthorityKeyIdentifier
      */
     public byte[] getAuthorityKeyIdentifier() {
@@ -1464,13 +1464,13 @@
     /**
      * Returns the certificateValid criterion. The specified date must fall
      * within the certificate validity period for the
-     * <code>X509Certificate</code>. If <code>null</code>, no certificateValid
+     * {@code X509Certificate}. If {@code null}, no certificateValid
      * check will be done.
      * <p>
-     * Note that the <code>Date</code> returned is cloned to protect against
+     * Note that the {@code Date} returned is cloned to protect against
      * subsequent modifications.
      *
-     * @return the <code>Date</code> to check (or <code>null</code>)
+     * @return the {@code Date} to check (or {@code null})
      * @see #setCertificateValid
      */
     public Date getCertificateValid() {
@@ -1483,13 +1483,13 @@
     /**
      * Returns the privateKeyValid criterion. The specified date must fall
      * within the private key validity period for the
-     * <code>X509Certificate</code>. If <code>null</code>, no privateKeyValid
+     * {@code X509Certificate}. If {@code null}, no privateKeyValid
      * check will be done.
      * <p>
-     * Note that the <code>Date</code> returned is cloned to protect against
+     * Note that the {@code Date} returned is cloned to protect against
      * subsequent modifications.
      *
-     * @return the <code>Date</code> to check (or <code>null</code>)
+     * @return the {@code Date} to check (or {@code null})
      * @see #setPrivateKeyValid
      */
     public Date getPrivateKeyValid() {
@@ -1501,12 +1501,12 @@
 
     /**
      * Returns the subjectPublicKeyAlgID criterion. The
-     * <code>X509Certificate</code> must contain a subject public key
-     * with the specified algorithm. If <code>null</code>, no
+     * {@code X509Certificate} must contain a subject public key
+     * with the specified algorithm. If {@code null}, no
      * subjectPublicKeyAlgID check will be done.
      *
      * @return the object identifier (OID) of the signature algorithm to check
-     *         for (or <code>null</code>). An OID is represented by a set of
+     *         for (or {@code null}). An OID is represented by a set of
      *         nonnegative integers separated by periods.
      * @see #setSubjectPublicKeyAlgID
      */
@@ -1519,10 +1519,10 @@
 
     /**
      * Returns the subjectPublicKey criterion. The
-     * <code>X509Certificate</code> must contain the specified subject
-     * public key. If <code>null</code>, no subjectPublicKey check will be done.
+     * {@code X509Certificate} must contain the specified subject
+     * public key. If {@code null}, no subjectPublicKey check will be done.
      *
-     * @return the subject public key to check for (or <code>null</code>)
+     * @return the subject public key to check for (or {@code null})
      * @see #setSubjectPublicKey
      */
     public PublicKey getSubjectPublicKey() {
@@ -1530,7 +1530,7 @@
     }
 
     /**
-     * Returns the keyUsage criterion. The <code>X509Certificate</code>
+     * Returns the keyUsage criterion. The {@code X509Certificate}
      * must allow the specified keyUsage values. If null, no keyUsage
      * check will be done.
      * <p>
@@ -1540,7 +1540,7 @@
      * @return a boolean array in the same format as the boolean
      *                 array returned by
      * {@link X509Certificate#getKeyUsage() X509Certificate.getKeyUsage()}.
-     *                 Or <code>null</code>.
+     *                 Or {@code null}.
      * @see #setKeyUsage
      */
     public boolean[] getKeyUsage() {
@@ -1551,15 +1551,15 @@
     }
 
     /**
-     * Returns the extendedKeyUsage criterion. The <code>X509Certificate</code>
+     * Returns the extendedKeyUsage criterion. The {@code X509Certificate}
      * must allow the specified key purposes in its extended key usage
-     * extension. If the <code>keyPurposeSet</code> returned is empty or
-     * <code>null</code>, no extendedKeyUsage check will be done. Note that an
-     * <code>X509Certificate</code> that has no extendedKeyUsage extension
+     * extension. If the {@code keyPurposeSet} returned is empty or
+     * {@code null}, no extendedKeyUsage check will be done. Note that an
+     * {@code X509Certificate} that has no extendedKeyUsage extension
      * implicitly allows all key purposes.
      *
-     * @return an immutable <code>Set</code> of key purpose OIDs in string
-     * format (or <code>null</code>)
+     * @return an immutable {@code Set} of key purpose OIDs in string
+     * format (or {@code null})
      * @see #setExtendedKeyUsage
      */
     public Set<String> getExtendedKeyUsage() {
@@ -1567,19 +1567,19 @@
     }
 
     /**
-     * Indicates if the <code>X509Certificate</code> must contain all
+     * Indicates if the {@code X509Certificate} must contain all
      * or at least one of the subjectAlternativeNames
      * specified in the {@link #setSubjectAlternativeNames
      * setSubjectAlternativeNames} or {@link #addSubjectAlternativeName
-     * addSubjectAlternativeName} methods. If <code>true</code>,
-     * the <code>X509Certificate</code> must contain all of the
-     * specified subject alternative names. If <code>false</code>, the
-     * <code>X509Certificate</code> must contain at least one of the
+     * addSubjectAlternativeName} methods. If {@code true},
+     * the {@code X509Certificate} must contain all of the
+     * specified subject alternative names. If {@code false}, the
+     * {@code X509Certificate} must contain at least one of the
      * specified subject alternative names.
      *
-     * @return <code>true</code> if the flag is enabled;
-     * <code>false</code> if the flag is disabled. The flag is
-     * <code>true</code> by default.
+     * @return {@code true} if the flag is enabled;
+     * {@code false} if the flag is disabled. The flag is
+     * {@code true} by default.
      * @see #setMatchAllSubjectAltNames
      */
     public boolean getMatchAllSubjectAltNames() {
@@ -1588,35 +1588,35 @@
 
     /**
      * Returns a copy of the subjectAlternativeNames criterion.
-     * The <code>X509Certificate</code> must contain all or at least one
+     * The {@code X509Certificate} must contain all or at least one
      * of the specified subjectAlternativeNames, depending on the value
      * of the matchAllNames flag (see {@link #getMatchAllSubjectAltNames
      * getMatchAllSubjectAltNames}). If the value returned is
-     * <code>null</code>, no subjectAlternativeNames check will be performed.
+     * {@code null}, no subjectAlternativeNames check will be performed.
      * <p>
-     * If the value returned is not <code>null</code>, it is a
-     * <code>Collection</code> with
+     * If the value returned is not {@code null}, it is a
+     * {@code Collection} with
      * one entry for each name to be included in the subject alternative name
-     * criterion. Each entry is a <code>List</code> whose first entry is an
-     * <code>Integer</code> (the name type, 0-8) and whose second
-     * entry is a <code>String</code> or a byte array (the name, in
+     * criterion. Each entry is a {@code List} whose first entry is an
+     * {@code Integer} (the name type, 0-8) and whose second
+     * entry is a {@code String} or a byte array (the name, in
      * string or ASN.1 DER encoded form, respectively).
      * There can be multiple names of the same type.  Note that the
-     * <code>Collection</code> returned may contain duplicate names (same name
+     * {@code Collection} returned may contain duplicate names (same name
      * and name type).
      * <p>
-     * Each subject alternative name in the <code>Collection</code>
-     * may be specified either as a <code>String</code> or as an ASN.1 encoded
+     * Each subject alternative name in the {@code Collection}
+     * may be specified either as a {@code String} or as an ASN.1 encoded
      * byte array. For more details about the formats used, see
      * {@link #addSubjectAlternativeName(int type, String name)
      * addSubjectAlternativeName(int type, String name)} and
      * {@link #addSubjectAlternativeName(int type, byte [] name)
      * addSubjectAlternativeName(int type, byte [] name)}.
      * <p>
-     * Note that a deep copy is performed on the <code>Collection</code> to
+     * Note that a deep copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @return a <code>Collection</code> of names (or <code>null</code>)
+     * @return a {@code Collection} of names (or {@code null})
      * @see #setSubjectAlternativeNames
      */
     public Collection<List<?>> getSubjectAlternativeNames() {
@@ -1629,21 +1629,21 @@
     /**
      * Clone an object of the form passed to
      * setSubjectAlternativeNames and setPathToNames.
-     * Throw a <code>RuntimeException</code> if the argument is malformed.
+     * Throw a {@code RuntimeException} if the argument is malformed.
      * <p>
      * This method wraps cloneAndCheckNames, changing any
-     * <code>IOException</code> into a <code>RuntimeException</code>. This
+     * {@code IOException} into a {@code RuntimeException}. This
      * method should be used when the object being
      * cloned has already been checked, so there should never be any exceptions.
      *
-     * @param names a <code>Collection</code> with one entry per name.
-     *              Each entry is a <code>List</code> whose first entry
+     * @param names a {@code Collection} with one entry per name.
+     *              Each entry is a {@code List} whose first entry
      *              is an Integer (the name type, 0-8) and whose second
      *              entry is a String or a byte array (the name, in
      *              string or ASN.1 DER encoded form, respectively).
      *              There can be multiple names of the same type. Null
      *              is not an acceptable value.
-     * @return a deep copy of the specified <code>Collection</code>
+     * @return a deep copy of the specified {@code Collection}
      * @throws RuntimeException if a parsing error occurs
      */
     private static Set<List<?>> cloneNames(Collection<List<?>> names) {
@@ -1658,34 +1658,30 @@
     /**
      * Clone and check an argument of the form passed to
      * setSubjectAlternativeNames and setPathToNames.
-     * Throw an <code>IOException</code> if the argument is malformed.
+     * Throw an {@code IOException} if the argument is malformed.
      *
-     * @param names a <code>Collection</code> with one entry per name.
-     *              Each entry is a <code>List</code> whose first entry
+     * @param names a {@code Collection} with one entry per name.
+     *              Each entry is a {@code List} whose first entry
      *              is an Integer (the name type, 0-8) and whose second
      *              entry is a String or a byte array (the name, in
      *              string or ASN.1 DER encoded form, respectively).
      *              There can be multiple names of the same type.
-     *              <code>null</code> is not an acceptable value.
-     * @return a deep copy of the specified <code>Collection</code>
+     *              {@code null} is not an acceptable value.
+     * @return a deep copy of the specified {@code Collection}
      * @throws IOException if a parsing error occurs
      */
     private static Set<List<?>> cloneAndCheckNames(Collection<List<?>> names) throws IOException {
         // Copy the Lists and Collection
         Set<List<?>> namesCopy = new HashSet<List<?>>();
-        Iterator<List<?>> i = names.iterator();
-        while (i.hasNext()) {
-            Object o = i.next();
-            if (!(o instanceof List)) {
-                throw new IOException("expected a List");
-            }
-            namesCopy.add(new ArrayList<Object>((List<?>)o));
+        for (List<?> o : names)
+        {
+            namesCopy.add(new ArrayList<Object>(o));
         }
 
         // Check the contents of the Lists and clone any byte arrays
-        i = namesCopy.iterator();
-        while (i.hasNext()) {
-            List<Object> nameList = (List<Object>)i.next();
+        for (List<?> list : namesCopy) {
+            @SuppressWarnings("unchecked") // See javadoc for parameter "names".
+            List<Object> nameList = (List<Object>)list;
             if (nameList.size() != 2) {
                 throw new IOException("name list size not 2");
             }
@@ -1714,7 +1710,7 @@
     }
 
     /**
-     * Returns the name constraints criterion. The <code>X509Certificate</code>
+     * Returns the name constraints criterion. The {@code X509Certificate}
      * must have subject and subject alternative names that
      * meet the specified name constraints.
      * <p>
@@ -1730,7 +1726,7 @@
      *
      * @return a byte array containing the ASN.1 DER encoding of
      *         a NameConstraints extension used for checking name constraints.
-     *         <code>null</code> if no name constraints check will be performed.
+     *         {@code null} if no name constraints check will be performed.
      * @see #setNameConstraints
      */
     public byte[] getNameConstraints() {
@@ -1743,7 +1739,7 @@
 
     /**
      * Returns the basic constraints constraint. If the value is greater than
-     * or equal to zero, the <code>X509Certificates</code> must include a
+     * or equal to zero, the {@code X509Certificates} must include a
      * basicConstraints extension with a pathLen of at least this value.
      * If the value is -2, only end-entity certificates are accepted. If
      * the value is -1, no basicConstraints check is done.
@@ -1756,15 +1752,15 @@
     }
 
     /**
-     * Returns the policy criterion. The <code>X509Certificate</code> must
+     * Returns the policy criterion. The {@code X509Certificate} must
      * include at least one of the specified policies in its certificate policies
-     * extension. If the <code>Set</code> returned is empty, then the
-     * <code>X509Certificate</code> must include at least some specified policy
-     * in its certificate policies extension. If the <code>Set</code> returned is
-     * <code>null</code>, no policy check will be performed.
+     * extension. If the {@code Set} returned is empty, then the
+     * {@code X509Certificate} must include at least some specified policy
+     * in its certificate policies extension. If the {@code Set} returned is
+     * {@code null}, no policy check will be performed.
      *
-     * @return an immutable <code>Set</code> of certificate policy OIDs in
-     *         string format (or <code>null</code>)
+     * @return an immutable {@code Set} of certificate policy OIDs in
+     *         string format (or {@code null})
      * @see #setPolicy
      */
     public Set<String> getPolicy() {
@@ -1773,33 +1769,33 @@
 
     /**
      * Returns a copy of the pathToNames criterion. The
-     * <code>X509Certificate</code> must not include name constraints that would
+     * {@code X509Certificate} must not include name constraints that would
      * prohibit building a path to the specified names. If the value
-     * returned is <code>null</code>, no pathToNames check will be performed.
+     * returned is {@code null}, no pathToNames check will be performed.
      * <p>
-     * If the value returned is not <code>null</code>, it is a
-     * <code>Collection</code> with one
+     * If the value returned is not {@code null}, it is a
+     * {@code Collection} with one
      * entry for each name to be included in the pathToNames
-     * criterion. Each entry is a <code>List</code> whose first entry is an
-     * <code>Integer</code> (the name type, 0-8) and whose second
-     * entry is a <code>String</code> or a byte array (the name, in
+     * criterion. Each entry is a {@code List} whose first entry is an
+     * {@code Integer} (the name type, 0-8) and whose second
+     * entry is a {@code String} or a byte array (the name, in
      * string or ASN.1 DER encoded form, respectively).
      * There can be multiple names of the same type. Note that the
-     * <code>Collection</code> returned may contain duplicate names (same
+     * {@code Collection} returned may contain duplicate names (same
      * name and name type).
      * <p>
-     * Each name in the <code>Collection</code>
-     * may be specified either as a <code>String</code> or as an ASN.1 encoded
+     * Each name in the {@code Collection}
+     * may be specified either as a {@code String} or as an ASN.1 encoded
      * byte array. For more details about the formats used, see
      * {@link #addPathToName(int type, String name)
      * addPathToName(int type, String name)} and
      * {@link #addPathToName(int type, byte [] name)
      * addPathToName(int type, byte [] name)}.
      * <p>
-     * Note that a deep copy is performed on the <code>Collection</code> to
+     * Note that a deep copy is performed on the {@code Collection} to
      * protect against subsequent modifications.
      *
-     * @return a <code>Collection</code> of names (or <code>null</code>)
+     * @return a {@code Collection} of names (or {@code null})
      * @see #setPathToNames
      */
     public Collection<List<?>> getPathToNames() {
@@ -1810,10 +1806,10 @@
     }
 
     /**
-     * Return a printable representation of the <code>CertSelector</code>.
+     * Return a printable representation of the {@code CertSelector}.
      *
-     * @return a <code>String</code> describing the contents of the
-     *         <code>CertSelector</code>
+     * @return a {@code String} describing the contents of the
+     *         {@code CertSelector}
      */
     public String toString() {
         StringBuffer sb = new StringBuffer();
@@ -1932,22 +1928,22 @@
 
     /**
      * Returns an Extension object given any X509Certificate and extension oid.
-     * Throw an <code>IOException</code> if the extension byte value is
+     * Throw an {@code IOException} if the extension byte value is
      * malformed.
      *
-     * @param cert a <code>X509Certificate</code>
-     * @param extId an <code>integer</code> which specifies the extension index.
+     * @param cert a {@code X509Certificate}
+     * @param extId an {@code integer} which specifies the extension index.
      * Currently, the supported extensions are as follows:
      * index 0 - PrivateKeyUsageExtension
      * index 1 - SubjectAlternativeNameExtension
      * index 2 - NameConstraintsExtension
      * index 3 - CertificatePoliciesExtension
      * index 4 - ExtendedKeyUsageExtension
-     * @return an <code>Extension</code> object whose real type is as specified
+     * @return an {@code Extension} object whose real type is as specified
      * by the extension oid.
-     * @throws IOException if cannot construct the <code>Extension</code>
+     * @throws IOException if cannot construct the {@code Extension}
      * object with the extension encoding retrieved from the passed in
-     * <code>X509Certificate</code>.
+     * {@code X509Certificate}.
      */
     private static Extension getExtensionObject(X509Certificate cert, int extId)
             throws IOException {
@@ -1995,11 +1991,11 @@
     }
 
     /**
-     * Decides whether a <code>Certificate</code> should be selected.
+     * Decides whether a {@code Certificate} should be selected.
      *
-     * @param cert the <code>Certificate</code> to be checked
-     * @return <code>true</code> if the <code>Certificate</code> should be
-     *         selected, <code>false</code> otherwise
+     * @param cert the {@code Certificate} to be checked
+     * @return {@code true} if the {@code Certificate} should be
+     *         selected, {@code false} otherwise
      */
     public boolean match(Certificate cert) {
         if (!(cert instanceof X509Certificate)) {
@@ -2185,8 +2181,7 @@
             if (debug != null) {
                 String time = "n/a";
                 try {
-                    Date notAfter =
-                        (Date)ext.get(PrivateKeyUsageExtension.NOT_AFTER);
+                    Date notAfter = ext.get(PrivateKeyUsageExtension.NOT_AFTER);
                     time = notAfter.toString();
                 } catch (CertificateException ex) {
                     // not able to retrieve notAfter value
@@ -2202,8 +2197,7 @@
             if (debug != null) {
                 String time = "n/a";
                 try {
-                    Date notBefore = (Date)
-                        ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
+                    Date notBefore = ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
                     time = notBefore.toString();
                 } catch (CertificateException ex) {
                     // not able to retrieve notBefore value
@@ -2245,7 +2239,7 @@
                     + subjectPublicKeyAlgID + ", xcert subjectPublicKeyAlgID = "
                     + algID.getOID());
             }
-            if (!subjectPublicKeyAlgID.equals(algID.getOID())) {
+            if (!subjectPublicKeyAlgID.equals((Object)algID.getOID())) {
                 if (debug != null) {
                     debug.println("X509CertSelector.match: "
                         + "subject public key alg IDs don't match");
@@ -2294,7 +2288,7 @@
                                                 EXTENDED_KEY_USAGE_ID);
             if (ext != null) {
                 Vector<ObjectIdentifier> certKeyPurposeVector =
-                    (Vector<ObjectIdentifier>)ext.get(ExtendedKeyUsageExtension.USAGES);
+                    ext.get(ExtendedKeyUsageExtension.USAGES);
                 if (!certKeyPurposeVector.contains(ANY_EXTENDED_KEY_USAGE)
                         && !certKeyPurposeVector.containsAll(keyPurposeOIDSet)) {
                     if (debug != null) {
@@ -2330,8 +2324,8 @@
                 }
                 return false;
             }
-            GeneralNames certNames = (GeneralNames)
-                sanExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
+            GeneralNames certNames =
+                    sanExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
             Iterator<GeneralNameInterface> i =
                                 subjectAlternativeGeneralNames.iterator();
             while (i.hasNext()) {
@@ -2399,7 +2393,7 @@
                 }
                 return false;
             }
-            List<PolicyInformation> policies = (List<PolicyInformation>)ext.get(CertificatePoliciesExtension.POLICIES);
+            List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES);
             /*
              * Convert the Vector of PolicyInformation to a Vector
              * of CertificatePolicyIds for easier comparison.
@@ -2460,7 +2454,7 @@
             if (ext == null) {
                 return true;
             }
-            if ((debug != null) && debug.isOn("certpath")) {
+            if ((debug != null) && Debug.isOn("certpath")) {
                 debug.println("X509CertSelector.match pathToNames:\n");
                 Iterator<GeneralNameInterface> i =
                                         pathToGeneralNames.iterator();
@@ -2469,10 +2463,10 @@
                 }
             }
 
-            GeneralSubtrees permitted = (GeneralSubtrees)
-                ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
-            GeneralSubtrees excluded = (GeneralSubtrees)
-                ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
+            GeneralSubtrees permitted =
+                    ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
+            GeneralSubtrees excluded =
+                    ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
             if (excluded != null) {
                 if (matchExcluded(excluded) == false) {
                     return false;
@@ -2581,8 +2575,10 @@
         } else {
             if (maxPathLen < basicConstraints) {
                 if (debug != null) {
-                    debug.println("X509CertSelector.match: maxPathLen too small ("
-                        + maxPathLen + " < " + basicConstraints + ")");
+                    debug.println("X509CertSelector.match: cert's maxPathLen " +
+                            "is less than the min maxPathLen set by " +
+                            "basicConstraints. " +
+                            "(" + maxPathLen + " < " + basicConstraints + ")");
                 }
                 return false;
             }
@@ -2590,12 +2586,13 @@
         return true;
     }
 
-    private static Set<?> cloneSet(Set<?> set) {
+    @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
+    private static <T> Set<T> cloneSet(Set<T> set) {
         if (set instanceof HashSet) {
-            Object clone = ((HashSet<?>)set).clone();
-            return (Set<?>)clone;
+            Object clone = ((HashSet<T>)set).clone();
+            return (Set<T>)clone;
         } else {
-            return new HashSet<Object>(set);
+            return new HashSet<T>(set);
         }
     }
 
@@ -2610,22 +2607,18 @@
             // Must clone these because addPathToName et al. modify them
             if (subjectAlternativeNames != null) {
                 copy.subjectAlternativeNames =
-                        (Set<List<?>>)cloneSet(subjectAlternativeNames);
+                        cloneSet(subjectAlternativeNames);
                 copy.subjectAlternativeGeneralNames =
-                        (Set<GeneralNameInterface>)cloneSet
-                                (subjectAlternativeGeneralNames);
+                        cloneSet(subjectAlternativeGeneralNames);
             }
             if (pathToGeneralNames != null) {
-                copy.pathToNames =
-                        (Set<List<?>>)cloneSet(pathToNames);
-                copy.pathToGeneralNames =
-                        (Set<GeneralNameInterface>)cloneSet
-                                (pathToGeneralNames);
+                copy.pathToNames = cloneSet(pathToNames);
+                copy.pathToGeneralNames = cloneSet(pathToGeneralNames);
             }
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
diff --git a/ojluni/src/main/java/java/security/cert/X509Extension.java b/ojluni/src/main/java/java/security/cert/X509Extension.java
index 6f6c51b..0346960 100644
--- a/ojluni/src/main/java/java/security/cert/X509Extension.java
+++ b/ojluni/src/main/java/java/security/cert/X509Extension.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -59,9 +59,9 @@
  *                   -- the extnId object identifier value
  * }
  * </pre>
- * Since not all extensions are known, the <code>getExtensionValue</code>
+ * Since not all extensions are known, the {@code getExtensionValue}
  * method returns the DER-encoded OCTET STRING of the
- * extension value (i.e., the <code>extnValue</code>). This can then
+ * extension value (i.e., the {@code extnValue}). This can then
  * be handled by a <em>Class</em> that understands the extension.
  *
  * @author Hemma Prafullchandra
@@ -72,8 +72,8 @@
     /**
      * Check if there is a critical extension that is not supported.
      *
-     * @return <tt>true</tt> if a critical extension is found that is
-     * not supported, otherwise <tt>false</tt>.
+     * @return {@code true} if a critical extension is found that is
+     * not supported, otherwise {@code false}.
      */
     public boolean hasUnsupportedCriticalExtension();
 
@@ -84,18 +84,12 @@
      *
      * Here is sample code to get a Set of critical extensions from an
      * X509Certificate and print the OIDs:
-     * <pre><code>
-     * InputStream inStrm = null;
+     * <pre>{@code
      * X509Certificate cert = null;
-     * try {
-     *     inStrm = new FileInputStream("DER-encoded-Cert");
+     * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
      *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
      *     cert = (X509Certificate)cf.generateCertificate(inStrm);
-     * } finally {
-     *     if (inStrm != null) {
-     *         inStrm.close();
-     *     }
-     * }<p>
+     * }
      *
      * Set<String> critSet = cert.getCriticalExtensionOIDs();
      * if (critSet != null && !critSet.isEmpty()) {
@@ -104,7 +98,7 @@
      *         System.out.println(oid);
      *     }
      * }
-     * </code></pre>
+     * }</pre>
      * @return a Set (or an empty Set if none are marked critical) of
      * the extension OID strings for extensions that are marked critical.
      * If there are no extensions present at all, then this method returns
@@ -119,35 +113,28 @@
      *
      * Here is sample code to get a Set of non-critical extensions from an
      * X509CRL revoked certificate entry and print the OIDs:
-     * <pre><code>
-     * InputStream inStrm = null;
+     * <pre>{@code
      * CertificateFactory cf = null;
      * X509CRL crl = null;
-     * try {
-     *     inStrm = new FileInputStream("DER-encoded-CRL");
+     * try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
      *     cf = CertificateFactory.getInstance("X.509");
      *     crl = (X509CRL)cf.generateCRL(inStrm);
-     * } finally {
-     *     if (inStrm != null) {
-     *         inStrm.close();
-     *     }
-     * }<p>
+     * }
      *
-     * byte[] certData = &lt;DER-encoded certificate data&gt;
+     * byte[] certData = <DER-encoded certificate data>
      * ByteArrayInputStream bais = new ByteArrayInputStream(certData);
      * X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
-     * bais.close();
      * X509CRLEntry badCert =
-     *              crl.getRevokedCertificate(cert.getSerialNumber());<p>
+     *              crl.getRevokedCertificate(cert.getSerialNumber());
      *
      * if (badCert != null) {
-     *     Set<String> nonCritSet = badCert.getNonCriticalExtensionOIDs();<p>
+     *     Set<String> nonCritSet = badCert.getNonCriticalExtensionOIDs();
      *     if (nonCritSet != null)
      *         for (String oid : nonCritSet) {
      *             System.out.println(oid);
      *         }
      * }
-     * </code></pre>
+     * }</pre>
      *
      * @return a Set (or an empty Set if none are marked non-critical) of
      * the extension OID strings for extensions that are marked non-critical.
@@ -158,9 +145,9 @@
 
     /**
      * Gets the DER-encoded OCTET string for the extension value
-     * (<em>extnValue</em>) identified by the passed-in <code>oid</code>
+     * (<em>extnValue</em>) identified by the passed-in {@code oid}
      * String.
-     * The <code>oid</code> string is
+     * The {@code oid} string is
      * represented by a set of nonnegative whole numbers separated
      * by periods.
      *
diff --git a/ojluni/src/main/java/java/security/cert/package-info.java b/ojluni/src/main/java/java/security/cert/package-info.java
new file mode 100644
index 0000000..0ef896b
--- /dev/null
+++ b/ojluni/src/main/java/java/security/cert/package-info.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * Provides classes and interfaces for parsing and managing
+ * certificates, certificate revocation lists (CRLs), and
+ * certification paths. It contains support for X.509 v3
+ * certificates and X.509 v2 CRLs.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ *   <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/CryptoSpec.html">
+ *     <b>Java&trade;
+ *     Cryptography Architecture (JCA) Reference Guide</b></a>
+ *   <li>RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
+ *     Certificate Revocation List (CRL) Profile
+ *   <li>RFC 2560: X.509 Internet Public Key Infrastructure Online Certificate
+ *     Status Protocol - OCSP
+ *   <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html">
+ *     <b>Java&trade;
+ *     Cryptography Architecture Standard Algorithm Name
+ *     Documentation</b></a></li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For information about X.509 certificates and CRLs, please see:
+ * <ul>
+ *   <li><a href="http://www.ietf.org/rfc/rfc5280.txt">
+ *     http://www.ietf.org/rfc/rfc5280.txt</a>
+ *   <li><a href=
+ *     "{@docRoot}/../technotes/guides/security/certpath/CertPathProgGuide.html">
+ *     <b>Java&trade;
+ *     PKI Programmer's Guide</b></a>
+ *   <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/cert3.html">
+ *     <b>X.509 Certificates and Certificate Revocation Lists (CRLs)</b></a>
+ * </ul>
+ *
+ * @since 1.2
+ */
+package java.security.cert;
diff --git a/ojluni/src/main/java/java/security/interfaces/DSAKeyPairGenerator.java b/ojluni/src/main/java/java/security/interfaces/DSAKeyPairGenerator.java
index d86bbbc..e50cfd2 100644
--- a/ojluni/src/main/java/java/security/interfaces/DSAKeyPairGenerator.java
+++ b/ojluni/src/main/java/java/security/interfaces/DSAKeyPairGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -30,8 +30,8 @@
 /**
  * An interface to an object capable of generating DSA key pairs.
  *
- * <p>The <code>initialize</code> methods may each be called any number
- * of times. If no <code>initialize</code> method is called on a
+ * <p>The {@code initialize} methods may each be called any number
+ * of times. If no {@code initialize} method is called on a
  * DSAKeyPairGenerator, the default is to generate 1024-bit keys, using
  * precomputed p, q and g parameters and an instance of SecureRandom as
  * the random bit source.
@@ -42,26 +42,29 @@
  * <ol>
  *
  * <li>Get a key pair generator for the DSA algorithm by calling the
- * KeyPairGenerator <code>getInstance</code> method with "DSA"
- * as its argument.<p>
+ * KeyPairGenerator {@code getInstance} method with "DSA"
+ * as its argument.
  *
  * <li>Initialize the generator by casting the result to a DSAKeyPairGenerator
  * and calling one of the
- * <code>initialize</code> methods from this DSAKeyPairGenerator interface.<p>
+ * {@code initialize} methods from this DSAKeyPairGenerator interface.
  *
- * <li>Generate a key pair by calling the <code>generateKeyPair</code>
+ * <li>Generate a key pair by calling the {@code generateKeyPair}
  * method from the KeyPairGenerator class.
  *
  * </ol>
  *
  * <p>Note: it is not always necessary to do do algorithm-specific
  * initialization for a DSA key pair generator. That is, it is not always
- * necessary to call an <code>initialize</code> method in this interface.
- * Algorithm-independent initialization using the <code>initialize</code> method
+ * necessary to call an {@code initialize} method in this interface.
+ * Algorithm-independent initialization using the {@code initialize} method
  * in the KeyPairGenerator
  * interface is all that is needed when you accept defaults for algorithm-specific
  * parameters.
  *
+ * <p>Note: Some earlier implementations of this interface may not support
+ * larger sizes of DSA parameters such as 2048 and 3072-bit.
+ *
  * @see java.security.KeyPairGenerator
  */
 public interface DSAKeyPairGenerator {
@@ -77,8 +80,8 @@
      * @param random the random bit source to use to generate key bits;
      * can be null.
      *
-     * @exception InvalidParameterException if the <code>params</code>
-     * value is invalid or null.
+     * @exception InvalidParameterException if the {@code params}
+     * value is invalid, null, or unsupported.
      */
    public void initialize(DSAParams params, SecureRandom random)
    throws InvalidParameterException;
@@ -89,7 +92,7 @@
      * If a SecureRandom bit source is needed but not supplied, i.e.
      * null, a default SecureRandom instance will be used.
      *
-     * <p>If <code>genParams</code> is true, this method generates new
+     * <p>If {@code genParams} is true, this method generates new
      * p, q and g parameters. If it is false, the method uses precomputed
      * parameters for the modulus length requested. If there are no
      * precomputed parameters for that modulus length, an exception will be
@@ -97,7 +100,7 @@
      * default parameters for modulus lengths of 512 and 1024 bits.
      *
      * @param modlen the modulus length in bits. Valid values are any
-     * multiple of 8 between 512 and 1024, inclusive.
+     * multiple of 64 between 512 and 1024, inclusive, 2048, and 3072.
      *
      * @param random the random bit source to use to generate key bits;
      * can be null.
@@ -105,10 +108,9 @@
      * @param genParams whether or not to generate new parameters for
      * the modulus length requested.
      *
-     * @exception InvalidParameterException if <code>modlen</code> is not
-     * between 512 and 1024, or if <code>genParams</code> is false and
-     * there are no precomputed parameters for the requested modulus
-     * length.
+     * @exception InvalidParameterException if {@code modlen} is
+     * invalid, or unsupported, or if {@code genParams} is false and there
+     * are no precomputed parameters for the requested modulus length.
      */
     public void initialize(int modlen, boolean genParams, SecureRandom random)
     throws InvalidParameterException;
diff --git a/ojluni/src/main/java/java/security/interfaces/DSAParams.java b/ojluni/src/main/java/java/security/interfaces/DSAParams.java
index f20b8ec..b672ad5 100644
--- a/ojluni/src/main/java/java/security/interfaces/DSAParams.java
+++ b/ojluni/src/main/java/java/security/interfaces/DSAParams.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -42,23 +42,23 @@
 public interface DSAParams {
 
     /**
-     * Returns the prime, <code>p</code>.
+     * Returns the prime, {@code p}.
      *
-     * @return the prime, <code>p</code>.
+     * @return the prime, {@code p}.
      */
     public BigInteger getP();
 
     /**
-     * Returns the subprime, <code>q</code>.
+     * Returns the subprime, {@code q}.
      *
-     * @return the subprime, <code>q</code>.
+     * @return the subprime, {@code q}.
      */
     public BigInteger getQ();
 
     /**
-     * Returns the base, <code>g</code>.
+     * Returns the base, {@code g}.
      *
-     * @return the base, <code>g</code>.
+     * @return the base, {@code g}.
      */
     public BigInteger getG();
 }
diff --git a/ojluni/src/main/java/java/security/interfaces/DSAPrivateKey.java b/ojluni/src/main/java/java/security/interfaces/DSAPrivateKey.java
index a0d1893..81ab358 100644
--- a/ojluni/src/main/java/java/security/interfaces/DSAPrivateKey.java
+++ b/ojluni/src/main/java/java/security/interfaces/DSAPrivateKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,9 +50,9 @@
     static final long serialVersionUID = 7776497482533790279L;
 
     /**
-     * Returns the value of the private key, <code>x</code>.
+     * Returns the value of the private key, {@code x}.
      *
-     * @return the value of the private key, <code>x</code>.
+     * @return the value of the private key, {@code x}.
      */
     public BigInteger getX();
 }
diff --git a/ojluni/src/main/java/java/security/interfaces/DSAPublicKey.java b/ojluni/src/main/java/java/security/interfaces/DSAPublicKey.java
index b273738..e56b795 100644
--- a/ojluni/src/main/java/java/security/interfaces/DSAPublicKey.java
+++ b/ojluni/src/main/java/java/security/interfaces/DSAPublicKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -50,9 +50,9 @@
     static final long serialVersionUID = 1234526332779022332L;
 
     /**
-     * Returns the value of the public key, <code>y</code>.
+     * Returns the value of the public key, {@code y}.
      *
-     * @return the value of the public key, <code>y</code>.
+     * @return the value of the public key, {@code y}.
      */
     public BigInteger getY();
 }
diff --git a/ojluni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java b/ojluni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
index 19cddce..f85d96a 100644
--- a/ojluni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
+++ b/ojluni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -46,6 +46,11 @@
 
 public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey {
 
+    /**
+     * The type fingerprint that is set to indicate
+     * serialization compatibility with a previous
+     * version of the type.
+     */
     static final long serialVersionUID = 618058533534628008L;
 
     /**
diff --git a/ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java b/ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java
index 670af46..0408fea 100644
--- a/ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java
+++ b/ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -39,6 +39,11 @@
 
 public interface RSAPrivateCrtKey extends RSAPrivateKey {
 
+    /**
+     * The type fingerprint that is set to indicate
+     * serialization compatibility with a previous
+     * version of the type.
+     */
     static final long serialVersionUID = -5682214253527700368L;
 
     /**
diff --git a/ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java b/ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java
index 522c5ba..5d69ad6 100644
--- a/ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java
+++ b/ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -39,6 +39,11 @@
 public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey
 {
 
+    /**
+     * The type fingerprint that is set to indicate
+     * serialization compatibility with a previous
+     * version of the type.
+     */
     static final long serialVersionUID = 5187144804936595022L;
 
     /**
diff --git a/ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java b/ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java
index 04d80cf..a698c05 100644
--- a/ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java
+++ b/ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -36,6 +36,11 @@
 
 public interface RSAPublicKey extends java.security.PublicKey, RSAKey
 {
+    /**
+     * The type fingerprint that is set to indicate
+     * serialization compatibility with a previous
+     * version of the type.
+     */
     static final long serialVersionUID = -8727434096241101194L;
 
     /**
diff --git a/ojluni/src/main/java/java/security/interfaces/package-info.java b/ojluni/src/main/java/java/security/interfaces/package-info.java
new file mode 100644
index 0000000..a2d77da
--- /dev/null
+++ b/ojluni/src/main/java/java/security/interfaces/package-info.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * Provides interfaces for generating RSA (Rivest, Shamir and
+ * Adleman AsymmetricCipher algorithm)
+ * keys as defined in the RSA Laboratory Technical Note
+ * PKCS#1, and DSA (Digital Signature
+ * Algorithm) keys as defined in NIST's FIPS-186.
+ * <P>
+ * Note that these interfaces are intended only for key
+ * implementations whose key material is accessible and
+ * available. These interfaces are not intended for key
+ * implementations whose key material resides in
+ * inaccessible, protected storage (such as in a
+ * hardware device).
+ * <P>
+ * For more developer information on how to use these
+ * interfaces, including information on how to design
+ * {@code Key} classes for hardware devices, please refer
+ * to these cryptographic provider developer guides:
+ * <ul>
+ *   <li><a href=
+ *     "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/HowToImplAProvider.html">
+ *     <b>How to Implement a Provider for the
+ *     Java&trade; Cryptography Architecture
+ *     </b></a></li>
+ * </ul>
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ *   <li>PKCS #1: RSA Encryption Standard, Version 1.5, November 1993 </li>
+ *   <li>Federal Information Processing Standards Publication (FIPS PUB) 186:
+ *     Digital Signature Standard (DSS) </li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For further documentation, please see:
+ * <ul>
+ *   <li>
+ *     <a href=
+ *       "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/CryptoSpec.html">
+ *       <b>Java&trade;
+ *       Cryptography Architecture API Specification and Reference
+ *       </b></a></li>
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+package java.security.interfaces;
diff --git a/ojluni/src/main/java/sun/nio/ch/EPollSelectorProvider.java b/ojluni/src/main/java/sun/nio/ch/EPollSelectorProvider.java
index 9a3c5d2..060819c 100644
--- a/ojluni/src/main/java/sun/nio/ch/EPollSelectorProvider.java
+++ b/ojluni/src/main/java/sun/nio/ch/EPollSelectorProvider.java
@@ -36,7 +36,8 @@
         return new EPollSelectorImpl(this);
     }
 
-    public Channel inheritedChannel() throws IOException {
-        return InheritedChannel.getChannel();
-    }
+    // Android-changed: Android never has stdin/stdout connected to a socket.
+    // public Channel inheritedChannel() throws IOException {
+    //     return InheritedChannel.getChannel();
+    // }
 }
diff --git a/ojluni/src/main/java/sun/nio/ch/InheritedChannel.java b/ojluni/src/main/java/sun/nio/ch/InheritedChannel.java
deleted file mode 100644
index 9c38c5f..0000000
--- a/ojluni/src/main/java/sun/nio/ch/InheritedChannel.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package sun.nio.ch;
-
-import java.lang.reflect.Constructor;
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.nio.channels.Channel;
-import java.nio.channels.SocketChannel;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.DatagramChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-class InheritedChannel {
-
-    // the "types" of socket returned by soType0
-    private static final int UNKNOWN            = -1;
-    private static final int SOCK_STREAM        = 1;
-    private static final int SOCK_DGRAM         = 2;
-
-    // oflag values when opening a file
-    private static final int O_RDONLY           = 0;
-    private static final int O_WRONLY           = 1;
-    private static final int O_RDWR             = 2;
-
-    /*
-     * In order to "detach" the standard streams we dup them to /dev/null.
-     * In order to reduce the possibility of an error at close time we
-     * open /dev/null early - that way we know we won't run out of file
-     * descriptors at close time. This makes the close operation a
-     * simple dup2 operation for each of the standard streams.
-     */
-    private static int devnull = -1;
-
-    private static void detachIOStreams() {
-        try {
-            dup2(devnull, 0);
-            dup2(devnull, 1);
-            dup2(devnull, 2);
-        } catch (IOException ioe) {
-            // this shouldn't happen
-            throw new InternalError(ioe);
-        }
-    }
-
-    /*
-     * Override the implCloseSelectableChannel for each channel type - this
-     * allows us to "detach" the standard streams after closing and ensures
-     * that the underlying socket really closes.
-     */
-    public static class InheritedSocketChannelImpl extends SocketChannelImpl {
-
-        InheritedSocketChannelImpl(SelectorProvider sp,
-                                   FileDescriptor fd,
-                                   InetSocketAddress remote)
-            throws IOException
-        {
-            super(sp, fd, remote);
-        }
-
-        protected void implCloseSelectableChannel() throws IOException {
-            super.implCloseSelectableChannel();
-            detachIOStreams();
-        }
-    }
-
-    public static class InheritedServerSocketChannelImpl extends
-        ServerSocketChannelImpl {
-
-        InheritedServerSocketChannelImpl(SelectorProvider sp,
-                                         FileDescriptor fd)
-            throws IOException
-        {
-            super(sp, fd, true);
-        }
-
-        protected void implCloseSelectableChannel() throws IOException {
-            super.implCloseSelectableChannel();
-            detachIOStreams();
-        }
-
-    }
-
-    public static class InheritedDatagramChannelImpl extends
-        DatagramChannelImpl {
-
-        InheritedDatagramChannelImpl(SelectorProvider sp,
-                                     FileDescriptor fd)
-            throws IOException
-        {
-            super(sp, fd);
-        }
-
-        protected void implCloseSelectableChannel() throws IOException {
-            super.implCloseSelectableChannel();
-            detachIOStreams();
-        }
-    }
-
-    /*
-     * If there's a SecurityManager then check for the appropriate
-     * RuntimePermission.
-     */
-    private static void checkAccess(Channel c) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(
-                new RuntimePermission("inheritedChannel")
-            );
-        }
-    }
-
-
-    /*
-     * If standard inherited channel is connected to a socket then return a Channel
-     * of the appropriate type based standard input.
-     */
-    private static Channel createChannel() throws IOException {
-
-        // dup the file descriptor - we do this so that for two reasons :-
-        // 1. Avoids any timing issues with FileDescriptor.in being closed
-        //    or redirected while we create the channel.
-        // 2. Allows streams based on file descriptor 0 to co-exist with
-        //    the channel (closing one doesn't impact the other)
-
-        int fdVal = dup(0);
-
-        // Examine the file descriptor - if it's not a socket then we don't
-        // create a channel so we release the file descriptor.
-
-        int st;
-        st = soType0(fdVal);
-        if (st != SOCK_STREAM && st != SOCK_DGRAM) {
-            close0(fdVal);
-            return null;
-        }
-
-
-        // Next we create a FileDescriptor for the dup'ed file descriptor
-        // Have to use reflection and also make assumption on how FD
-        // is implemented.
-
-        Class paramTypes[] = { int.class };
-        Constructor<?> ctr = Reflect.lookupConstructor("java.io.FileDescriptor",
-                                                       paramTypes);
-        Object args[] = { new Integer(fdVal) };
-        FileDescriptor fd = (FileDescriptor)Reflect.invoke(ctr, args);
-
-
-        // Now create the channel. If the socket is a streams socket then
-        // we see if tthere is a peer (ie: connected). If so, then we
-        // create a SocketChannel, otherwise a ServerSocketChannel.
-        // If the socket is a datagram socket then create a DatagramChannel
-
-        SelectorProvider provider = SelectorProvider.provider();
-        assert provider instanceof sun.nio.ch.SelectorProviderImpl;
-
-        Channel c;
-        if (st == SOCK_STREAM) {
-            InetAddress ia = peerAddress0(fdVal);
-            if (ia == null) {
-               c = new InheritedServerSocketChannelImpl(provider, fd);
-            } else {
-               int port = peerPort0(fdVal);
-               assert port > 0;
-               InetSocketAddress isa = new InetSocketAddress(ia, port);
-               c = new InheritedSocketChannelImpl(provider, fd, isa);
-            }
-        } else {
-            c = new InheritedDatagramChannelImpl(provider, fd);
-        }
-        return c;
-    }
-
-    private static boolean haveChannel = false;
-    private static Channel channel = null;
-
-    /*
-     * Returns a Channel representing the inherited channel if the
-     * inherited channel is a stream connected to a network socket.
-     */
-    public static synchronized Channel getChannel() throws IOException {
-        if (devnull < 0) {
-            devnull = open0("/dev/null", O_RDWR);
-        }
-
-        // If we don't have the channel try to create it
-        if (!haveChannel) {
-            channel = createChannel();
-            haveChannel = true;
-        }
-
-        // if there is a channel then do the security check before
-        // returning it.
-        if (channel != null) {
-            checkAccess(channel);
-        }
-        return channel;
-    }
-
-
-    // -- Native methods --
-
-    private static native int dup(int fd) throws IOException;
-    private static native void dup2(int fd, int fd2) throws IOException;
-    private static native int open0(String path, int oflag) throws IOException;
-    private static native void close0(int fd) throws IOException;
-    private static native int soType0(int fd);
-    private static native InetAddress peerAddress0(int fd);
-    private static native int peerPort0(int fd);
-}
diff --git a/ojluni/src/main/java/sun/nio/ch/PollSelectorProvider.java b/ojluni/src/main/java/sun/nio/ch/PollSelectorProvider.java
index 8570774..9ea18c9 100644
--- a/ojluni/src/main/java/sun/nio/ch/PollSelectorProvider.java
+++ b/ojluni/src/main/java/sun/nio/ch/PollSelectorProvider.java
@@ -36,7 +36,8 @@
         return new PollSelectorImpl(this);
     }
 
-    public Channel inheritedChannel() throws IOException {
-        return InheritedChannel.getChannel();
-    }
+    // Android-changed: Android never has stdin/stdout connected to a socket.
+    // public Channel inheritedChannel() throws IOException {
+    //     return InheritedChannel.getChannel();
+    // }
 }
diff --git a/ojluni/src/main/native/Inet6Address.c b/ojluni/src/main/native/Inet6Address.c
index ad2d978..6f0ac57 100644
--- a/ojluni/src/main/native/Inet6Address.c
+++ b/ojluni/src/main/native/Inet6Address.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -36,30 +36,33 @@
  */
 
 jclass ia6_class;
+jfieldID ia6_holder6ID;
+
 jfieldID ia6_ipaddressID;
 jfieldID ia6_scopeidID;
 jfieldID ia6_scopeidsetID;
 jfieldID ia6_scopeifnameID;
-jfieldID ia6_scopeifnamesetID;
 jmethodID ia6_ctrID;
 
 static void Inet6Address_init(JNIEnv *env) {
+    jclass ia6h_class;
     jclass c = (*env)->FindClass(env, "java/net/Inet6Address");
     CHECK_NULL(c);
     ia6_class = (*env)->NewGlobalRef(env, c);
     CHECK_NULL(ia6_class);
-    ia6_ipaddressID = (*env)->GetFieldID(env, ia6_class, "ipaddress", "[B");
+    ia6h_class = (*env)->FindClass(env, "java/net/Inet6Address$Inet6AddressHolder");
+    CHECK_NULL(ia6h_class);
+    ia6_holder6ID = (*env)->GetFieldID(env, ia6_class, "holder6", "Ljava/net/Inet6Address$Inet6AddressHolder;");
+    CHECK_NULL(ia6_holder6ID);
+    ia6_ipaddressID = (*env)->GetFieldID(env, ia6h_class, "ipaddress", "[B");
     CHECK_NULL(ia6_ipaddressID);
-    ia6_scopeidID = (*env)->GetFieldID(env, ia6_class, "scope_id", "I");
+    ia6_scopeidID = (*env)->GetFieldID(env, ia6h_class, "scope_id", "I");
     CHECK_NULL(ia6_scopeidID);
-    ia6_scopeidsetID = (*env)->GetFieldID(env, ia6_class, "scope_id_set", "Z");
-    CHECK_NULL(ia6_scopeidID);
-    ia6_scopeifnameID = (*env)->GetFieldID(env, ia6_class, "scope_ifname", "Ljava/net/NetworkInterface;");
+    ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z");
+    CHECK_NULL(ia6_scopeidsetID);
+    ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;");
     CHECK_NULL(ia6_scopeifnameID);
-    ia6_scopeifnamesetID = (*env)->GetFieldID(env, ia6_class, "scope_ifname_set", "Z");
-    CHECK_NULL(ia6_scopeifnamesetID);
     ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "<init>", "()V");
-    CHECK_NULL(ia6_ctrID);
 }
 
 void register_java_net_Inet6Address(JNIEnv* env) {
diff --git a/ojluni/src/main/native/Inet6AddressImpl.c b/ojluni/src/main/native/Inet6AddressImpl.c
index f57a8d2..85f2314 100644
--- a/ojluni/src/main/native/Inet6AddressImpl.c
+++ b/ojluni/src/main/native/Inet6AddressImpl.c
@@ -65,8 +65,6 @@
 static jclass ni_ia6cls;
 static jmethodID ni_ia4ctrID;
 static jmethodID ni_ia6ctrID;
-static jfieldID ni_ia6ipaddressID;
-static int initialized = 0;
 
 /*
  * Class:     java_net_Inet6AddressImpl
diff --git a/ojluni/src/main/native/InheritedChannel.c b/ojluni/src/main/native/InheritedChannel.c
deleted file mode 100644
index 8fd6028..0000000
--- a/ojluni/src/main/native/InheritedChannel.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2003, 2008, 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.
- */
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "jni.h"
-
-#include "jni.h"
-#include "jni_util.h"
-#include "net_util.h"
-
-#include "sun_nio_ch_InheritedChannel.h"
-
-#include "JNIHelp.h"
-
-#define NATIVE_METHOD(className, functionName, signature) \
-{ #functionName, signature, (void*)(Java_sun_nio_ch_ ## className ## _ ## functionName) }
-
-static int matchFamily(struct sockaddr *sa) {
-    int family = sa->sa_family;
-#ifdef AF_INET6
-    if (ipv6_available()) {
-        return (family == AF_INET6);
-    }
-#endif
-    return (family == AF_INET);
-}
-
-JNIEXPORT jobject JNICALL
-Java_sun_nio_ch_InheritedChannel_peerAddress0(JNIEnv *env, jclass cla, jint fd)
-{
-    struct sockaddr *sa;
-    socklen_t sa_len;
-    jobject remote_ia = NULL;
-    jint remote_port;
-
-    NET_AllocSockaddr(&sa, (int *)&sa_len);
-    if (getpeername(fd, sa, &sa_len) == 0) {
-        if (matchFamily(sa)) {
-            remote_ia = NET_SockaddrToInetAddress(env, sa, (int *)&remote_port);
-        }
-    }
-    free((void *)sa);
-
-    return remote_ia;
-}
-
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
-{
-    struct sockaddr *sa;
-    socklen_t sa_len;
-    jint remote_port = -1;
-
-    NET_AllocSockaddr(&sa, (int *)&sa_len);
-    if (getpeername(fd, sa, &sa_len) == 0) {
-        if (matchFamily(sa)) {
-            NET_SockaddrToInetAddress(env, sa, (int *)&remote_port);
-        }
-    }
-    free((void *)sa);
-
-    return remote_port;
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_InheritedChannel_soType0(JNIEnv *env, jclass cla, jint fd)
-{
-    int sotype;
-    socklen_t arglen=sizeof(sotype);
-    if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) == 0) {
-        if (sotype == SOCK_STREAM)
-            return sun_nio_ch_InheritedChannel_SOCK_STREAM;
-        if (sotype == SOCK_DGRAM)
-            return sun_nio_ch_InheritedChannel_SOCK_DGRAM;
-    }
-    return sun_nio_ch_InheritedChannel_UNKNOWN;
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_InheritedChannel_dup(JNIEnv *env, jclass cla, jint fd)
-{
-   int newfd = dup(fd);
-   if (newfd < 0) {
-        JNU_ThrowIOExceptionWithLastError(env, "dup failed");
-   }
-   return (jint)newfd;
-}
-
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_InheritedChannel_dup2(JNIEnv *env, jclass cla, jint fd, jint fd2)
-{
-   if (dup2(fd, fd2) < 0) {
-        JNU_ThrowIOExceptionWithLastError(env, "dup2 failed");
-   }
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_InheritedChannel_open0(JNIEnv *env, jclass cla, jstring path, jint oflag)
-{
-    const char* str;
-    int oflag_actual;
-
-    /* convert to OS specific value */
-    switch (oflag) {
-        case sun_nio_ch_InheritedChannel_O_RDWR :
-            oflag_actual = O_RDWR;
-            break;
-        case sun_nio_ch_InheritedChannel_O_RDONLY :
-            oflag_actual = O_RDONLY;
-            break;
-        case sun_nio_ch_InheritedChannel_O_WRONLY :
-            oflag_actual = O_WRONLY;
-            break;
-        default :
-            JNU_ThrowInternalError(env, "Unrecognized file mode");
-            return -1;
-    }
-
-    str = JNU_GetStringPlatformChars(env, path, NULL);
-    if (str == NULL) {
-        return (jint)-1;
-    } else {
-        int fd = open(str, oflag_actual);
-        if (fd < 0) {
-            JNU_ThrowIOExceptionWithLastError(env, str);
-        }
-        JNU_ReleaseStringPlatformChars(env, path, str);
-        return (jint)fd;
-    }
-}
-
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_InheritedChannel_close0(JNIEnv *env, jclass cla, jint fd)
-{
-    if (close(fd) < 0) {
-        JNU_ThrowIOExceptionWithLastError(env, "close failed");
-    }
-}
-
-static JNINativeMethod gMethods[] = {
-  NATIVE_METHOD(InheritedChannel, dup, "(I)I"),
-  NATIVE_METHOD(InheritedChannel, dup2, "(II)V"),
-  NATIVE_METHOD(InheritedChannel, open0, "(Ljava/lang/String;I)I"),
-  NATIVE_METHOD(InheritedChannel, close0, "(I)V"),
-  NATIVE_METHOD(InheritedChannel, soType0, "(I)I"),
-  NATIVE_METHOD(InheritedChannel, peerAddress0, "(I)Ljava/net/InetAddress;"),
-  NATIVE_METHOD(InheritedChannel, peerPort0, "(I)I"),
-
-};
-
-void register_sun_nio_ch_InheritedChannel(JNIEnv* env) {
-  jniRegisterNativeMethods(env, "sun/nio/ch/InheritedChannel", gMethods, NELEM(gMethods));
-}
diff --git a/ojluni/src/main/native/NetworkInterface.c b/ojluni/src/main/native/NetworkInterface.c
index 0daf4db..5879df4 100644
--- a/ojluni/src/main/native/NetworkInterface.c
+++ b/ojluni/src/main/native/NetworkInterface.c
@@ -101,7 +101,6 @@
 static jmethodID ni_ia4ctrID;
 static jmethodID ni_ia6ctrID;
 static jmethodID ni_ibctrID;
-static jfieldID ni_ia6ipaddressID;
 static jfieldID ni_ibaddressID;
 static jfieldID ni_ib4broadcastID;
 static jfieldID ni_ib4maskID;
@@ -147,7 +146,6 @@
     ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
     ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
     ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
-    ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
     ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
     ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
     ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
@@ -281,11 +279,9 @@
 
                 if (family == AF_INET6) {
                     jbyte *bytes = (jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr);
-                    jbyteArray ipaddress = (*env)->GetObjectField(env, iaObj, ni_ia6ipaddressID);
                     jbyte caddr[16];
                     int i;
-
-                    (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
+                    getInet6Address_ipaddress(env, iaObj, (char *)caddr);
                     i = 0;
                     while (i < 16) {
                         if (caddr[i] != bytes[i]) {
@@ -478,21 +474,15 @@
       int scope=0;
       iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
       if (iaObj) {
-        jbyteArray ipaddress = (*env)->NewByteArray(env, 16);
-        if (ipaddress == NULL) {
+        int ret = setInet6Address_ipaddress(env, iaObj, (char *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr));
+        if (ret == JNI_FALSE) {
           return NULL;
         }
-        (*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
-                                   (jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr));
-
         scope = ((struct sockaddr_in6*)addrP->addr)->sin6_scope_id;
-
         if (scope != 0) { /* zero is default value, no need to set */
-          (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
-          (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
-          (*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj);
+          setInet6Address_scopeid(env, iaObj, scope);
+          setInet6Address_scopeifname(env, iaObj, netifObj);
         }
-        (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
       }
       ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
       if (ibObj) {
diff --git a/ojluni/src/main/native/PlainDatagramSocketImpl.c b/ojluni/src/main/native/PlainDatagramSocketImpl.c
index c04acc6..d7edb5f 100644
--- a/ojluni/src/main/native/PlainDatagramSocketImpl.c
+++ b/ojluni/src/main/native/PlainDatagramSocketImpl.c
@@ -1847,8 +1847,8 @@
             caddr[14] = ((address >> 8) & 0xff);
             caddr[15] = (address & 0xff);
         } else {
-            ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID);
-            (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
+            // Android-changed: explicit cast to suppress compiler warning.
+            getInet6Address_ipaddress(env, iaObj, (char*)caddr);
         }
 
         memcpy((void *)&(mname6.ipv6mr_multiaddr), caddr, sizeof(struct in6_addr));
diff --git a/ojluni/src/main/native/Register.cpp b/ojluni/src/main/native/Register.cpp
index a15bb41..6b5d487 100644
--- a/ojluni/src/main/native/Register.cpp
+++ b/ojluni/src/main/native/Register.cpp
@@ -80,7 +80,6 @@
 extern void register_sun_nio_ch_Net(JNIEnv*);
 extern void register_sun_nio_ch_ServerSocketChannelImpl(JNIEnv*);
 extern void register_sun_nio_ch_SocketChannelImpl(JNIEnv* env);
-extern void register_sun_nio_ch_InheritedChannel(JNIEnv* env);
 extern void register_sun_nio_ch_EPollArrayWrapper(JNIEnv* env);
 
 extern jint net_JNI_OnLoad(JavaVM*, void*);
@@ -143,7 +142,6 @@
     register_java_util_prefs_FileSystemPreferences(env);
     register_sun_nio_ch_ServerSocketChannelImpl(env);
     register_sun_nio_ch_SocketChannelImpl(env);
-    register_sun_nio_ch_InheritedChannel(env);
     register_sun_nio_ch_Net(env);
     register_sun_nio_ch_DatagramChannelImpl(env);
     register_sun_nio_ch_DatagramDispatcher(env);
diff --git a/ojluni/src/main/native/net_util.c b/ojluni/src/main/native/net_util.c
index a656ed3..af6a893 100644
--- a/ojluni/src/main/native/net_util.c
+++ b/ojluni/src/main/native/net_util.c
@@ -72,26 +72,116 @@
 extern jfieldID iac_addressID;
 extern jfieldID iac_familyID;
 
+/**
+ * set_ methods return JNI_TRUE on success JNI_FALSE on error
+ * get_ methods that return +ve int return -1 on error
+ * get_ methods that return objects return NULL on error.
+ */
+jobject getInet6Address_scopeifname(JNIEnv *env, jobject iaObj) {
+    jobject holder;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, NULL);
+    return (*env)->GetObjectField(env, holder, ia6_scopeifnameID);
+}
+
+int setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeifname) {
+    jobject holder;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, JNI_FALSE);
+    (*env)->SetObjectField(env, holder, ia6_scopeifnameID, scopeifname);
+    return JNI_TRUE;
+}
+
+int getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) {
+    jobject holder;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, -1);
+    return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID);
+}
+
+int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) {
+    jobject holder;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, -1);
+    return (*env)->GetIntField(env, holder, ia6_scopeidID);
+}
+
+int setInet6Address_scopeid(JNIEnv *env, jobject iaObj, int scopeid) {
+    jobject holder;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, JNI_FALSE);
+    (*env)->SetIntField(env, holder, ia6_scopeidID, scopeid);
+    if (scopeid > 0) {
+            (*env)->SetBooleanField(env, holder, ia6_scopeidsetID, JNI_TRUE);
+    }
+    return JNI_TRUE;
+}
+
+
+int getInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *dest) {
+    jobject holder, addr;
+    jbyteArray barr;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, JNI_FALSE);
+    addr =  (*env)->GetObjectField(env, holder, ia6_ipaddressID);
+    CHECK_NULL_RETURN(addr, JNI_FALSE);
+    (*env)->GetByteArrayRegion(env, addr, 0, 16, (jbyte *)dest);
+    return JNI_TRUE;
+}
+
+int setInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *address) {
+    jobject holder;
+    jbyteArray addr;
+
+    // Android-changed: initInetAddrs(env);
+    holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
+    CHECK_NULL_RETURN(holder, JNI_FALSE);
+    addr =  (jbyteArray)(*env)->GetObjectField(env, holder, ia6_ipaddressID);
+    if (addr == NULL) {
+        addr = (*env)->NewByteArray(env, 16);
+        CHECK_NULL_RETURN(addr, JNI_FALSE);
+        (*env)->SetObjectField(env, holder, ia6_ipaddressID, addr);
+    }
+    (*env)->SetByteArrayRegion(env, addr, 0, 16, (jbyte *)address);
+    return JNI_TRUE;
+}
+
 void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) {
     jobject holder;
+    // Android-changed: initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     (*env)->SetIntField(env, holder, iac_addressID, address);
 }
 
 void setInetAddress_family(JNIEnv *env, jobject iaObj, int family) {
     jobject holder;
+    // Android-changed: initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     (*env)->SetIntField(env, holder, iac_familyID, family);
 }
 
 void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject host) {
     jobject holder;
+    // Android-changed: initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     (*env)->SetObjectField(env, holder, iac_hostNameID, host);
 }
 
 int getInetAddress_addr(JNIEnv *env, jobject iaObj) {
     jobject holder;
+    // Android-changed: initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     return (*env)->GetIntField(env, holder, iac_addressID);
 }
@@ -99,12 +189,14 @@
 int getInetAddress_family(JNIEnv *env, jobject iaObj) {
     jobject holder;
 
+    // Android-changed: initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     return (*env)->GetIntField(env, holder, iac_familyID);
 }
 
 jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) {
     jobject holder;
+    // Android-changed: initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     return (*env)->GetObjectField(env, holder, iac_hostNameID);
 }
@@ -112,6 +204,7 @@
 JNIEXPORT jobject JNICALL
 NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
     jobject iaObj;
+    // Android-changed: initInetAddrs(env);
 #ifdef AF_INET6
     if (him->sa_family == AF_INET6) {
         jbyteArray ipaddress;
@@ -139,6 +232,7 @@
         } else {
             static jclass inet6Cls = 0;
             jint scope;
+            int ret;
             if (inet6Cls == 0) {
                 jclass c = (*env)->FindClass(env, "java/net/Inet6Address");
                 CHECK_NULL_RETURN(c, NULL);
@@ -148,18 +242,13 @@
             }
             iaObj = (*env)->NewObject(env, inet6Cls, ia6_ctrID);
             CHECK_NULL_RETURN(iaObj, NULL);
-            ipaddress = (*env)->NewByteArray(env, 16);
-            CHECK_NULL_RETURN(ipaddress, NULL);
-            (*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
-                                       (jbyte *)&(him6->sin6_addr));
-
-            (*env)->SetObjectField(env, iaObj, ia6_ipaddressID, ipaddress);
-
+            ret = setInet6Address_ipaddress(env, iaObj, (char *)&(him6->sin6_addr));
+            // Android-changed: Appease compiler type checking.
+            // CHECK_NULL_RETURN(ret, NULL);
+            if (ret == JNI_FALSE) return NULL;
             setInetAddress_family(env, iaObj, IPv6);
             scope = getScopeID(him);
-            (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
-            if (scope > 0)
-                (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
+            setInet6Address_scopeid(env, iaObj, scope);
         }
         *port = ntohs(him6->sin6_port);
     } else
@@ -225,9 +314,8 @@
             if (family == AF_INET) {
                 return JNI_FALSE;
             }
-            ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID);
-            scope = (*env)->GetIntField(env, iaObj, ia6_scopeidID);
-            (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddrCur);
+            scope = getInet6Address_scopeid(env, iaObj);
+            getInet6Address_ipaddress(env, iaObj, (char *)caddrCur);
             if (NET_IsEqual(caddrNew, caddrCur) && cmpScopeID(scope, him)) {
                 return JNI_TRUE;
             } else {
diff --git a/ojluni/src/main/native/net_util.h b/ojluni/src/main/native/net_util.h
index 2f5cffd..8888877 100644
--- a/ojluni/src/main/native/net_util.h
+++ b/ojluni/src/main/native/net_util.h
@@ -58,6 +58,19 @@
 extern jfieldID iac_hostNameID;
 extern jfieldID ia_preferIPv6AddressID;
 
+/** (Inet6Address accessors)
+ * set_ methods return JNI_TRUE on success JNI_FALSE on error
+ * get_ methods that return int/boolean, return -1 on error
+ * get_ methods that return objects return NULL on error.
+ */
+extern jobject getInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj);
+extern int setInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj, jobject scopeifname);
+extern int getInet6Address_scopeid_set(JNIEnv *env, jobject ia6Obj);
+extern int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj);
+extern int setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
+extern int getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
+extern int setInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *address);
+
 extern void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address);
 extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family);
 extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h);
@@ -93,11 +106,11 @@
 
 /* Inet6Address fields */
 extern jclass ia6_class;
+extern jfieldID ia6_holder6ID;
 extern jfieldID ia6_ipaddressID;
 extern jfieldID ia6_scopeidID;
 extern jfieldID ia6_scopeidsetID;
 extern jfieldID ia6_scopeifnameID;
-extern jfieldID ia6_scopeifnamesetID;
 extern jmethodID ia6_ctrID;
 
 /************************************************************************
diff --git a/ojluni/src/main/native/net_util_md.c b/ojluni/src/main/native/net_util_md.c
index d45a0e6..f1d60fe 100644
--- a/ojluni/src/main/native/net_util_md.c
+++ b/ojluni/src/main/native/net_util_md.c
@@ -772,8 +772,7 @@
                 caddr[15] = (address & 0xff);
             }
         } else {
-            ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID);
-            (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
+            getInet6Address_ipaddress(env, iaObj, (char *)caddr);
         }
         memset((char *)him6, 0, sizeof(struct sockaddr_in6));
         him6->sin6_port = htons(port);
@@ -791,7 +790,7 @@
         // was constructed with a specific scope_id or NetworkInterface).
         if (family != IPv4) {
             if (ia6_scopeidID) {
-                int scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_scopeidID);
+                int scope_id = getInet6Address_scopeid(env, iaObj);
                 if (scope_id > 0) {
                     him6->sin6_scope_id = scope_id;
                 }
diff --git a/ojluni/src/main/native/openjdksub.mk b/ojluni/src/main/native/openjdksub.mk
index 6767354..222fb99 100644
--- a/ojluni/src/main/native/openjdksub.mk
+++ b/ojluni/src/main/native/openjdksub.mk
@@ -22,7 +22,6 @@
     IOUtil.c \
     EPollArrayWrapper.c \
     PollArrayWrapper.c \
-    InheritedChannel.c \
     SocketChannelImpl.c \
     FileChannelImpl.c \
     FileDispatcherImpl.c \
diff --git a/ojluni/src/main/native/sun_nio_ch_InheritedChannel.h b/ojluni/src/main/native/sun_nio_ch_InheritedChannel.h
deleted file mode 100644
index 902879b..0000000
--- a/ojluni/src/main/native/sun_nio_ch_InheritedChannel.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* This file was generated from sun/nio/ch/InheritedChannel.java and is
- * licensed under the same terms. The copyright and license information for
- * sun/nio/ch/InheritedChannel.java follows.
- *
- * Copyright (c) 2003, 2010, 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.
- */
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class sun_nio_ch_InheritedChannel */
-
-#ifndef _Included_sun_nio_ch_InheritedChannel
-#define _Included_sun_nio_ch_InheritedChannel
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef sun_nio_ch_InheritedChannel_UNKNOWN
-#define sun_nio_ch_InheritedChannel_UNKNOWN -1L
-#undef sun_nio_ch_InheritedChannel_SOCK_STREAM
-#define sun_nio_ch_InheritedChannel_SOCK_STREAM 1L
-#undef sun_nio_ch_InheritedChannel_SOCK_DGRAM
-#define sun_nio_ch_InheritedChannel_SOCK_DGRAM 2L
-#undef sun_nio_ch_InheritedChannel_O_RDONLY
-#define sun_nio_ch_InheritedChannel_O_RDONLY 0L
-#undef sun_nio_ch_InheritedChannel_O_WRONLY
-#define sun_nio_ch_InheritedChannel_O_WRONLY 1L
-#undef sun_nio_ch_InheritedChannel_O_RDWR
-#define sun_nio_ch_InheritedChannel_O_RDWR 2L
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    dup
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_sun_nio_ch_InheritedChannel_dup
-  (JNIEnv *, jclass, jint);
-
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    dup2
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_sun_nio_ch_InheritedChannel_dup2
-  (JNIEnv *, jclass, jint, jint);
-
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    open0
- * Signature: (Ljava/lang/String;I)I
- */
-JNIEXPORT jint JNICALL Java_sun_nio_ch_InheritedChannel_open0
-  (JNIEnv *, jclass, jstring, jint);
-
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    close0
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_sun_nio_ch_InheritedChannel_close0
-  (JNIEnv *, jclass, jint);
-
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    soType0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_sun_nio_ch_InheritedChannel_soType0
-  (JNIEnv *, jclass, jint);
-
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    peerAddress0
- * Signature: (I)Ljava/net/InetAddress;
- */
-JNIEXPORT jobject JNICALL Java_sun_nio_ch_InheritedChannel_peerAddress0
-  (JNIEnv *, jclass, jint);
-
-/*
- * Class:     sun_nio_ch_InheritedChannel
- * Method:    peerPort0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_sun_nio_ch_InheritedChannel_peerPort0
-  (JNIEnv *, jclass, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index 21d01d14..a8a66b2 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -564,6 +564,7 @@
     ojluni/src/main/java/java/security/cert/X509CRL.java \
     ojluni/src/main/java/java/security/cert/X509CRLSelector.java \
     ojluni/src/main/java/java/security/cert/X509Extension.java \
+    ojluni/src/main/java/java/security/cert/package-info.java \
     ojluni/src/main/java/java/security/CodeSigner.java \
     ojluni/src/main/java/java/security/CodeSource.java \
     ojluni/src/main/java/java/security/CryptoPrimitive.java \
@@ -589,6 +590,7 @@
     ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java \
     ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java \
     ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java \
+    ojluni/src/main/java/java/security/interfaces/package-info.java \
     ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java \
     ojluni/src/main/java/java/security/InvalidKeyException.java \
     ojluni/src/main/java/java/security/InvalidParameterException.java \
@@ -1321,7 +1323,6 @@
     ojluni/src/main/java/sun/nio/ch/FileLockImpl.java \
     ojluni/src/main/java/sun/nio/ch/FileLockTable.java \
     ojluni/src/main/java/sun/nio/ch/Groupable.java \
-    ojluni/src/main/java/sun/nio/ch/InheritedChannel.java \
     ojluni/src/main/java/sun/nio/ch/Interruptible.java \
     ojluni/src/main/java/sun/nio/ch/Invoker.java \
     ojluni/src/main/java/sun/nio/ch/IOStatus.java \