Merge "ojluni: delete sun.security.ec package"
diff --git a/luni/src/test/java/com/android/org/bouncycastle/crypto/digests/DigestTest.java b/luni/src/test/java/com/android/org/bouncycastle/crypto/digests/DigestTest.java
index fce8507..ec5ca03 100644
--- a/luni/src/test/java/com/android/org/bouncycastle/crypto/digests/DigestTest.java
+++ b/luni/src/test/java/com/android/org/bouncycastle/crypto/digests/DigestTest.java
@@ -93,9 +93,6 @@
                 + oldTime.toString());
         System.out.println("Time for " + ITERATIONS + " x new hash processing: "
                 + newTime.toString());
-
-        assertTrue("New hash should be faster:\nold=" + oldTime.toString() + "\nnew="
-                + newTime.toString(), newTime.mean() < oldTime.mean());
     }
 
     /**
diff --git a/luni/src/test/java/libcore/java/io/OldBufferedReaderTest.java b/luni/src/test/java/libcore/java/io/OldBufferedReaderTest.java
index 986c672..00c5389 100644
--- a/luni/src/test/java/libcore/java/io/OldBufferedReaderTest.java
+++ b/luni/src/test/java/libcore/java/io/OldBufferedReaderTest.java
@@ -387,11 +387,6 @@
               PrintWriter pw = new PrintWriter(new OutputStreamWriter(pos));
               pw.print("hello, world\r");
               pw.flush();
-              try {
-                  Thread.sleep(2*60*1000);
-              } catch (InterruptedException ex) {
-                  fail();
-              }
             }
         };
         t.start();
diff --git a/luni/src/test/java/libcore/java/net/AbstractCookiesTest.java b/luni/src/test/java/libcore/java/net/AbstractCookiesTest.java
index ab1b822..6e29a62 100644
--- a/luni/src/test/java/libcore/java/net/AbstractCookiesTest.java
+++ b/luni/src/test/java/libcore/java/net/AbstractCookiesTest.java
@@ -69,10 +69,12 @@
     private CookieHandler defaultHandler;
     private CookieManager cookieManager;
     private CookieStore cookieStore;
+    private MockWebServer server;
 
 
     @Override public void setUp() throws Exception {
         super.setUp();
+        server = new MockWebServer();
         defaultHandler = CookieHandler.getDefault();
         cookieManager = new CookieManager(createCookieStore(), null);
         cookieStore = cookieManager.getCookieStore();
@@ -80,6 +82,7 @@
 
     @Override public void tearDown() throws Exception {
         CookieHandler.setDefault(defaultHandler);
+        server.shutdown();
         super.tearDown();
     }
 
@@ -89,7 +92,6 @@
         CookieManager cookieManager = new CookieManager(createCookieStore(),
                 ACCEPT_ORIGINAL_SERVER);
         CookieHandler.setDefault(cookieManager);
-        MockWebServer server = new MockWebServer();
         server.play();
 
         server.enqueue(new MockResponse().addHeader("Set-Cookie: a=android; "
@@ -118,7 +120,6 @@
         CookieManager cookieManager = new CookieManager(createCookieStore(),
                 ACCEPT_ORIGINAL_SERVER);
         CookieHandler.setDefault(cookieManager);
-        MockWebServer server = new MockWebServer();
         server.play();
 
         server.enqueue(new MockResponse().addHeader("Set-Cookie: a=android; "
@@ -149,7 +150,6 @@
         CookieManager cookieManager = new CookieManager(createCookieStore(),
                 ACCEPT_ORIGINAL_SERVER);
         CookieHandler.setDefault(cookieManager);
-        MockWebServer server = new MockWebServer();
         server.play();
 
         server.enqueue(new MockResponse().addHeader("Set-Cookie2: a=android; "
@@ -185,7 +185,6 @@
                 ACCEPT_ORIGINAL_SERVER);
 
         CookieHandler.setDefault(cookieManager);
-        MockWebServer server = new MockWebServer();
         server.play();
 
         server.enqueue(new MockResponse().addHeader("Set-Cookie2: a=\"android\"; "
@@ -337,7 +336,6 @@
     }
 
     public void testSendingCookiesFromStore() throws Exception {
-        MockWebServer server = new MockWebServer();
         server.enqueue(new MockResponse());
         server.play();
 
@@ -389,6 +387,8 @@
                 fail(header);
             }
         }
+        redirectSource.shutdown();
+        redirectTarget.shutdown();
     }
 
     /**
@@ -412,7 +412,6 @@
                 return result;
             }
         });
-        MockWebServer server = new MockWebServer();
         server.enqueue(new MockResponse());
         server.play();
 
@@ -461,7 +460,6 @@
                 return result;
             }
         });
-        MockWebServer server = new MockWebServer();
         server. enqueue(new MockResponse());
         server.play();
 
diff --git a/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java b/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java
index 0e11d50..a55af3f 100644
--- a/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java
+++ b/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java
@@ -30,6 +30,20 @@
 
 public class OldCookieHandlerTest extends TestCase {
 
+    private MockWebServer server;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        server = new MockWebServer();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        server.shutdown();
+        super.tearDown();
+    }
+
     public void test_CookieHandler() {
         assertNull(CookieHandler.getDefault());
     }
@@ -40,7 +54,6 @@
         try {
             CookieHandler.setDefault(mch);
 
-            MockWebServer server = new MockWebServer();
             server.play();
             server.enqueue(new MockResponse().addHeader("Set-Cookie2: a=\"android\"; "
                     + "Comment=\"this cookie is delicious\"; "
diff --git a/luni/src/test/java/libcore/java/net/URITest.java b/luni/src/test/java/libcore/java/net/URITest.java
index 2c4a06a..edc6577 100644
--- a/luni/src/test/java/libcore/java/net/URITest.java
+++ b/luni/src/test/java/libcore/java/net/URITest.java
@@ -729,13 +729,13 @@
         assertEquals("a_b.c.d.net", uri.getHost());
     }
 
-    // RFC1034#section-3.5 doesn't permit empty labels in hostnames, but we
-    // accepted this prior to N and the behavior is used by some apps. We need
-    // to keep the behavior for now for compatibility.
+    // RFC1034#section-3.5 doesn't permit empty labels in hostnames. This was accepted prior to N,
+    // but returns null in later releases.
     // http://b/25991669
+    // http://b/29560247
     public void testHostWithEmptyLabel() throws Exception {
-        assertEquals(".example.com", new URI("http://.example.com/").getHost());
-        assertEquals("example..com", new URI("http://example..com/").getHost());
+        assertNull(new URI("http://.example.com/").getHost());
+        assertNull(new URI("http://example..com/").getHost());
     }
 
     // Adding a new test? Consider adding an equivalent test to URLTest.java
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
index 7c5cc42..bb0152b 100644
--- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
@@ -23,14 +23,14 @@
 import com.google.mockwebserver.SocketPolicy;
 
 import com.android.okhttp.AndroidShimResponseCache;
+import com.android.okhttp.internal.Platform;
+import com.android.okhttp.internal.tls.TrustRootIndex;
 
 import junit.framework.TestCase;
 
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileDescriptor;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -94,10 +94,6 @@
 import static com.google.mockwebserver.SocketPolicy.FAIL_HANDSHAKE;
 import static com.google.mockwebserver.SocketPolicy.SHUTDOWN_INPUT_AT_END;
 import static com.google.mockwebserver.SocketPolicy.SHUTDOWN_OUTPUT_AT_END;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.spy;
 
 public final class URLConnectionTest extends TestCase {
 
@@ -920,11 +916,15 @@
      */
     public void testProxyConnectIncludesProxyHeadersOnly()
             throws IOException, InterruptedException {
+        Authenticator.setDefault(new SimpleAuthenticator());
         RecordingHostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();
         TestSSLContext testSSLContext = createDefaultTestSSLContext();
 
         server.useHttps(testSSLContext.serverContext.getSocketFactory(), true);
         server.enqueue(new MockResponse()
+                .setResponseCode(407)
+                .addHeader("Proxy-Authenticate: Basic realm=\"localhost\""));
+        server.enqueue(new MockResponse()
                 .setSocketPolicy(SocketPolicy.UPGRADE_TO_SSL_AT_END)
                 .clearHeaders());
         server.enqueue(new MockResponse().setBody("encrypted response from the origin server"));
@@ -934,18 +934,33 @@
         HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(
                 server.toProxyAddress());
         connection.addRequestProperty("Private", "Secret");
-        connection.addRequestProperty("Proxy-Authorization", "bar");
         connection.addRequestProperty("User-Agent", "baz");
         connection.setSSLSocketFactory(testSSLContext.clientContext.getSocketFactory());
         connection.setHostnameVerifier(hostnameVerifier);
         assertContent("encrypted response from the origin server", connection);
 
-        RecordedRequest connect = server.takeRequest();
-        assertContainsNoneMatching(connect.getHeaders(), "Private.*");
-        assertContains(connect.getHeaders(), "Proxy-Authorization: bar");
-        assertContains(connect.getHeaders(), "User-Agent: baz");
-        assertContains(connect.getHeaders(), "Host: android.com");
-        assertContains(connect.getHeaders(), "Proxy-Connection: Keep-Alive");
+        // connect1 and connect2 are tunnel requests which potentially tunnel multiple requests;
+        // Thus we can't expect its headers to exactly match those of the wrapped request.
+        // See https://github.com/square/okhttp/commit/457fb428a729c50c562822571ea9b13e689648f3
+        RecordedRequest connect1 = server.takeRequest();
+        {
+            List<String> headers = connect1.getHeaders();
+            assertContainsNoneMatching(headers, "Private.*");
+            assertContainsNoneMatching(headers, "Proxy\\-Authorization.*");
+            assertHeaderPresent(connect1, "User-Agent");
+            assertContains(headers, "Host: android.com");
+            assertContains(headers, "Proxy-Connection: Keep-Alive");
+        }
+
+        RecordedRequest connect2 = server.takeRequest();
+        {
+            List<String> headers = connect2.getHeaders();
+            assertContainsNoneMatching(headers, "Private.*");
+            assertHeaderPresent(connect2, "Proxy-Authorization");
+            assertHeaderPresent(connect1, "User-Agent");
+            assertContains(headers, "Host: android.com");
+            assertContains(headers, "Proxy-Connection: Keep-Alive");
+        }
 
         RecordedRequest get = server.takeRequest();
         assertContains(get.getHeaders(), "Private: Secret");
@@ -1810,8 +1825,10 @@
 
             // The first URI will be the initial request. We want to inspect the redirect.
             URI uri = proxySelectorUris.get(1);
-            // The HttpURLConnectionImpl converts %0 -> %250. i.e. it escapes the %.
-            assertEquals(redirectPath + "?foo=%250&bar=%00", uri.toString());
+            // The proxy is selected by Address alone (not the whole target URI).
+            // In OkHttp, HttpEngine.createAddress() converts to an Address and the
+            // RouteSelector converts back to address.url().
+            assertEquals(server2.getUrl("/").toString(), uri.toString());
         } finally {
             ProxySelector.setDefault(originalSelector);
             server2.shutdown();
@@ -1979,22 +1996,15 @@
                 @Override
                 protected Socket configureSocket(Socket socket) throws IOException {
                     final int attemptNumber = socketCreationCount[0]++;
-                    Answer socketConnectAnswer = new Answer() {
-                        @Override public Object answer(InvocationOnMock invocation)
-                                throws Throwable {
-                            int timeoutArg = (int) invocation.getArguments()[1];
-                            socketConnectTimeouts[attemptNumber] = timeoutArg;
-                            throw new SocketTimeoutException(
-                                "Simulated timeout after " + timeoutArg);
+                    Socket socketWrapper = new DelegatingSocket(socket) {
+                        @Override
+                        public void connect(SocketAddress endpoint, int timeout)
+                                throws IOException {
+                            socketConnectTimeouts[attemptNumber] = timeout;
+                            throw new SocketTimeoutException("Simulated timeout after " + timeout);
                         }
                     };
-
-                    Socket socketSpy = spy(socket);
-                    // Create a partial mock that wraps the actual socket and intercepts the
-                    // connect(SocketAddress, int) method.
-                    doAnswer(socketConnectAnswer)
-                        .when(socketSpy).connect(any(SocketAddress.class), anyInt());
-                    return socketSpy;
+                    return socketWrapper;
                 }
             });
 
@@ -2848,6 +2858,65 @@
     }
 
     /**
+     * Checks that OkHttp's certificate pinning logic is not used for the common case
+     * of HttpsUrlConnections.
+     *
+     * <p>OkHttp 2.7 introduced logic for Certificate Pinning. We deliberately don't
+     * expose any API surface that would interact with OkHttp's implementation because
+     * Android has its own API / implementation for certificate pinning. We can't
+     * easily test that there is *no* code path that would invoke OkHttp's certificate
+     * pinning logic, so this test only covers the *common* code path of a
+     * HttpsURLConnection as a sanity check.
+     *
+     * <p>To check whether OkHttp performs certificate pinning under the hood, this
+     * test disables two {@link Platform} methods. In OkHttp 2.7.5, these two methods
+     * are exclusively used in relation to certificate pinning. Android only provides
+     * the minimal implementation of these methods to get OkHttp's tests to pass, so
+     * they should never be invoked outside of OkHttp's tests.
+     */
+    public void testTrustManagerAndTrustRootIndex_unusedForHttpsConnection() throws Exception {
+        Platform platform = Platform.getAndSetForTest(new PlatformWithoutTrustManager());
+        try {
+            testConnectViaHttps();
+        } finally {
+            Platform.getAndSetForTest(platform);
+        }
+    }
+
+    /**
+     * Similar to {@link #testTrustManagerAndTrustRootIndex_unusedForHttpsConnection()},
+     * but for the HTTP case. In the HTTP case, no certificate or trust management
+     * related logic should ever be involved at all, so some pretty basic things must
+     * be going wrong in order for this test to (unexpectedly) invoke the corresponding
+     * Platform methods.
+     */
+    public void testTrustManagerAndTrustRootIndex_unusedForHttpConnection() throws Exception {
+        Platform platform = Platform.getAndSetForTest(new PlatformWithoutTrustManager());
+        try {
+            server.enqueue(new MockResponse().setBody("response").setResponseCode(200));
+            server.play();
+            HttpURLConnection urlConnection =
+                    (HttpURLConnection) server.getUrl("/").openConnection();
+            assertEquals(200, urlConnection.getResponseCode());
+        } finally {
+            Platform.getAndSetForTest(platform);
+        }
+    }
+
+    /**
+     * A {@link Platform} that doesn't support two methods that, in OkHttp 2.7.5,
+     * are exclusively used to provide custom CertificatePinning.
+     */
+    static class PlatformWithoutTrustManager extends Platform {
+        @Override public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
+            throw new AssertionError("Unexpected call");
+        }
+        @Override public TrustRootIndex trustRootIndex(X509TrustManager trustManager) {
+            throw new AssertionError("Unexpected call");
+        }
+    }
+
+    /**
      * Returns a gzipped copy of {@code bytes}.
      */
     public byte[] gzip(byte[] bytes) throws IOException {
@@ -2873,6 +2942,11 @@
         assertContent(expected, connection, Integer.MAX_VALUE);
     }
 
+    private static void assertHeaderPresent(RecordedRequest request, String headerName) {
+        assertNotNull(headerName + " missing: " + request.getHeaders(),
+                request.getHeader(headerName));
+    }
+
     private void assertContains(List<String> list, String value) {
         assertTrue(list.toString(), list.contains(value));
     }
@@ -3153,6 +3227,64 @@
     }
 
     /**
+     * A Socket that forwards all calls to public or protected methods, except for those
+     * that Socket inherits from Object, to a delegate.
+     */
+    private static abstract class DelegatingSocket extends Socket {
+        private final Socket delegate;
+
+        public DelegatingSocket(Socket delegate) {
+            if (delegate == null) {
+                throw new NullPointerException();
+            }
+            this.delegate = delegate;
+        }
+
+        @Override public void bind(SocketAddress bindpoint) throws IOException { delegate.bind(bindpoint); }
+        @Override public void close() throws IOException { delegate.close(); }
+        @Override public void connect(SocketAddress endpoint) throws IOException { delegate.connect(endpoint); }
+        @Override public void connect(SocketAddress endpoint, int timeout) throws IOException { delegate.connect(endpoint, timeout); }
+        @Override public SocketChannel getChannel() { return delegate.getChannel(); }
+        @Override public FileDescriptor getFileDescriptor$() { return delegate.getFileDescriptor$(); }
+        @Override public InetAddress getInetAddress() { return delegate.getInetAddress(); }
+        @Override public InputStream getInputStream() throws IOException { return delegate.getInputStream(); }
+        @Override public boolean getKeepAlive() throws SocketException { return delegate.getKeepAlive(); }
+        @Override public InetAddress getLocalAddress() { return delegate.getLocalAddress(); }
+        @Override public int getLocalPort() { return delegate.getLocalPort(); }
+        @Override public SocketAddress getLocalSocketAddress() { return delegate.getLocalSocketAddress(); }
+        @Override public boolean getOOBInline() throws SocketException { return delegate.getOOBInline(); }
+        @Override public OutputStream getOutputStream() throws IOException { return delegate.getOutputStream(); }
+        @Override public int getPort() { return delegate.getPort(); }
+        @Override public int getReceiveBufferSize() throws SocketException { return delegate.getReceiveBufferSize(); }
+        @Override public SocketAddress getRemoteSocketAddress() { return delegate.getRemoteSocketAddress(); }
+        @Override public boolean getReuseAddress() throws SocketException { return delegate.getReuseAddress(); }
+        @Override public int getSendBufferSize() throws SocketException { return delegate.getSendBufferSize(); }
+        @Override public int getSoLinger() throws SocketException { return delegate.getSoLinger(); }
+        @Override public int getSoTimeout() throws SocketException { return delegate.getSoTimeout(); }
+        @Override public boolean getTcpNoDelay() throws SocketException { return delegate.getTcpNoDelay(); }
+        @Override public int getTrafficClass() throws SocketException { return delegate.getTrafficClass(); }
+        @Override public boolean isBound() { return delegate.isBound(); }
+        @Override public boolean isClosed() { return delegate.isClosed(); }
+        @Override public boolean isConnected() { return delegate.isConnected(); }
+        @Override public boolean isInputShutdown() { return delegate.isInputShutdown(); }
+        @Override public boolean isOutputShutdown() { return delegate.isOutputShutdown(); }
+        @Override public void sendUrgentData(int data) throws IOException { delegate.sendUrgentData(data); }
+        @Override public void setKeepAlive(boolean on) throws SocketException { delegate.setKeepAlive(on); }
+        @Override public void setOOBInline(boolean on) throws SocketException { delegate.setOOBInline(on); }
+        @Override public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) { delegate.setPerformancePreferences(connectionTime, latency, bandwidth); }
+        @Override public void setReceiveBufferSize(int size) throws SocketException { delegate.setReceiveBufferSize(size); }
+        @Override public void setReuseAddress(boolean on) throws SocketException { delegate.setReuseAddress(on); }
+        @Override public void setSendBufferSize(int size) throws SocketException { delegate.setSendBufferSize(size); }
+        @Override public void setSoLinger(boolean on, int linger) throws SocketException { delegate.setSoLinger(on, linger); }
+        @Override public void setSoTimeout(int timeout) throws SocketException { delegate.setSoTimeout(timeout); }
+        @Override public void setTcpNoDelay(boolean on) throws SocketException { delegate.setTcpNoDelay(on); }
+        @Override public void setTrafficClass(int tc) throws SocketException { delegate.setTrafficClass(tc); }
+        @Override public void shutdownInput() throws IOException { delegate.shutdownInput(); }
+        @Override public void shutdownOutput() throws IOException { delegate.shutdownOutput(); }
+        @Override public String toString() { return delegate.toString(); }
+    }
+
+    /**
      * An {@link javax.net.ssl.SSLSocket} that delegates all calls.
      */
     private static abstract class DelegatingSSLSocket extends SSLSocket {
diff --git a/luni/src/test/java/libcore/xml/ExpatSaxParserTest.java b/luni/src/test/java/libcore/xml/ExpatSaxParserTest.java
index 51ca5bf..01c5b98 100644
--- a/luni/src/test/java/libcore/xml/ExpatSaxParserTest.java
+++ b/luni/src/test/java/libcore/xml/ExpatSaxParserTest.java
@@ -622,6 +622,7 @@
         source.setSystemId(server.getUrl("/systemFoo").toString());
         reader.parse(source);
         assertEquals(Arrays.asList("foo", "bar", "/bar", "/foo"), handler.elementNames);
+        server.shutdown();
     }
 
     /**
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
index abf06e0..b568eeb 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
@@ -610,6 +610,7 @@
                 System.out.println("Got expected IOException: " + e.getMessage());
             }
         }
+        proxyAndWebServer.shutdown();
     }
 
     /**
@@ -650,6 +651,7 @@
                 System.out.println("Expected exception was thrown: " + e.getMessage());
             }
         }
+        proxyAndWebServer.shutdown();
     }
 
     public void setUp() throws Exception {
diff --git a/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java b/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
index 77bf62f..d0e2995 100644
--- a/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
+++ b/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
@@ -48,32 +48,6 @@
 
     private Certificate certificate;
 
-    public KeyStore3Test() throws Exception {
-        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
-        keyPair = keyPairGenerator.generateKeyPair();
-
-        String certificateData = "-----BEGIN CERTIFICATE-----\n"
-                + "MIICZTCCAdICBQL3AAC2MA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw\n"
-                + "HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl\n"
-                + "IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NzAyMjAwMDAwMDBa\n"
-                + "Fw05ODAyMjAyMzU5NTlaMIGWMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv\n"
-                + "cm5pYTESMBAGA1UEBxMJUGFsbyBBbHRvMR8wHQYDVQQKExZTdW4gTWljcm9zeXN0\n"
-                + "ZW1zLCBJbmMuMSEwHwYDVQQLExhUZXN0IGFuZCBFdmFsdWF0aW9uIE9ubHkxGjAY\n"
-                + "BgNVBAMTEWFyZ29uLmVuZy5zdW4uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB\n"
-                + "iQKBgQCofmdY+PiUWN01FOzEewf+GaG+lFf132UpzATmYJkA4AEA/juW7jSi+LJk\n"
-                + "wJKi5GO4RyZoyimAL/5yIWDV6l1KlvxyKslr0REhMBaD/3Z3EsLTTEf5gVrQS6sT\n"
-                + "WMoSZAyzB39kFfsB6oUXNtV8+UKKxSxKbxvhQn267PeCz5VX2QIDAQABMA0GCSqG\n"
-                + "SIb3DQEBAgUAA34AXl3at6luiV/7I9MN5CXYoPJYI8Bcdc1hBagJvTMcmlqL2uOZ\n"
-                + "H9T5hNMEL9Tk6aI7yZPXcw/xI2K6pOR/FrMp0UwJmdxX7ljV6ZtUZf7pY492UqwC\n"
-                + "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
-                + "-----END CERTIFICATE-----\n";
-
-        ByteArrayInputStream certArray = new ByteArrayInputStream(
-                certificateData.getBytes());
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
-        certificate = cf.generateCertificate(certArray);
-    }
-
     public void test_load() throws Exception {
         // No exception should be thrown out.
         mockKeyStore.load(null);
@@ -168,6 +142,29 @@
 
     protected void setUp() throws Exception {
         super.setUp();
+
+        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
+        keyPair = keyPairGenerator.generateKeyPair();
+
+        String certificateData = "-----BEGIN CERTIFICATE-----\n"
+                + "MIICZTCCAdICBQL3AAC2MA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw\n"
+                + "HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl\n"
+                + "IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NzAyMjAwMDAwMDBa\n"
+                + "Fw05ODAyMjAyMzU5NTlaMIGWMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv\n"
+                + "cm5pYTESMBAGA1UEBxMJUGFsbyBBbHRvMR8wHQYDVQQKExZTdW4gTWljcm9zeXN0\n"
+                + "ZW1zLCBJbmMuMSEwHwYDVQQLExhUZXN0IGFuZCBFdmFsdWF0aW9uIE9ubHkxGjAY\n"
+                + "BgNVBAMTEWFyZ29uLmVuZy5zdW4uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB\n"
+                + "iQKBgQCofmdY+PiUWN01FOzEewf+GaG+lFf132UpzATmYJkA4AEA/juW7jSi+LJk\n"
+                + "wJKi5GO4RyZoyimAL/5yIWDV6l1KlvxyKslr0REhMBaD/3Z3EsLTTEf5gVrQS6sT\n"
+                + "WMoSZAyzB39kFfsB6oUXNtV8+UKKxSxKbxvhQn267PeCz5VX2QIDAQABMA0GCSqG\n"
+                + "SIb3DQEBAgUAA34AXl3at6luiV/7I9MN5CXYoPJYI8Bcdc1hBagJvTMcmlqL2uOZ\n"
+                + "H9T5hNMEL9Tk6aI7yZPXcw/xI2K6pOR/FrMp0UwJmdxX7ljV6ZtUZf7pY492UqwC\n"
+                + "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
+                + "-----END CERTIFICATE-----\n";
+        ByteArrayInputStream certArray = new ByteArrayInputStream(
+                certificateData.getBytes());
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        certificate = cf.generateCertificate(certArray);
         mockKeyStore = new MyKeyStore(new MyKeyStoreSpi(), null, "MyKeyStore");
     }
 
diff --git a/ojluni/src/main/java/java/io/DeleteOnExitHook.java b/ojluni/src/main/java/java/io/DeleteOnExitHook.java
index 0376456..447f038 100755
--- a/ojluni/src/main/java/java/io/DeleteOnExitHook.java
+++ b/ojluni/src/main/java/java/io/DeleteOnExitHook.java
@@ -36,14 +36,11 @@
 class DeleteOnExitHook {
     private static LinkedHashSet<String> files = new LinkedHashSet<>();
     static {
-        // Android-changed: Access java.lang.Shutdown directly.
-        java.lang.Shutdown.add(2, true,
-                new Runnable() {
-                    public void run() {
-                       runHooks();
-                    }
-                }
-        );
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            public void run() {
+                runHooks();
+            }
+        });
     }
 
     private DeleteOnExitHook() {}
diff --git a/ojluni/src/main/java/java/lang/ApplicationShutdownHooks.java b/ojluni/src/main/java/java/lang/ApplicationShutdownHooks.java
deleted file mode 100755
index 512cfc1..0000000
--- a/ojluni/src/main/java/java/lang/ApplicationShutdownHooks.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2005, 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.
- */
-package java.lang;
-
-import java.util.*;
-
-/*
- * Class to track and run user level shutdown hooks registered through
- * <tt>{@link Runtime#addShutdownHook Runtime.addShutdownHook}</tt>.
- *
- * @see java.lang.Runtime#addShutdownHook
- * @see java.lang.Runtime#removeShutdownHook
- */
-
-class ApplicationShutdownHooks {
-    /* The set of registered hooks */
-    private static IdentityHashMap<Thread, Thread> hooks;
-    static {
-        try {
-            Shutdown.add(1 /* shutdown hook invocation order */,
-                false /* not registered if shutdown in progress */,
-                new Runnable() {
-                    public void run() {
-                        runHooks();
-                    }
-                }
-            );
-            hooks = new IdentityHashMap<>();
-        } catch (IllegalStateException e) {
-            // application shutdown hooks cannot be added if
-            // shutdown is in progress.
-            hooks = null;
-        }
-    }
-
-
-    private ApplicationShutdownHooks() {}
-
-    /* Add a new shutdown hook.  Checks the shutdown state and the hook itself,
-     * but does not do any security checks.
-     */
-    static synchronized void add(Thread hook) {
-        if(hooks == null)
-            throw new IllegalStateException("Shutdown in progress");
-
-        if (hook.isAlive())
-            throw new IllegalArgumentException("Hook already running");
-
-        if (hooks.containsKey(hook))
-            throw new IllegalArgumentException("Hook previously registered");
-
-        hooks.put(hook, hook);
-    }
-
-    /* Remove a previously-registered hook.  Like the add method, this method
-     * does not do any security checks.
-     */
-    static synchronized boolean remove(Thread hook) {
-        if(hooks == null)
-            throw new IllegalStateException("Shutdown in progress");
-
-        if (hook == null)
-            throw new NullPointerException();
-
-        return hooks.remove(hook) != null;
-    }
-
-    /* Iterates over all application hooks creating a new thread for each
-     * to run in. Hooks are run concurrently and this method waits for
-     * them to finish.
-     */
-    static void runHooks() {
-        Collection<Thread> threads;
-        synchronized(ApplicationShutdownHooks.class) {
-            threads = hooks.keySet();
-            hooks = null;
-        }
-
-        for (Thread hook : threads) {
-            hook.start();
-        }
-        for (Thread hook : threads) {
-            try {
-                hook.join();
-            } catch (InterruptedException x) { }
-        }
-    }
-}
diff --git a/ojluni/src/main/java/java/lang/Shutdown.java b/ojluni/src/main/java/java/lang/Shutdown.java
deleted file mode 100755
index afda074..0000000
--- a/ojluni/src/main/java/java/lang/Shutdown.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1999, 2005, 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 java.lang;
-
-
-/**
- * Package-private utility class containing data structures and logic
- * governing the virtual-machine shutdown sequence.
- *
- * @author   Mark Reinhold
- * @since    1.3
- * @hide
- */
-// Android-changed: Make class public.
-public class Shutdown {
-
-    /* Shutdown state */
-    private static final int RUNNING = 0;
-    private static final int HOOKS = 1;
-    private static final int FINALIZERS = 2;
-    private static int state = RUNNING;
-
-    /* Should we run all finalizers upon exit? */
-    private static boolean runFinalizersOnExit = false;
-
-    // The system shutdown hooks are registered with a predefined slot.
-    // The list of shutdown hooks is as follows:
-    // (0) Console restore hook
-    // (1) Application hooks
-    // (2) DeleteOnExit hook
-    private static final int MAX_SYSTEM_HOOKS = 10;
-    private static final Runnable[] hooks = new Runnable[MAX_SYSTEM_HOOKS];
-
-    // the index of the currently running shutdown hook to the hooks array
-    private static int currentRunningHook = 0;
-
-    /* The preceding static fields are protected by this lock */
-    private static class Lock { };
-    private static Object lock = new Lock();
-
-    /* Lock object for the native halt method */
-    private static Object haltLock = new Lock();
-
-    /* Invoked by Runtime.runFinalizersOnExit */
-    static void setRunFinalizersOnExit(boolean run) {
-        synchronized (lock) {
-            runFinalizersOnExit = run;
-        }
-    }
-
-
-    /**
-     * Add a new shutdown hook.  Checks the shutdown state and the hook itself,
-     * but does not do any security checks.
-     *
-     * The registerShutdownInProgress parameter should be false except
-     * registering the DeleteOnExitHook since the first file may
-     * be added to the delete on exit list by the application shutdown
-     * hooks.
-     *
-     * @param slot  the slot in the shutdown hook array, whose element
-     *               will be invoked in order during shutdown
-     * @param registerShutdownInProgress true to allow the hook
-     *               to be registered even if the shutdown is in progress.
-     * @param hook  the hook to be registered
-     *
-     * @throws IllegalStateException
-     *        if registerShutdownInProgress is false and shutdown is in progress; or
-     *        if registerShutdownInProgress is true and the shutdown process
-     *           already passes the given slot
-     */
-    // Android changed s/@params/@param
-    public static void add(int slot, boolean registerShutdownInProgress, Runnable hook) {
-        synchronized (lock) {
-            if (hooks[slot] != null)
-                throw new InternalError("Shutdown hook at slot " + slot + " already registered");
-
-            if (!registerShutdownInProgress) {
-                if (state > RUNNING)
-                    throw new IllegalStateException("Shutdown in progress");
-            } else {
-                if (state > HOOKS || (state == HOOKS && slot <= currentRunningHook))
-                    throw new IllegalStateException("Shutdown in progress");
-            }
-
-            hooks[slot] = hook;
-        }
-    }
-
-    /* Run all registered shutdown hooks
-     */
-    private static void runHooks() {
-        for (int i=0; i < MAX_SYSTEM_HOOKS; i++) {
-            try {
-                Runnable hook;
-                synchronized (lock) {
-                    // acquire the lock to make sure the hook registered during
-                    // shutdown is visible here.
-                    currentRunningHook = i;
-                    hook = hooks[i];
-                }
-                if (hook != null) hook.run();
-            } catch(Throwable t) {
-                if (t instanceof ThreadDeath) {
-                    ThreadDeath td = (ThreadDeath)t;
-                    throw td;
-                }
-            }
-        }
-    }
-
-    /* The halt method is synchronized on the halt lock
-     * to avoid corruption of the delete-on-shutdown file list.
-     * It invokes the true native halt method.
-     */
-    static void halt(int status) {
-        synchronized (haltLock) {
-            halt0(status);
-        }
-    }
-
-    static native void halt0(int status);
-
-    /* Wormhole for invoking java.lang.ref.Finalizer.runAllFinalizers */
-    private static native void runAllFinalizers();
-
-
-    /* The actual shutdown sequence is defined here.
-     *
-     * If it weren't for runFinalizersOnExit, this would be simple -- we'd just
-     * run the hooks and then halt.  Instead we need to keep track of whether
-     * we're running hooks or finalizers.  In the latter case a finalizer could
-     * invoke exit(1) to cause immediate termination, while in the former case
-     * any further invocations of exit(n), for any n, simply stall.  Note that
-     * if on-exit finalizers are enabled they're run iff the shutdown is
-     * initiated by an exit(0); they're never run on exit(n) for n != 0 or in
-     * response to SIGINT, SIGTERM, etc.
-     */
-    private static void sequence() {
-        synchronized (lock) {
-            /* Guard against the possibility of a daemon thread invoking exit
-             * after DestroyJavaVM initiates the shutdown sequence
-             */
-            if (state != HOOKS) return;
-        }
-        runHooks();
-        boolean rfoe;
-        synchronized (lock) {
-            state = FINALIZERS;
-            rfoe = runFinalizersOnExit;
-        }
-        if (rfoe) runAllFinalizers();
-    }
-
-
-    /* Invoked by Runtime.exit, which does all the security checks.
-     * Also invoked by handlers for system-provided termination events,
-     * which should pass a nonzero status code.
-     */
-    static void exit(int status) {
-        boolean runMoreFinalizers = false;
-        synchronized (lock) {
-            if (status != 0) runFinalizersOnExit = false;
-            switch (state) {
-            case RUNNING:       /* Initiate shutdown */
-                state = HOOKS;
-                break;
-            case HOOKS:         /* Stall and halt */
-                break;
-            case FINALIZERS:
-                if (status != 0) {
-                    /* Halt immediately on nonzero status */
-                    halt(status);
-                } else {
-                    /* Compatibility with old behavior:
-                     * Run more finalizers and then halt
-                     */
-                    runMoreFinalizers = runFinalizersOnExit;
-                }
-                break;
-            }
-        }
-        if (runMoreFinalizers) {
-            runAllFinalizers();
-            halt(status);
-        }
-        synchronized (Shutdown.class) {
-            /* Synchronize on the class object, causing any other thread
-             * that attempts to initiate shutdown to stall indefinitely
-             */
-            sequence();
-            halt(status);
-        }
-    }
-
-
-    /* Invoked by the JNI DestroyJavaVM procedure when the last non-daemon
-     * thread has finished.  Unlike the exit method, this method does not
-     * actually halt the VM.
-     */
-    static void shutdown() {
-        synchronized (lock) {
-            switch (state) {
-            case RUNNING:       /* Initiate shutdown */
-                state = HOOKS;
-                break;
-            case HOOKS:         /* Stall and then return */
-            case FINALIZERS:
-                break;
-            }
-        }
-        synchronized (Shutdown.class) {
-            sequence();
-        }
-    }
-
-}
diff --git a/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java b/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java
index 330e014..1cb26d6 100755
--- a/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java
+++ b/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java
@@ -55,6 +55,7 @@
     private boolean shut_wr = false;
 
     private SocketInputStream socketInputStream = null;
+    private SocketOutputStream socketOutputStream = null;
 
     /* lock when accessing fd */
     protected final Object fdLock = new Object();
@@ -393,14 +394,13 @@
      * Gets an InputStream for this socket.
      */
     protected synchronized InputStream getInputStream() throws IOException {
-        if (isClosedOrPending()) {
-            throw new IOException("Socket Closed");
-        }
-        if (shut_rd) {
-            throw new IOException("Socket input is shutdown");
-        }
-        if (socketInputStream == null) {
-            socketInputStream = new SocketInputStream(this);
+        synchronized (fdLock) {
+            if (isClosedOrPending())
+                throw new IOException("Socket Closed");
+            if (shut_rd)
+                throw new IOException("Socket input is shutdown");
+            if (socketInputStream == null)
+                socketInputStream = new SocketInputStream(this);
         }
         return socketInputStream;
     }
@@ -413,13 +413,15 @@
      * Gets an OutputStream for this socket.
      */
     protected synchronized OutputStream getOutputStream() throws IOException {
-        if (isClosedOrPending()) {
-            throw new IOException("Socket Closed");
+        synchronized (fdLock) {
+            if (isClosedOrPending())
+                throw new IOException("Socket Closed");
+            if (shut_wr)
+                throw new IOException("Socket output is shutdown");
+            if (socketOutputStream == null)
+                socketOutputStream = new SocketOutputStream(this);
         }
-        if (shut_wr) {
-            throw new IOException("Socket output is shutdown");
-        }
-        return new SocketOutputStream(this);
+        return socketOutputStream;
     }
 
     void setFileDescriptor(FileDescriptor fd) {
diff --git a/ojluni/src/main/java/java/net/DatagramSocket.java b/ojluni/src/main/java/java/net/DatagramSocket.java
index 6d43ad0..6925816 100755
--- a/ojluni/src/main/java/java/net/DatagramSocket.java
+++ b/ojluni/src/main/java/java/net/DatagramSocket.java
@@ -215,9 +215,7 @@
      * @see SecurityManager#checkListen
      */
     public DatagramSocket() throws SocketException {
-        // create a datagram socket.
-        createImpl();
-        bind(new InetSocketAddress(0));
+        this(new InetSocketAddress(0));
     }
 
     /**
@@ -262,7 +260,12 @@
         // create a datagram socket.
         createImpl();
         if (bindaddr != null) {
-            bind(bindaddr);
+            try {
+                bind(bindaddr);
+            } finally {
+                if (!isBound())
+                    close();
+            }
         }
     }
 
@@ -354,6 +357,7 @@
         }
         // creates a udp socket
         impl.create();
+        impl.setDatagramSocket(this);
         created = true;
     }
 
diff --git a/ojluni/src/main/java/java/net/DatagramSocketImpl.java b/ojluni/src/main/java/java/net/DatagramSocketImpl.java
index bbabc03..bdee48c 100755
--- a/ojluni/src/main/java/java/net/DatagramSocketImpl.java
+++ b/ojluni/src/main/java/java/net/DatagramSocketImpl.java
@@ -54,6 +54,20 @@
     }
 
     /**
+     * The DatagramSocket or MulticastSocket
+     * that owns this impl
+     */
+    DatagramSocket socket;
+
+    void setDatagramSocket(DatagramSocket socket) {
+        this.socket = socket;
+    }
+
+    DatagramSocket getDatagramSocket() {
+        return socket;
+    }
+
+    /**
      * Creates a datagram socket.
      * @exception SocketException if there is an error in the
      * underlying protocol, such as a TCP error.
@@ -239,6 +253,56 @@
         return localPort;
     }
 
+    <T> void setOption(SocketOption<T> name, T value) throws IOException {
+        if (name == StandardSocketOptions.SO_SNDBUF) {
+            setOption(SocketOptions.SO_SNDBUF, value);
+        } else if (name == StandardSocketOptions.SO_RCVBUF) {
+            setOption(SocketOptions.SO_RCVBUF, value);
+        } else if (name == StandardSocketOptions.SO_REUSEADDR) {
+            setOption(SocketOptions.SO_REUSEADDR, value);
+        } else if (name == StandardSocketOptions.IP_TOS) {
+            setOption(SocketOptions.IP_TOS, value);
+        } else if (name == StandardSocketOptions.IP_MULTICAST_IF &&
+            (getDatagramSocket() instanceof MulticastSocket)) {
+            setOption(SocketOptions.IP_MULTICAST_IF2, value);
+        } else if (name == StandardSocketOptions.IP_MULTICAST_TTL &&
+            (getDatagramSocket() instanceof MulticastSocket)) {
+            if (! (value instanceof Integer)) {
+                throw new IllegalArgumentException("not an integer");
+            }
+            setTimeToLive((Integer)value);
+        } else if (name == StandardSocketOptions.IP_MULTICAST_LOOP &&
+            (getDatagramSocket() instanceof MulticastSocket)) {
+            setOption(SocketOptions.IP_MULTICAST_LOOP, value);
+        } else {
+            throw new UnsupportedOperationException("unsupported option");
+        }
+    }
+
+    <T> T getOption(SocketOption<T> name) throws IOException {
+        if (name == StandardSocketOptions.SO_SNDBUF) {
+            return (T) getOption(SocketOptions.SO_SNDBUF);
+        } else if (name == StandardSocketOptions.SO_RCVBUF) {
+            return (T) getOption(SocketOptions.SO_RCVBUF);
+        } else if (name == StandardSocketOptions.SO_REUSEADDR) {
+            return (T) getOption(SocketOptions.SO_REUSEADDR);
+        } else if (name == StandardSocketOptions.IP_TOS) {
+            return (T) getOption(SocketOptions.IP_TOS);
+        } else if (name == StandardSocketOptions.IP_MULTICAST_IF &&
+            (getDatagramSocket() instanceof MulticastSocket)) {
+            return (T) getOption(SocketOptions.IP_MULTICAST_IF2);
+        } else if (name == StandardSocketOptions.IP_MULTICAST_TTL &&
+            (getDatagramSocket() instanceof MulticastSocket)) {
+            Integer ttl = getTimeToLive();
+            return (T)ttl;
+        } else if (name == StandardSocketOptions.IP_MULTICAST_LOOP &&
+            (getDatagramSocket() instanceof MulticastSocket)) {
+            return (T) getOption(SocketOptions.IP_MULTICAST_LOOP);
+        } else {
+            throw new UnsupportedOperationException("unsupported option");
+        }
+    }
+
     /**
      * Gets the datagram socket file descriptor.
      * @return a {@code FileDescriptor} object representing the datagram socket
diff --git a/ojluni/src/main/java/java/net/MulticastSocket.java b/ojluni/src/main/java/java/net/MulticastSocket.java
index c3389e1..9de987c 100755
--- a/ojluni/src/main/java/java/net/MulticastSocket.java
+++ b/ojluni/src/main/java/java/net/MulticastSocket.java
@@ -169,7 +169,12 @@
         setReuseAddress(true);
 
         if (bindaddr != null) {
-            bind(bindaddr);
+            try {
+                bind(bindaddr);
+            } finally {
+                if (!isBound())
+                    close();
+            }
         }
     }
 
diff --git a/ojluni/src/main/java/java/net/Socket.java b/ojluni/src/main/java/java/net/Socket.java
index c8bfe95..c3178ff 100755
--- a/ojluni/src/main/java/java/net/Socket.java
+++ b/ojluni/src/main/java/java/net/Socket.java
@@ -431,15 +431,19 @@
             createImpl(stream);
             if (localAddr != null)
                 bind(localAddr);
-            if (address != null)
-                connect(address);
-        } catch (IOException e) {
-            // Do not call #close, classes that extend this class may do not expect a call
-            // to #close coming from the superclass constructor.
-            if (impl != null) {
-                impl.close();
+            connect(address);
+        } catch (IOException | IllegalArgumentException | SecurityException e) {
+            try {
+                // Android-changed:
+                // Do not call #close, classes that extend this class may do not expect a call
+                // to #close coming from the superclass constructor.
+                if (impl != null) {
+                    impl.close();
+                }
+                closed = true;
+            } catch (IOException ce) {
+                e.addSuppressed(ce);
             }
-            closed = true;
             throw e;
         }
     }
diff --git a/ojluni/src/main/java/java/net/SocketImpl.java b/ojluni/src/main/java/java/net/SocketImpl.java
index eeacd64..688ba60 100755
--- a/ojluni/src/main/java/java/net/SocketImpl.java
+++ b/ojluni/src/main/java/java/net/SocketImpl.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -362,4 +362,44 @@
     {
         /* Not implemented yet */
     }
+
+    <T> void setOption(SocketOption<T> name, T value) throws IOException {
+        if (name == StandardSocketOptions.SO_KEEPALIVE) {
+            setOption(SocketOptions.SO_KEEPALIVE, value);
+        } else if (name == StandardSocketOptions.SO_SNDBUF) {
+            setOption(SocketOptions.SO_SNDBUF, value);
+        } else if (name == StandardSocketOptions.SO_RCVBUF) {
+            setOption(SocketOptions.SO_RCVBUF, value);
+        } else if (name == StandardSocketOptions.SO_REUSEADDR) {
+            setOption(SocketOptions.SO_REUSEADDR, value);
+        } else if (name == StandardSocketOptions.SO_LINGER) {
+            setOption(SocketOptions.SO_LINGER, value);
+        } else if (name == StandardSocketOptions.IP_TOS) {
+            setOption(SocketOptions.IP_TOS, value);
+        } else if (name == StandardSocketOptions.TCP_NODELAY) {
+            setOption(SocketOptions.TCP_NODELAY, value);
+        } else {
+            throw new UnsupportedOperationException("unsupported option");
+        }
+    }
+
+    <T> T getOption(SocketOption<T> name) throws IOException {
+        if (name == StandardSocketOptions.SO_KEEPALIVE) {
+            return (T)getOption(SocketOptions.SO_KEEPALIVE);
+        } else if (name == StandardSocketOptions.SO_SNDBUF) {
+            return (T)getOption(SocketOptions.SO_SNDBUF);
+        } else if (name == StandardSocketOptions.SO_RCVBUF) {
+            return (T)getOption(SocketOptions.SO_RCVBUF);
+        } else if (name == StandardSocketOptions.SO_REUSEADDR) {
+            return (T)getOption(SocketOptions.SO_REUSEADDR);
+        } else if (name == StandardSocketOptions.SO_LINGER) {
+            return (T)getOption(SocketOptions.SO_LINGER);
+        } else if (name == StandardSocketOptions.IP_TOS) {
+            return (T)getOption(SocketOptions.IP_TOS);
+        } else if (name == StandardSocketOptions.TCP_NODELAY) {
+            return (T)getOption(SocketOptions.TCP_NODELAY);
+        } else {
+            throw new UnsupportedOperationException("unsupported option");
+        }
+    }
 }
diff --git a/ojluni/src/main/java/java/net/SocketSecrets.java b/ojluni/src/main/java/java/net/SocketSecrets.java
new file mode 100644
index 0000000..9772906
--- /dev/null
+++ b/ojluni/src/main/java/java/net/SocketSecrets.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 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
+ * 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 java.net;
+
+import java.io.IOException;
+
+class SocketSecrets {
+
+    /* accessed by reflection from jdk.net.Sockets */
+
+    /* obj must be a Socket or ServerSocket */
+
+    private static <T> void setOption(Object obj, SocketOption<T> name, T value) throws IOException {
+        SocketImpl impl;
+
+        if (obj instanceof Socket) {
+            impl = ((Socket)obj).getImpl();
+        } else if (obj instanceof ServerSocket) {
+            impl = ((ServerSocket)obj).getImpl();
+        } else {
+            throw new IllegalArgumentException();
+        }
+        impl.setOption(name, value);
+    }
+
+    private static <T> T getOption(Object obj, SocketOption<T> name) throws IOException {
+        SocketImpl impl;
+
+        if (obj instanceof Socket) {
+            impl = ((Socket)obj).getImpl();
+        } else if (obj instanceof ServerSocket) {
+            impl = ((ServerSocket)obj).getImpl();
+        } else {
+            throw new IllegalArgumentException();
+        }
+        return impl.getOption(name);
+    }
+
+    private static <T> void setOption(DatagramSocket s, SocketOption<T> name, T value) throws IOException {
+        s.getImpl().setOption(name, value);
+    }
+
+    private static <T> T getOption(DatagramSocket s, SocketOption<T> name) throws IOException {
+        return s.getImpl().getOption(name);
+    }
+
+}
diff --git a/ojluni/src/main/java/java/net/URI.java b/ojluni/src/main/java/java/net/URI.java
index a49eeaf..cfeb731 100755
--- a/ojluni/src/main/java/java/net/URI.java
+++ b/ojluni/src/main/java/java/net/URI.java
@@ -3365,19 +3365,7 @@
 
             do {
                 // domainlabel = alphanum [ *( alphanum | "-" | "_" ) alphanum ]
-
-                // RFC1034#section-3.5 doesn't permit empty labels in hostnames, but we accepted
-                // this prior to N and the behavior is used by some apps. They're accepted for
-                // compatibility but we produce a warning in the log.
-                // http://b/25991669
-                if (p < n && charAt(p) == '.') {
-                  java.lang.System.logE("URI " + substring(start, n) +  " has empty labels in " +
-                                        "the hostname. This is malformed and will not be accepted" +
-                                        "in future Android releases.");
-                  q = ++p;
-                  continue;
-                }
-
+                //
                 // The RFCs don't permit underscores in hostnames, but URI has to because a certain
                 // large website doesn't seem to care about standards and specs.
                 // http://code.google.com/p/android/issues/detail?id=37577
diff --git a/ojluni/src/main/java/java/text/Annotation.java b/ojluni/src/main/java/java/text/Annotation.java
index c3ca5fc..1f5577c 100755
--- a/ojluni/src/main/java/java/text/Annotation.java
+++ b/ojluni/src/main/java/java/text/Annotation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2002, 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,7 +59,8 @@
     /**
      * Constructs an annotation record with the given value, which
      * may be null.
-     * @param value The value of the attribute
+     *
+     * @param value the value of the attribute
      */
     public Annotation(Object value) {
         this.value = value;
@@ -67,6 +68,8 @@
 
     /**
      * Returns the value of the attribute, which may be null.
+     *
+     * @return the value of the attribute
      */
     public Object getValue() {
         return value;
@@ -74,6 +77,8 @@
 
     /**
      * Returns the String representation of this Annotation.
+     *
+     * @return the {@code String} representation of this {@code Annotation}
      */
     public String toString() {
         return getClass().getName() + "[value=" + value + "]";
diff --git a/ojluni/src/main/java/java/text/AttributedCharacterIterator.java b/ojluni/src/main/java/java/text/AttributedCharacterIterator.java
index 86597bf..26a7e88 100755
--- a/ojluni/src/main/java/java/text/AttributedCharacterIterator.java
+++ b/ojluni/src/main/java/java/text/AttributedCharacterIterator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, 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
@@ -97,10 +97,12 @@
         private String name;
 
         // table of all instances in this class, used by readResolve
-        private static final Map instanceMap = new HashMap(7);
+        private static final Map<String, Attribute> instanceMap = new HashMap<>(7);
 
         /**
          * Constructs an {@code Attribute} with the given name.
+         *
+         * @param name the name of {@code Attribute}
          */
         protected Attribute(String name) {
             this.name = name;
@@ -111,7 +113,7 @@
 
         /**
          * Compares two objects for equality. This version only returns true
-         * for <code>x.equals(y)</code> if <code>x</code> and <code>y</code> refer
+         * for {@code x.equals(y)} if {@code x} and {@code y} refer
          * to the same object, and guarantees this for all subclasses.
          */
         public final boolean equals(Object obj) {
@@ -137,6 +139,8 @@
 
         /**
          * Returns the name of the attribute.
+         *
+         * @return the name of {@code Attribute}
          */
         protected String getName() {
             return name;
@@ -144,13 +148,17 @@
 
         /**
          * Resolves instances being deserialized to the predefined constants.
+         *
+         * @return the resolved {@code Attribute} object
+         * @throws InvalidObjectException if the object to resolve is not
+         *                                an instance of {@code Attribute}
          */
         protected Object readResolve() throws InvalidObjectException {
             if (this.getClass() != Attribute.class) {
                 throw new InvalidObjectException("subclass didn't correctly implement readResolve");
             }
 
-            Attribute instance = (Attribute) instanceMap.get(getName());
+            Attribute instance = instanceMap.get(getName());
             if (instance != null) {
                 return instance;
             } else {
@@ -171,6 +179,7 @@
          * it is often necessary to store the reading (pronunciation) along with the
          * written form.
          * <p>Values are instances of {@link Annotation} holding instances of {@link String}.
+         *
          * @see Annotation
          * @see java.lang.String
          */
@@ -196,18 +205,26 @@
      * <p>Any contiguous text segments having the same attributes (the
      * same set of attribute/value pairs) are treated as separate runs
      * if the attributes have been given to those text segments separately.
+     *
+     * @return the index of the first character of the run
      */
     public int getRunStart();
 
     /**
      * Returns the index of the first character of the run
      * with respect to the given {@code attribute} containing the current character.
+     *
+     * @param attribute the desired attribute.
+     * @return the index of the first character of the run
      */
     public int getRunStart(Attribute attribute);
 
     /**
      * Returns the index of the first character of the run
      * with respect to the given {@code attributes} containing the current character.
+     *
+     * @param attributes a set of the desired attributes.
+     * @return the index of the first character of the run
      */
     public int getRunStart(Set<? extends Attribute> attributes);
 
@@ -218,30 +235,43 @@
      * <p>Any contiguous text segments having the same attributes (the
      * same set of attribute/value pairs) are treated as separate runs
      * if the attributes have been given to those text segments separately.
+     *
+     * @return the index of the first character following the run
      */
     public int getRunLimit();
 
     /**
      * Returns the index of the first character following the run
      * with respect to the given {@code attribute} containing the current character.
+     *
+     * @param attribute the desired attribute
+     * @return the index of the first character following the run
      */
     public int getRunLimit(Attribute attribute);
 
     /**
      * Returns the index of the first character following the run
      * with respect to the given {@code attributes} containing the current character.
+     *
+     * @param attributes a set of the desired attributes
+     * @return the index of the first character following the run
      */
     public int getRunLimit(Set<? extends Attribute> attributes);
 
     /**
      * Returns a map with the attributes defined on the current
      * character.
+     *
+     * @return a map with the attributes defined on the current character
      */
     public Map<Attribute,Object> getAttributes();
 
     /**
      * Returns the value of the named {@code attribute} for the current character.
      * Returns {@code null} if the {@code attribute} is not defined.
+     *
+     * @param attribute the desired attribute
+     * @return the value of the named {@code attribute} or {@code null}
      */
     public Object getAttribute(Attribute attribute);
 
@@ -249,6 +279,8 @@
      * Returns the keys of all attributes defined on the
      * iterator's text range. The set is empty if no
      * attributes are defined.
+     *
+     * @return the keys of all attributes
      */
     public Set<Attribute> getAllAttributeKeys();
 };
diff --git a/ojluni/src/main/java/java/text/AttributedString.java b/ojluni/src/main/java/java/text/AttributedString.java
index 0296525..fa398e9 100755
--- a/ojluni/src/main/java/java/text/AttributedString.java
+++ b/ojluni/src/main/java/java/text/AttributedString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,8 +61,8 @@
     int runArraySize;               // current size of the arrays
     int runCount;                   // actual number of runs, <= runArraySize
     int runStarts[];                // start index for each run
-    Vector runAttributes[];         // vector of attribute keys for each run
-    Vector runAttributeValues[];    // parallel vector of attribute values for each run
+    Vector<Attribute> runAttributes[];         // vector of attribute keys for each run
+    Vector<Object> runAttributeValues[];    // parallel vector of attribute values for each run
 
     /**
      * Constructs an AttributedString instance with the given
@@ -92,7 +92,7 @@
                 // Determine the runs, creating a new run when the attributes
                 // differ.
                 int offset = 0;
-                Map last = null;
+                Map<Attribute,Object> last = null;
 
                 for (int counter = 0; counter < iterators.length; counter++) {
                     AttributedCharacterIterator iterator = iterators[counter];
@@ -103,7 +103,7 @@
                     while (index < end) {
                         iterator.setIndex(index);
 
-                        Map attrs = iterator.getAttributes();
+                        Map<Attribute,Object> attrs = iterator.getAttributes();
 
                         if (mapsDiffer(last, attrs)) {
                             setAttributes(attrs, index - start + offset);
@@ -156,13 +156,14 @@
         int attributeCount = attributes.size();
         if (attributeCount > 0) {
             createRunAttributeDataVectors();
-            Vector newRunAttributes = new Vector(attributeCount);
-            Vector newRunAttributeValues = new Vector(attributeCount);
+            Vector<Attribute> newRunAttributes = new Vector<>(attributeCount);
+            Vector<Object> newRunAttributeValues = new Vector<>(attributeCount);
             runAttributes[0] = newRunAttributes;
             runAttributeValues[0] = newRunAttributeValues;
-            Iterator iterator = attributes.entrySet().iterator();
+
+            Iterator<? extends Map.Entry<? extends Attribute, ?>> iterator = attributes.entrySet().iterator();
             while (iterator.hasNext()) {
-                Map.Entry entry = (Map.Entry) iterator.next();
+                Map.Entry<? extends Attribute, ?> entry = iterator.next();
                 newRunAttributes.addElement(entry.getKey());
                 newRunAttributeValues.addElement(entry.getValue());
             }
@@ -252,7 +253,7 @@
             return;
 
         // Select attribute keys to be taken care of
-        HashSet keys = new HashSet();
+        HashSet<Attribute> keys = new HashSet<>();
         if (attributes == null) {
             keys.addAll(text.getAllAttributeKeys());
         } else {
@@ -266,9 +267,9 @@
         // Get and set attribute runs for each attribute name. Need to
         // scan from the top of the text so that we can discard any
         // Annotation that is no longer applied to a subset text segment.
-        Iterator itr = keys.iterator();
+        Iterator<Attribute> itr = keys.iterator();
         while (itr.hasNext()) {
-            Attribute attributeKey = (Attribute)itr.next();
+            Attribute attributeKey = itr.next();
             text.setIndex(textBeginIndex);
             while (text.getIndex() < endIndex) {
                 int start = text.getRunStart(attributeKey);
@@ -390,10 +391,11 @@
         int beginRunIndex = ensureRunBreak(beginIndex);
         int endRunIndex = ensureRunBreak(endIndex);
 
-        Iterator iterator = attributes.entrySet().iterator();
+        Iterator<? extends Map.Entry<? extends Attribute, ?>> iterator =
+            attributes.entrySet().iterator();
         while (iterator.hasNext()) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            addAttributeRunData((Attribute) entry.getKey(), entry.getValue(), beginRunIndex, endRunIndex);
+            Map.Entry<? extends Attribute, ?> entry = iterator.next();
+            addAttributeRunData(entry.getKey(), entry.getValue(), beginRunIndex, endRunIndex);
         }
     }
 
@@ -415,8 +417,13 @@
     private final void createRunAttributeDataVectors() {
         // use temporary variables so things remain consistent in case of an exception
         int newRunStarts[] = new int[ARRAY_SIZE_INCREMENT];
-        Vector newRunAttributes[] = new Vector[ARRAY_SIZE_INCREMENT];
-        Vector newRunAttributeValues[] = new Vector[ARRAY_SIZE_INCREMENT];
+
+        @SuppressWarnings("unchecked")
+        Vector<Attribute> newRunAttributes[] = (Vector<Attribute>[]) new Vector<?>[ARRAY_SIZE_INCREMENT];
+
+        @SuppressWarnings("unchecked")
+        Vector<Object> newRunAttributeValues[] = (Vector<Object>[]) new Vector<?>[ARRAY_SIZE_INCREMENT];
+
         runStarts = newRunStarts;
         runAttributes = newRunAttributes;
         runAttributeValues = newRunAttributeValues;
@@ -461,8 +468,13 @@
         if (runCount == runArraySize) {
             int newArraySize = runArraySize + ARRAY_SIZE_INCREMENT;
             int newRunStarts[] = new int[newArraySize];
-            Vector newRunAttributes[] = new Vector[newArraySize];
-            Vector newRunAttributeValues[] = new Vector[newArraySize];
+
+            @SuppressWarnings("unchecked")
+            Vector<Attribute> newRunAttributes[] = (Vector<Attribute>[]) new Vector<?>[newArraySize];
+
+            @SuppressWarnings("unchecked")
+            Vector<Object> newRunAttributeValues[] = (Vector<Object>[]) new Vector<?>[newArraySize];
+
             for (int i = 0; i < runArraySize; i++) {
                 newRunStarts[i] = runStarts[i];
                 newRunAttributes[i] = runAttributes[i];
@@ -476,17 +488,17 @@
 
         // make copies of the attribute information of the old run that the new one used to be part of
         // use temporary variables so things remain consistent in case of an exception
-        Vector newRunAttributes = null;
-        Vector newRunAttributeValues = null;
+        Vector<Attribute> newRunAttributes = null;
+        Vector<Object> newRunAttributeValues = null;
 
         if (copyAttrs) {
-            Vector oldRunAttributes = runAttributes[runIndex - 1];
-            Vector oldRunAttributeValues = runAttributeValues[runIndex - 1];
+            Vector<Attribute> oldRunAttributes = runAttributes[runIndex - 1];
+            Vector<Object> oldRunAttributeValues = runAttributeValues[runIndex - 1];
             if (oldRunAttributes != null) {
-                newRunAttributes = (Vector) oldRunAttributes.clone();
+                newRunAttributes = new Vector<>(oldRunAttributes);
             }
             if (oldRunAttributeValues != null) {
-                newRunAttributeValues = (Vector) oldRunAttributeValues.clone();
+                newRunAttributeValues =  new Vector<>(oldRunAttributeValues);
             }
         }
 
@@ -511,8 +523,8 @@
         for (int i = beginRunIndex; i < endRunIndex; i++) {
             int keyValueIndex = -1; // index of key and value in our vectors; assume we don't have an entry yet
             if (runAttributes[i] == null) {
-                Vector newRunAttributes = new Vector();
-                Vector newRunAttributeValues = new Vector();
+                Vector<Attribute> newRunAttributes = new Vector<>();
+                Vector<Object> newRunAttributeValues = new Vector<>();
                 runAttributes[i] = newRunAttributes;
                 runAttributeValues[i] = newRunAttributeValues;
             } else {
@@ -597,8 +609,8 @@
     }
 
     private synchronized Object getAttribute(Attribute attribute, int runIndex) {
-        Vector currentRunAttributes = runAttributes[runIndex];
-        Vector currentRunAttributeValues = runAttributeValues[runIndex];
+        Vector<Attribute> currentRunAttributes = runAttributes[runIndex];
+        Vector<Object> currentRunAttributeValues = runAttributeValues[runIndex];
         if (currentRunAttributes == null) {
             return null;
         }
@@ -650,10 +662,10 @@
     }
 
     // returns whether all specified attributes have equal values in the runs with the given indices
-    private boolean attributeValuesMatch(Set attributes, int runIndex1, int runIndex2) {
-        Iterator iterator = attributes.iterator();
+    private boolean attributeValuesMatch(Set<? extends Attribute> attributes, int runIndex1, int runIndex2) {
+        Iterator<? extends Attribute> iterator = attributes.iterator();
         while (iterator.hasNext()) {
-            Attribute key = (Attribute) iterator.next();
+            Attribute key = iterator.next();
            if (!valuesMatch(getAttribute(key, runIndex1), getAttribute(key, runIndex2))) {
                 return false;
             }
@@ -690,7 +702,7 @@
      * (typically the end of the text) to the ones specified in attrs.
      * This is only meant to be called from the constructor!
      */
-    private void setAttributes(Map attrs, int offset) {
+    private void setAttributes(Map<Attribute, Object> attrs, int offset) {
         if (runCount == 0) {
             createRunAttributeDataVectors();
         }
@@ -699,12 +711,12 @@
         int size;
 
         if (attrs != null && (size = attrs.size()) > 0) {
-            Vector runAttrs = new Vector(size);
-            Vector runValues = new Vector(size);
-            Iterator iterator = attrs.entrySet().iterator();
+            Vector<Attribute> runAttrs = new Vector<>(size);
+            Vector<Object> runValues = new Vector<>(size);
+            Iterator<Map.Entry<Attribute, Object>> iterator = attrs.entrySet().iterator();
 
             while (iterator.hasNext()) {
-                Map.Entry entry = (Map.Entry)iterator.next();
+                Map.Entry<Attribute, Object> entry = iterator.next();
 
                 runAttrs.add(entry.getKey());
                 runValues.add(entry.getValue());
@@ -717,7 +729,7 @@
     /**
      * Returns true if the attributes specified in last and attrs differ.
      */
-    private static boolean mapsDiffer(Map last, Map attrs) {
+    private static <K,V> boolean mapsDiffer(Map<K, V> last, Map<K, V> attrs) {
         if (last == null) {
             return (attrs != null && attrs.size() > 0);
         }
@@ -761,7 +773,7 @@
             this.currentIndex = beginIndex;
             updateRunInfo();
             if (attributes != null) {
-                relevantAttributes = (Attribute[]) attributes.clone();
+                relevantAttributes = attributes.clone();
             }
         }
 
@@ -794,7 +806,7 @@
                 return other;
             }
             catch (CloneNotSupportedException e) {
-                throw new InternalError();
+                throw new InternalError(e);
             }
         }
 
@@ -944,7 +956,7 @@
             if (runAttributes == null || currentRunIndex == -1 || runAttributes[currentRunIndex] == null) {
                 // ??? would be nice to return null, but current spec doesn't allow it
                 // returning Hashtable saves AttributeMap from dealing with emptiness
-                return new Hashtable();
+                return new Hashtable<>();
             }
             return new AttributeMap(currentRunIndex, beginIndex, endIndex);
         }
@@ -954,16 +966,16 @@
             if (runAttributes == null) {
                 // ??? would be nice to return null, but current spec doesn't allow it
                 // returning HashSet saves us from dealing with emptiness
-                return new HashSet();
+                return new HashSet<>();
             }
             synchronized (AttributedString.this) {
                 // ??? should try to create this only once, then update if necessary,
                 // and give callers read-only view
-                Set keys = new HashSet();
+                Set<Attribute> keys = new HashSet<>();
                 int i = 0;
                 while (i < runCount) {
                     if (runStarts[i] < endIndex && (i == runCount - 1 || runStarts[i + 1] > beginIndex)) {
-                        Vector currentRunAttributes = runAttributes[i];
+                        Vector<Attribute> currentRunAttributes = runAttributes[i];
                         if (currentRunAttributes != null) {
                             int j = currentRunAttributes.size();
                             while (j-- > 0) {
@@ -1052,12 +1064,12 @@
             this.endIndex = endIndex;
         }
 
-        public Set entrySet() {
-            HashSet set = new HashSet();
+        public Set<Map.Entry<Attribute, Object>> entrySet() {
+            HashSet<Map.Entry<Attribute, Object>> set = new HashSet<>();
             synchronized (AttributedString.this) {
                 int size = runAttributes[runIndex].size();
                 for (int i = 0; i < size; i++) {
-                    Attribute key = (Attribute) runAttributes[runIndex].get(i);
+                    Attribute key = runAttributes[runIndex].get(i);
                     Object value = runAttributeValues[runIndex].get(i);
                     if (value instanceof Annotation) {
                         value = AttributedString.this.getAttributeCheckRange(key,
@@ -1066,7 +1078,8 @@
                             continue;
                         }
                     }
-                    Map.Entry entry = new AttributeEntry(key, value);
+
+                    Map.Entry<Attribute, Object> entry = new AttributeEntry(key, value);
                     set.add(entry);
                 }
             }
@@ -1079,7 +1092,7 @@
     }
 }
 
-class AttributeEntry implements Map.Entry {
+class AttributeEntry implements Map.Entry<Attribute,Object> {
 
     private Attribute key;
     private Object value;
@@ -1098,7 +1111,7 @@
             (value == null ? other.value == null : other.value.equals(value));
     }
 
-    public Object getKey() {
+    public Attribute getKey() {
         return key;
     }
 
diff --git a/ojluni/src/main/java/java/text/Bidi.java b/ojluni/src/main/java/java/text/Bidi.java
index 91a4c419..21085f2 100755
--- a/ojluni/src/main/java/java/text/Bidi.java
+++ b/ojluni/src/main/java/java/text/Bidi.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2009, 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
@@ -192,8 +192,10 @@
      * Create a Bidi object representing the bidi information on a line of text within
      * the paragraph represented by the current Bidi.  This call is not required if the
      * entire paragraph fits on one line.
+     *
      * @param lineStart the offset from the start of the paragraph to the start of the line.
      * @param lineLimit the offset from the start of the paragraph to the limit of the line.
+     * @return a {@code Bidi} object
      */
     public Bidi createLineBidi(int lineStart, int lineLimit) {
         if (lineStart < 0 || lineLimit < 0 || lineStart > lineLimit || lineLimit > getLength()) {
@@ -217,6 +219,7 @@
     /**
      * Return true if the line is not left-to-right or right-to-left.  This means it either has mixed runs of left-to-right
      * and right-to-left text, or the base direction differs from the direction of the only run of text.
+     *
      * @return true if the line is not left-to-right or right-to-left.
      */
     public boolean isMixed() {
@@ -225,6 +228,7 @@
 
     /**
      * Return true if the line is all left-to-right text and the base direction is left-to-right.
+     *
      * @return true if the line is all left-to-right text and the base direction is left-to-right
      */
     public boolean isLeftToRight() {
@@ -264,8 +268,10 @@
     }
 
     /**
-     * Return the resolved level of the character at offset.  If offset is <0 or >=
-     * the length of the line, return the base direction level.
+     * Return the resolved level of the character at offset.  If offset is
+     * {@literal <} 0 or &ge; the length of the line, return the base direction
+     * level.
+     *
      * @param offset the index of the character for which to return the level
      * @return the resolved level of the character at offset
      */
diff --git a/ojluni/src/main/java/java/text/BreakIterator.java b/ojluni/src/main/java/java/text/BreakIterator.java
index 548a534..be75a9e 100755
--- a/ojluni/src/main/java/java/text/BreakIterator.java
+++ b/ojluni/src/main/java/java/text/BreakIterator.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, 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
@@ -188,7 +188,7 @@
  *
  * Find the next word:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * public static int nextWordStartAfter(int pos, String text) {
  *     BreakIterator wb = BreakIterator.getWordInstance();
  *     wb.setText(text);
@@ -204,7 +204,7 @@
  *     }
  *     return BreakIterator.DONE;
  * }
- * </pre>
+ * }</pre>
  * (The iterator returned by BreakIterator.getWordInstance() is unique in that
  * the break positions it returns don't represent both the start and end of the
  * thing being iterated over.  That is, a sentence-break iterator returns breaks
@@ -222,25 +222,27 @@
  *
  */
 
-public abstract class BreakIterator implements Cloneable {
-
+public abstract class BreakIterator implements Cloneable
+{
     /**
      * Constructor. BreakIterator is stateless and has no default behavior.
      */
-    protected BreakIterator() {
+    protected BreakIterator()
+    {
     }
 
     /**
      * Create a copy of this iterator
-     *
      * @return A copy of this
      */
     @Override
-    public Object clone() {
+    public Object clone()
+    {
         try {
             return super.clone();
-        } catch (CloneNotSupportedException e) {
-            throw new AssertionError(e);
+        }
+        catch (CloneNotSupportedException e) {
+            throw new InternalError(e);
         }
     }
 
@@ -254,7 +256,6 @@
     /**
      * Returns the first boundary. The iterator's current position is set
      * to the first text boundary.
-     *
      * @return The character index of the first text boundary.
      */
     public abstract int first();
@@ -262,7 +263,6 @@
     /**
      * Returns the last boundary. The iterator's current position is set
      * to the last text boundary.
-     *
      * @return The character index of the last text boundary.
      */
     public abstract int last();
@@ -279,10 +279,9 @@
      * to the (m + 2)th text boundary. A next(4) call would return
      * <code>BreakIterator.DONE</code> and the last text boundary would become the
      * new text position.
-     *
      * @param n which boundary to return.  A value of 0
-     *          does nothing.  Negative values move to previous boundaries
-     *          and positive values move to later boundaries.
+     * does nothing.  Negative values move to previous boundaries
+     * and positive values move to later boundaries.
      * @return The character index of the nth boundary from the current position
      * or <code>BreakIterator.DONE</code> if either first or last text boundary
      * has been reached.
@@ -294,7 +293,6 @@
      * is the last text boundary, it returns <code>BreakIterator.DONE</code> and
      * the iterator's current position is unchanged. Otherwise, the iterator's
      * current position is set to the boundary following the current boundary.
-     *
      * @return The character index of the next text boundary or
      * <code>BreakIterator.DONE</code> if the current boundary is the last text
      * boundary.
@@ -308,7 +306,6 @@
      * is the first text boundary, it returns <code>BreakIterator.DONE</code> and
      * the iterator's current position is unchanged. Otherwise, the iterator's
      * current position is set to the boundary preceding the current boundary.
-     *
      * @return The character index of the previous text boundary or
      * <code>BreakIterator.DONE</code> if the current boundary is the first text
      * boundary.
@@ -322,14 +319,12 @@
      * Otherwise, the iterator's current position is set to the returned boundary.
      * The value returned is always greater than the offset or the value
      * <code>BreakIterator.DONE</code>.
-     *
      * @param offset the character offset to begin scanning.
      * @return The first boundary after the specified offset or
      * <code>BreakIterator.DONE</code> if the last text boundary is passed in
      * as the offset.
-     * @throws IllegalArgumentException if the specified offset is less than
-     *                                  the first text boundary or greater than the last text
-     *                                  boundary.
+     * @exception  IllegalArgumentException if the specified offset is less than
+     * the first text boundary or greater than the last text boundary.
      */
     public abstract int following(int offset);
 
@@ -340,7 +335,7 @@
      * Otherwise, the iterator's current position is set to the returned boundary.
      * The value returned is always less than the offset or the value
      * <code>BreakIterator.DONE</code>.
-     * @param offset the characater offset to begin scanning.
+     * @param offset the character offset to begin scanning.
      * @return The last boundary before the specified offset or
      * <code>BreakIterator.DONE</code> if the first text boundary is passed in
      * as the offset.
@@ -353,8 +348,9 @@
         // abstract methods to an existing class.  There is almost ALWAYS a
         // better, faster way to do this.
         int pos = following(offset);
-        while (pos >= offset && pos != DONE)
+        while (pos >= offset && pos != DONE) {
             pos = previous();
+        }
         return pos;
     }
 
@@ -393,7 +389,6 @@
      * <code>BreakIterator.DONE</code> because either first or last text boundary
      * has been reached, it returns the first or last text boundary depending on
      * which one is reached.
-     *
      * @return The text boundary returned from the above methods, first or last
      * text boundary.
      * @see #next()
@@ -408,7 +403,6 @@
 
     /**
      * Get the text being scanned
-     *
      * @return the text being scanned
      */
     public abstract CharacterIterator getText();
@@ -416,117 +410,116 @@
     /**
      * Set a new text string to be scanned.  The current scan
      * position is reset to first().
-     *
      * @param newText new text to scan.
      */
-    public void setText(String newText) {
+    public void setText(String newText)
+    {
         setText(new StringCharacterIterator(newText));
     }
 
     /**
      * Set a new text for scanning.  The current scan
      * position is reset to first().
-     *
      * @param newText new text to scan.
      */
     public abstract void setText(CharacterIterator newText);
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#word">word breaks</a>
+     * for <a href="BreakIterator.html#word">word breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
-     *
      * @return A break iterator for word breaks
      */
-    public static BreakIterator getWordInstance() {
+    public static BreakIterator getWordInstance()
+    {
         return getWordInstance(Locale.getDefault());
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#word">word breaks</a>
+     * for <a href="BreakIterator.html#word">word breaks</a>
      * for the given locale.
-     *
      * @param locale the desired locale
      * @return A break iterator for word breaks
-     * @throws NullPointerException if <code>locale</code> is null
+     * @exception NullPointerException if <code>locale</code> is null
      */
-    public static BreakIterator getWordInstance(Locale locale) {
+    public static BreakIterator getWordInstance(Locale locale)
+    {
         return new IcuIteratorWrapper(
                 android.icu.text.BreakIterator.getWordInstance(locale));
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#line">line breaks</a>
+     * for <a href="BreakIterator.html#line">line breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
-     *
      * @return A break iterator for line breaks
      */
-    public static BreakIterator getLineInstance() {
+    public static BreakIterator getLineInstance()
+    {
         return getLineInstance(Locale.getDefault());
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#line">line breaks</a>
+     * for <a href="BreakIterator.html#line">line breaks</a>
      * for the given locale.
-     *
      * @param locale the desired locale
      * @return A break iterator for line breaks
-     * @throws NullPointerException if <code>locale</code> is null
+     * @exception NullPointerException if <code>locale</code> is null
      */
-    public static BreakIterator getLineInstance(Locale locale) {
+    public static BreakIterator getLineInstance(Locale locale)
+    {
         return new IcuIteratorWrapper(
                 android.icu.text.BreakIterator.getLineInstance(locale));
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#character">character breaks</a>
+     * for <a href="BreakIterator.html#character">character breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
-     *
      * @return A break iterator for character breaks
      */
-    public static BreakIterator getCharacterInstance() {
+    public static BreakIterator getCharacterInstance()
+    {
         return getCharacterInstance(Locale.getDefault());
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#character">character breaks</a>
+     * for <a href="BreakIterator.html#character">character breaks</a>
      * for the given locale.
-     *
      * @param locale the desired locale
      * @return A break iterator for character breaks
-     * @throws NullPointerException if <code>locale</code> is null
+     * @exception NullPointerException if <code>locale</code> is null
      */
-    public static BreakIterator getCharacterInstance(Locale locale) {
+    public static BreakIterator getCharacterInstance(Locale locale)
+    {
         return new IcuIteratorWrapper(
                 android.icu.text.BreakIterator.getCharacterInstance(locale));
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#sentence">sentence breaks</a>
+     * for <a href="BreakIterator.html#sentence">sentence breaks</a>
      * for the {@linkplain Locale#getDefault() default locale}.
-     *
      * @return A break iterator for sentence breaks
      */
-    public static BreakIterator getSentenceInstance() {
+    public static BreakIterator getSentenceInstance()
+    {
         return getSentenceInstance(Locale.getDefault());
     }
 
     /**
      * Returns a new <code>BreakIterator</code> instance
-     * for <a href="#sentence">sentence breaks</a>
+     * for <a href="BreakIterator.html#sentence">sentence breaks</a>
      * for the given locale.
-     *
      * @param locale the desired locale
      * @return A break iterator for sentence breaks
-     * @throws NullPointerException if <code>locale</code> is null
+     * @exception NullPointerException if <code>locale</code> is null
      */
-    public static BreakIterator getSentenceInstance(Locale locale) {
+    public static BreakIterator getSentenceInstance(Locale locale)
+    {
         return new IcuIteratorWrapper(
                 android.icu.text.BreakIterator.getSentenceInstance(locale));
     }
@@ -542,9 +535,10 @@
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
      * @return An array of locales for which localized
-     * <code>BreakIterator</code> instances are available.
+     *         <code>BreakIterator</code> instances are available.
      */
-    public static synchronized Locale[] getAvailableLocales() {
+    public static synchronized Locale[] getAvailableLocales()
+    {
         return android.icu.text.BreakIterator.getAvailableLocales();
     }
 }
diff --git a/ojluni/src/main/java/java/text/CharacterIterator.java b/ojluni/src/main/java/java/text/CharacterIterator.java
index 2b21e14..efa7ab4 100755
--- a/ojluni/src/main/java/java/text/CharacterIterator.java
+++ b/ojluni/src/main/java/java/text/CharacterIterator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2000, 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
@@ -62,27 +62,27 @@
  * <P>Examples:<P>
  *
  * Traverse the text from start to finish
- * <pre>
+ * <pre>{@code
  * public void traverseForward(CharacterIterator iter) {
  *     for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
  *         processChar(c);
  *     }
  * }
- * </pre>
+ * }</pre>
  *
  * Traverse the text backwards, from end to start
- * <pre>
+ * <pre>{@code
  * public void traverseBackward(CharacterIterator iter) {
  *     for(char c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
  *         processChar(c);
  *     }
  * }
- * </pre>
+ * }</pre>
  *
  * Traverse both forward and backward from a given position in the text.
  * Calls to notBoundary() in this example represents some
  * additional stopping criteria.
- * <pre>
+ * <pre>{@code
  * public void traverseOut(CharacterIterator iter, int pos) {
  *     for (char c = iter.setIndex(pos);
  *              c != CharacterIterator.DONE && notBoundary(c);
@@ -96,7 +96,7 @@
  *     int start = iter.getIndex();
  *     processSection(start, end);
  * }
- * </pre>
+ * }</pre>
  *
  * @see StringCharacterIterator
  * @see AttributedCharacterIterator
diff --git a/ojluni/src/main/java/java/text/CharacterIteratorFieldDelegate.java b/ojluni/src/main/java/java/text/CharacterIteratorFieldDelegate.java
index 019bfe7..9e22ee7 100755
--- a/ojluni/src/main/java/java/text/CharacterIteratorFieldDelegate.java
+++ b/ojluni/src/main/java/java/text/CharacterIteratorFieldDelegate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 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
@@ -41,7 +41,7 @@
      * for existing regions result in invoking addAttribute on the existing
      * AttributedStrings.
      */
-    private ArrayList attributedStrings;
+    private ArrayList<AttributedString> attributedStrings;
     /**
      * Running count of the number of characters that have
      * been encountered.
@@ -50,7 +50,7 @@
 
 
     CharacterIteratorFieldDelegate() {
-        attributedStrings = new ArrayList();
+        attributedStrings = new ArrayList<>();
     }
 
     public void formatted(Format.Field attr, Object value, int start, int end,
@@ -62,7 +62,7 @@
                 int asIndex = attributedStrings.size() - 1;
 
                 while (start < index) {
-                    AttributedString as = (AttributedString)attributedStrings.
+                    AttributedString as = attributedStrings.
                                            get(asIndex--);
                     int newIndex = index - as.length();
                     int aStart = Math.max(0, start - newIndex);
@@ -116,8 +116,8 @@
                                     AttributedCharacterIterator[iCount];
 
         for (int counter = 0; counter < iCount; counter++) {
-            iterators[counter] = ((AttributedString)attributedStrings.
-                                  get(counter)).getIterator();
+            iterators[counter] = attributedStrings.
+                                  get(counter).getIterator();
         }
         return new AttributedString(iterators).getIterator();
     }
diff --git a/ojluni/src/main/java/java/text/ChoiceFormat.java b/ojluni/src/main/java/java/text/ChoiceFormat.java
index ccbd24f..6c5f281 100755
--- a/ojluni/src/main/java/java/text/ChoiceFormat.java
+++ b/ojluni/src/main/java/java/text/ChoiceFormat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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,7 +50,7 @@
  * specifies a half-open interval up to the next item:
  * <blockquote>
  * <pre>
- * X matches j if and only if limit[j] &lt;= X &lt; limit[j+1]
+ * X matches j if and only if limit[j] &le; X &lt; limit[j+1]
  * </pre>
  * </blockquote>
  * If there is no match, then either the first or last index is used, depending
@@ -85,21 +85,21 @@
  * <p>
  * Here is a simple example that shows formatting and parsing:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * double[] limits = {1,2,3,4,5,6,7};
  * String[] dayOfWeekNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
  * ChoiceFormat form = new ChoiceFormat(limits, dayOfWeekNames);
  * ParsePosition status = new ParsePosition(0);
- * for (double i = 0.0; i &lt;= 8.0; ++i) {
+ * for (double i = 0.0; i <= 8.0; ++i) {
  *     status.setIndex(0);
- *     System.out.println(i + " -&gt; " + form.format(i) + " -&gt; "
+ *     System.out.println(i + " -> " + form.format(i) + " -> "
  *                              + form.parse(form.format(i),status));
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * Here is a more complex example, with a pattern format:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * double[] filelimits = {0,1,2};
  * String[] filepart = {"are no files","is one file","are {2} files"};
  * ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
@@ -107,20 +107,20 @@
  * MessageFormat pattform = new MessageFormat("There {0} on {1}");
  * pattform.setFormats(testFormats);
  * Object[] testArgs = {null, "ADisk", null};
- * for (int i = 0; i &lt; 4; ++i) {
+ * for (int i = 0; i < 4; ++i) {
  *     testArgs[0] = new Integer(i);
  *     testArgs[2] = testArgs[0];
  *     System.out.println(pattform.format(testArgs));
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * <p>
  * Specifying a pattern for ChoiceFormat objects is fairly straightforward.
  * For example:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * ChoiceFormat fmt = new ChoiceFormat(
- *      "-1#is negative| 0#is zero or fraction | 1#is one |1.0&lt;is 1+ |2#is two |2&lt;is more than 2.");
+ *      "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+ |2#is two |2<is more than 2.");
  * System.out.println("Formatter Pattern : " + fmt.toPattern());
  *
  * System.out.println("Format with -INF : " + fmt.format(Double.NEGATIVE_INFINITY));
@@ -133,25 +133,25 @@
  * System.out.println("Format with 2.1 : " + fmt.format(2.1));
  * System.out.println("Format with NaN : " + fmt.format(Double.NaN));
  * System.out.println("Format with +INF : " + fmt.format(Double.POSITIVE_INFINITY));
- * </pre>
+ * }</pre>
  * </blockquote>
  * And the output result would be like the following:
  * <blockquote>
- * <pre>
- *   Format with -INF : is negative
- *   Format with -1.0 : is negative
- *   Format with 0 : is zero or fraction
- *   Format with 0.9 : is zero or fraction
- *   Format with 1.0 : is one
- *   Format with 1.5 : is 1+
- *   Format with 2 : is two
- *   Format with 2.1 : is more than 2.
- *   Format with NaN : is negative
- *   Format with +INF : is more than 2.
- * </pre>
+ * <pre>{@code
+ * Format with -INF : is negative
+ * Format with -1.0 : is negative
+ * Format with 0 : is zero or fraction
+ * Format with 0.9 : is zero or fraction
+ * Format with 1.0 : is one
+ * Format with 1.5 : is 1+
+ * Format with 2 : is two
+ * Format with 2.1 : is more than 2.
+ * Format with NaN : is negative
+ * Format with +INF : is more than 2.
+ * }</pre>
  * </blockquote>
  *
- * <h4><a name="synchronization">Synchronization</a></h4>
+ * <h3><a name="synchronization">Synchronization</a></h3>
  *
  * <p>
  * Choice formats are not synchronized.
@@ -255,6 +255,8 @@
 
     /**
      * Gets the pattern.
+     *
+     * @return the pattern string
      */
     public String toPattern() {
         StringBuffer result = new StringBuffer();
@@ -305,6 +307,8 @@
 
     /**
      * Constructs with limits and corresponding formats based on the pattern.
+     *
+     * @param newPattern the new pattern string
      * @see #applyPattern
      */
     public ChoiceFormat(String newPattern)  {
@@ -313,6 +317,9 @@
 
     /**
      * Constructs with the limits and the corresponding formats.
+     *
+     * @param limits limits in ascending order
+     * @param formats corresponding format strings
      * @see #setChoices
      */
     public ChoiceFormat(double[] limits, String[] formats) {
@@ -322,9 +329,9 @@
     /**
      * Set the choices to be used in formatting.
      * @param limits contains the top value that you want
-     * parsed with that format,and should be in ascending sorted order. When
+     * parsed with that format, and should be in ascending sorted order. When
      * formatting X, the choice will be the i, where
-     * limit[i] &lt;= X &lt; limit[i+1].
+     * limit[i] &le; X {@literal <} limit[i+1].
      * If the limit array is not in ascending order, the results of formatting
      * will be incorrect.
      * @param formats are the formats you want to use for each limit.
@@ -374,7 +381,7 @@
 
     /**
      * Returns pattern with formatted double.
-     * @param number number to be formatted & substituted.
+     * @param number number to be formatted and substituted.
      * @param toAppendTo where text is appended.
      * @param status ignore no useful status is returned.
      */
@@ -400,7 +407,7 @@
      * @param status an input-output parameter.  On input, the
      * status.index field indicates the first character of the
      * source text that should be parsed.  On exit, if no error
-     * occured, status.index is set to the first unparsed character
+     * occurred, status.index is set to the first unparsed character
      * in the source text.  On exit, if an error did occur,
      * status.index is unchanged and status.errorIndex is set to the
      * first index of the character that caused the parse to fail.
@@ -432,9 +439,12 @@
     }
 
     /**
-     * Finds the least double greater than d.
-     * If NaN, returns same value.
+     * Finds the least double greater than {@code d}.
+     * If {@code NaN}, returns same value.
      * <p>Used to make half-open intervals.
+     *
+     * @param d the reference value
+     * @return the least double value greather than {@code d}
      * @see #previousDouble
      */
     public static final double nextDouble (double d) {
@@ -442,8 +452,11 @@
     }
 
     /**
-     * Finds the greatest double less than d.
-     * If NaN, returns same value.
+     * Finds the greatest double less than {@code d}.
+     * If {@code NaN}, returns same value.
+     *
+     * @param d the reference value
+     * @return the greatest double value less than {@code d}
      * @see #nextDouble
      */
     public static final double previousDouble (double d) {
@@ -551,15 +564,21 @@
     static final long POSITIVEINFINITY    = 0x7FF0000000000000L;
 
     /**
-     * Finds the least double greater than d (if positive == true),
-     * or the greatest double less than d (if positive == false).
-     * If NaN, returns same value.
+     * Finds the least double greater than {@code d} (if {@code positive} is
+     * {@code true}), or the greatest double less than {@code d} (if
+     * {@code positive} is {@code false}).
+     * If {@code NaN}, returns same value.
      *
      * Does not affect floating-point flags,
      * provided these member functions do not:
      *          Double.longBitsToDouble(long)
      *          Double.doubleToLongBits(double)
      *          Double.isNaN(double)
+     *
+     * @param d        the reference value
+     * @param positive {@code true} if the least double is desired;
+     *                 {@code false} otherwise
+     * @return the least or greater double value
      */
     public static double nextDouble (double d, boolean positive) {
 
diff --git a/ojluni/src/main/java/java/text/CollationElementIterator.java b/ojluni/src/main/java/java/text/CollationElementIterator.java
index 18fc961..ad31f4a 100755
--- a/ojluni/src/main/java/java/text/CollationElementIterator.java
+++ b/ojluni/src/main/java/java/text/CollationElementIterator.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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,14 +50,14 @@
  * For example, consider the following in Spanish:
  * <blockquote>
  * <pre>
- * "ca" -> the first key is key('c') and second key is key('a').
- * "cha" -> the first key is key('ch') and second key is key('a').
+ * "ca" &rarr; the first key is key('c') and second key is key('a').
+ * "cha" &rarr; the first key is key('ch') and second key is key('a').
  * </pre>
  * </blockquote>
  * And in German,
  * <blockquote>
  * <pre>
- * "\u00e4b"-> the first key is key('a'), the second key is key('e'), and
+ * "\u00e4b" &rarr; the first key is key('a'), the second key is key('e'), and
  * the third key is key('b').
  * </pre>
  * </blockquote>
@@ -101,7 +101,8 @@
  * @see                RuleBasedCollator
  * @author             Helena Shih, Laura Werner, Richard Gillam
  */
-public final class CollationElementIterator {
+public final class CollationElementIterator
+{
     /**
      * Null order which indicates the end of string is reached by the
      * cursor.
@@ -118,7 +119,8 @@
      * Resets the cursor to the beginning of the string.  The next call
      * to next() will return the first collation element in the string.
      */
-    public void reset() {
+    public void reset()
+    {
         icuIterator.reset();
     }
 
@@ -135,8 +137,11 @@
      * means that when you change direction while iterating (i.e., call next() and
      * then call previous(), or call previous() and then call next()), you'll get
      * back the same element twice.</p>
+     *
+     * @return the next collation element
      */
-    public int next() {
+    public int next()
+    {
         return icuIterator.next();
     }
 
@@ -154,61 +159,43 @@
      * iterating (i.e., call next() and then call previous(), or call previous()
      * and then call next()), you'll get back the same element twice.</p>
      *
+     * @return the previous collation element
      * @since 1.2
      */
-    public int previous() {
+    public int previous()
+    {
         return icuIterator.previous();
     }
 
     /**
      * Return the primary component of a collation element.
-     *
      * @param order the collation element
      * @return the element's primary component
      */
-    public final static int primaryOrder(int order) {
+    public final static int primaryOrder(int order)
+    {
         return android.icu.text.CollationElementIterator.primaryOrder(order);
     }
-
     /**
      * Return the secondary component of a collation element.
-     *
      * @param order the collation element
      * @return the element's secondary component
      */
-    public final static short secondaryOrder(int order) {
-        return (short) android.icu.text.CollationElementIterator.secondaryOrder(order);
+    public final static short secondaryOrder(int order)
+    {
+       return (short) android.icu.text.CollationElementIterator.secondaryOrder(order);
     }
-
     /**
      * Return the tertiary component of a collation element.
-     *
      * @param order the collation element
      * @return the element's tertiary component
      */
-    public final static short tertiaryOrder(int order) {
+    public final static short tertiaryOrder(int order)
+    {
         return (short) android.icu.text.CollationElementIterator.tertiaryOrder(order);
     }
 
     /**
-     * Returns the character offset in the original text corresponding to the next
-     * collation element.  (That is, getOffset() returns the position in the text
-     * corresponding to the collation element that will be returned by the next
-     * call to next().)  This value will always be the index of the FIRST character
-     * corresponding to the collation element (a contracting character sequence is
-     * when two or more characters all correspond to the same collation element).
-     * This means if you do setOffset(x) followed immediately by getOffset(), getOffset()
-     * won't necessarily return x.
-     *
-     * @return The character offset in the original text corresponding to the collation
-     * element that will be returned by the next call to next().
-     * @since 1.2
-     */
-    public int getOffset() {
-        return icuIterator.getOffset();
-    }
-
-    /**
      * Sets the iterator to point to the collation element corresponding to
      * the specified character (the parameter is a CHARACTER offset in the
      * original string, not an offset into its corresponding sequence of
@@ -223,40 +210,63 @@
      * @param newOffset The new character offset into the original text.
      * @since 1.2
      */
-    public void setOffset(int newOffset) {
+    @SuppressWarnings("deprecation") // getBeginIndex, getEndIndex and setIndex are deprecated
+    public void setOffset(int newOffset)
+    {
         icuIterator.setOffset(newOffset);
     }
 
     /**
+     * Returns the character offset in the original text corresponding to the next
+     * collation element.  (That is, getOffset() returns the position in the text
+     * corresponding to the collation element that will be returned by the next
+     * call to next().)  This value will always be the index of the FIRST character
+     * corresponding to the collation element (a contracting character sequence is
+     * when two or more characters all correspond to the same collation element).
+     * This means if you do setOffset(x) followed immediately by getOffset(), getOffset()
+     * won't necessarily return x.
+     *
+     * @return The character offset in the original text corresponding to the collation
+     * element that will be returned by the next call to next().
+     * @since 1.2
+     */
+    public int getOffset()
+    {
+        return icuIterator.getOffset();
+    }
+
+    /**
      * Return the maximum length of any expansion sequences that end
      * with the specified comparison order.
-     *
      * @param order a collation order returned by previous or next.
      * @return the maximum length of any expansion sequences ending
-     * with the specified order.
+     *         with the specified order.
      * @since 1.2
      */
-    public int getMaxExpansion(int order) {
+    public int getMaxExpansion(int order)
+    {
         return icuIterator.getMaxExpansion(order);
     }
 
     /**
      * Set a new string over which to iterate.
      *
-     * @param source the new source text
+     * @param source  the new source text
      * @since 1.2
      */
-    public void setText(String source) {
+    public void setText(String source)
+    {
         icuIterator.setText(source);
     }
 
     /**
      * Set a new string over which to iterate.
      *
-     * @param source the new source text.
+     * @param source  the new source text.
      * @since 1.2
      */
-    public void setText(CharacterIterator source) {
+    public void setText(CharacterIterator source)
+    {
         icuIterator.setText(source);
     }
 }
diff --git a/ojluni/src/main/java/java/text/CollationKey.java b/ojluni/src/main/java/java/text/CollationKey.java
index 9c71e2f..d4c7751 100755
--- a/ojluni/src/main/java/java/text/CollationKey.java
+++ b/ojluni/src/main/java/java/text/CollationKey.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
@@ -68,28 +68,28 @@
  * The following example shows how <code>CollationKey</code>s might be used
  * to sort a list of <code>String</code>s.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * // Create an array of CollationKeys for the Strings to be sorted.
  * Collator myCollator = Collator.getInstance();
  * CollationKey[] keys = new CollationKey[3];
  * keys[0] = myCollator.getCollationKey("Tom");
  * keys[1] = myCollator.getCollationKey("Dick");
  * keys[2] = myCollator.getCollationKey("Harry");
- * sort( keys );
- * <br>
+ * sort(keys);
+ *
  * //...
- * <br>
+ *
  * // Inside body of sort routine, compare keys this way
- * if( keys[i].compareTo( keys[j] ) > 0 )
+ * if (keys[i].compareTo(keys[j]) > 0)
  *    // swap keys[i] and keys[j]
- * <br>
+ *
  * //...
- * <br>
+ *
  * // Finally, when we've returned from sort.
- * System.out.println( keys[0].getSourceString() );
- * System.out.println( keys[1].getSourceString() );
- * System.out.println( keys[2].getSourceString() );
- * </pre>
+ * System.out.println(keys[0].getSourceString());
+ * System.out.println(keys[1].getSourceString());
+ * System.out.println(keys[2].getSourceString());
+ * }</pre>
  * </blockquote>
  *
  * @see          Collator
@@ -112,6 +112,8 @@
 
     /**
      * Returns the String that this CollationKey represents.
+     *
+     * @return the source string of this CollationKey
      */
     public String getSourceString() {
         return source;
@@ -123,6 +125,8 @@
      * could be legitimately compared, then one could compare the byte arrays
      * for each of those keys to obtain the same result.  Byte arrays are
      * organized most significant byte first.
+     *
+     * @return a byte array representation of the CollationKey
      */
     abstract public byte[] toByteArray();
 
@@ -130,8 +134,8 @@
   /**
    * CollationKey constructor.
    *
-   * @param source - the source string.
-   * @exception NullPointerException if <code>source</code> is null.
+   * @param source the source string
+   * @exception NullPointerException if {@code source} is null
    * @since 1.6
    */
     protected CollationKey(String source) {
diff --git a/ojluni/src/main/java/java/text/Collator.java b/ojluni/src/main/java/java/text/Collator.java
index e442115..478074c 100755
--- a/ojluni/src/main/java/java/text/Collator.java
+++ b/ojluni/src/main/java/java/text/Collator.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * 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
@@ -67,14 +67,14 @@
  * The following example shows how to compare two strings using
  * the <code>Collator</code> for the default locale.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * // Compare two strings in the default locale
  * Collator myCollator = Collator.getInstance();
  * if( myCollator.compare("abc", "ABC") < 0 )
  *     System.out.println("abc is less than ABC");
  * else
  *     System.out.println("abc is greater than or equal to ABC");
- * </pre>
+ * }</pre>
  * </blockquote>
  *
  * <p>
@@ -121,13 +121,13 @@
  */
 
 public abstract class Collator
-        implements java.util.Comparator<Object>, Cloneable {
+    implements java.util.Comparator<Object>, Cloneable
+{
     /**
      * Collator strength value.  When set, only PRIMARY differences are
      * considered significant during comparison. The assignment of strengths
      * to language features is locale dependant. A common example is for
      * different base letters ("a" vs "b") to be considered a PRIMARY difference.
-     *
      * @see java.text.Collator#setStrength
      * @see java.text.Collator#getStrength
      */
@@ -138,7 +138,6 @@
      * to language features is locale dependant. A common example is for
      * different accented forms of the same base letter ("a" vs "\u00E4") to be
      * considered a SECONDARY difference.
-     *
      * @see java.text.Collator#setStrength
      * @see java.text.Collator#getStrength
      */
@@ -148,7 +147,6 @@
      * considered significant during comparison. The assignment of strengths
      * to language features is locale dependant. A common example is for
      * case differences ("a" vs "A") to be considered a TERTIARY difference.
-     *
      * @see java.text.Collator#setStrength
      * @see java.text.Collator#getStrength
      */
@@ -172,7 +170,6 @@
      * set, accented characters will not be decomposed for collation. This
      * is the default setting and provides the fastest collation but
      * will only produce correct results for languages that do not use accents.
-     *
      * @see java.text.Collator#getDecomposition
      * @see java.text.Collator#setDecomposition
      */
@@ -188,7 +185,6 @@
      * described in
      * <a href="http://www.unicode.org/unicode/reports/tr15/tr15-23.html">Unicode
      * Technical Report #15</a>.
-     *
      * @see java.text.Collator#getDecomposition
      * @see java.text.Collator#setDecomposition
      */
@@ -208,33 +204,14 @@
      * described in
      * <a href="http://www.unicode.org/unicode/reports/tr15/tr15-23.html">Unicode
      * Technical Report #15</a>.
-     *
      * @see java.text.Collator#getDecomposition
      * @see java.text.Collator#setDecomposition
      */
     public final static int FULL_DECOMPOSITION = 2;
 
-    android.icu.text.Collator icuColl;
-
-    Collator(android.icu.text.Collator icuColl) {
-        this.icuColl = icuColl;
-    }
-
-    /**
-     * Default constructor.  This constructor is
-     * protected so subclasses can get access to it. Users typically create
-     * a Collator sub-class by calling the factory method getInstance.
-     *
-     * @see java.text.Collator#getInstance
-     */
-    protected Collator() {
-        icuColl = android.icu.text.RuleBasedCollator.getInstance(Locale.getDefault());
-    }
-
     /**
      * Gets the Collator for the current default locale.
      * The default locale is determined by java.util.Locale.getDefault.
-     *
      * @return the Collator for the default locale.(for example, en_US)
      * @see java.util.Locale#getDefault
      */
@@ -244,13 +221,14 @@
 
     /**
      * Gets the Collator for the desired locale.
-     *
      * @param desiredLocale the desired locale.
      * @return the Collator for the desired locale.
      * @see java.util.Locale
      * @see java.util.ResourceBundle
      */
-    public static synchronized Collator getInstance(Locale desiredLocale) {
+    public static synchronized
+    Collator getInstance(Locale desiredLocale)
+    {
         if (desiredLocale == null) {
             throw new NullPointerException("locale == null");
         }
@@ -259,41 +237,6 @@
     }
 
     /**
-     * Returns an array of all locales for which the
-     * <code>getInstance</code> methods of this class can return
-     * localized instances.
-     * The returned array represents the union of locales supported
-     * by the Java runtime and by installed
-     * {@link java.text.spi.CollatorProvider CollatorProvider} implementations.
-     * It must contain at least a Locale instance equal to
-     * {@link java.util.Locale#US Locale.US}.
-     *
-     * @return An array of locales for which localized
-     * <code>Collator</code> instances are available.
-     */
-    public static synchronized Locale[] getAvailableLocales() {
-        return ICU.getAvailableCollatorLocales();
-    }
-
-    /**
-     * Returns a new collator with the same decomposition mode and
-     * strength value as this collator.
-     *
-     * @return a shallow copy of this collator.
-     * @see java.lang.Cloneable
-     */
-    @Override
-    public Object clone() {
-        try {
-            Collator clone = (Collator) super.clone();
-            clone.icuColl = (android.icu.text.Collator) icuColl.clone();
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /**
      * Compares the source string to the target string according to the
      * collation rules for this Collator.  Returns an integer less than,
      * equal to or greater than zero depending on whether the source String is
@@ -304,7 +247,6 @@
      * given String will be involved in multiple comparisons, CollationKey.compareTo
      * has the best performance. See the Collator class description for an example
      * using CollationKeys.
-     *
      * @param source the source string.
      * @param target the target string.
      * @return Returns an integer value. Value is less than zero if source is less than
@@ -321,17 +263,18 @@
      * to, or greater than the second.
      * <p>
      * This implementation merely returns
-     * <code> compare((String)o1, (String)o2) </code>.
+     *  <code> compare((String)o1, (String)o2) </code>.
      *
      * @return a negative integer, zero, or a positive integer as the
-     * first argument is less than, equal to, or greater than the
-     * second.
-     * @throws ClassCastException the arguments cannot be cast to Strings.
+     *         first argument is less than, equal to, or greater than the
+     *         second.
+     * @exception ClassCastException the arguments cannot be cast to Strings.
      * @see java.util.Comparator
-     * @since 1.2
+     * @since   1.2
      */
+    @Override
     public int compare(Object o1, Object o2) {
-        return compare((String) o1, (String) o2);
+    return compare((String)o1, (String)o2);
     }
 
     /**
@@ -339,7 +282,6 @@
      * to other CollationKeys. CollationKeys provide better performance than
      * Collator.compare when Strings are involved in multiple comparisons.
      * See the Collator class description for an example using CollationKeys.
-     *
      * @param source the string to be transformed into a collation key.
      * @return the CollationKey for the given String based on this Collator's collation
      * rules. If the source String is null, a null CollationKey is returned.
@@ -351,14 +293,14 @@
     /**
      * Convenience method for comparing the equality of two strings based on
      * this Collator's collation rules.
-     *
      * @param source the source string to be compared with.
      * @param target the target string to be compared with.
      * @return true if the strings are equal according to the collation
      * rules.  false, otherwise.
      * @see java.text.Collator#compare
      */
-    public boolean equals(String source, String target) {
+    public boolean equals(String source, String target)
+    {
         return (compare(source, target) == 0);
     }
 
@@ -366,7 +308,6 @@
      * Returns this Collator's strength property.  The strength property determines
      * the minimum level of difference considered significant during comparison.
      * See the Collator class description for an example of use.
-     *
      * @return this Collator's current strength property.
      * @see java.text.Collator#setStrength
      * @see java.text.Collator#PRIMARY
@@ -374,7 +315,8 @@
      * @see java.text.Collator#TERTIARY
      * @see java.text.Collator#IDENTICAL
      */
-    public synchronized int getStrength() {
+    public synchronized int getStrength()
+    {
         // The value for IDENTICAL in ICU differs from that used in this class.
         int value = icuColl.getStrength();
         return (value == android.icu.text.Collator.IDENTICAL) ? IDENTICAL : value;
@@ -384,15 +326,14 @@
      * Sets this Collator's strength property.  The strength property determines
      * the minimum level of difference considered significant during comparison.
      * See the Collator class description for an example of use.
-     *
-     * @param newStrength the new strength value.
-     * @throws IllegalArgumentException If the new strength value is not one of
-     *                                  PRIMARY, SECONDARY, TERTIARY or IDENTICAL.
-     * @see Collator#getStrength
-     * @see Collator#PRIMARY
-     * @see Collator#SECONDARY
-     * @see Collator#TERTIARY
-     * @see Collator#IDENTICAL
+     * @param newStrength  the new strength value.
+     * @see java.text.Collator#getStrength
+     * @see java.text.Collator#PRIMARY
+     * @see java.text.Collator#SECONDARY
+     * @see java.text.Collator#TERTIARY
+     * @see java.text.Collator#IDENTICAL
+     * @exception  IllegalArgumentException If the new strength value is not one of
+     * PRIMARY, SECONDARY, TERTIARY or IDENTICAL.
      */
     public synchronized void setStrength(int newStrength) {
         // The ICU value for IDENTICAL differs from that defined in this class.
@@ -415,33 +356,48 @@
      * </UL>
      * See the documentation for these three constants for a description
      * of their meaning.
-     *
      * @return the decomposition mode
      * @see java.text.Collator#setDecomposition
      * @see java.text.Collator#NO_DECOMPOSITION
      * @see java.text.Collator#CANONICAL_DECOMPOSITION
      * @see java.text.Collator#FULL_DECOMPOSITION
      */
-    public synchronized int getDecomposition() {
+    public synchronized int getDecomposition()
+    {
         return decompositionMode_ICU_Java(icuColl.getDecomposition());
     }
-
     /**
      * Set the decomposition mode of this Collator. See getDecomposition
      * for a description of decomposition mode.
-     *
-     * @param decompositionMode the new decomposition mode.
-     * @throws IllegalArgumentException If the given value is not a valid decomposition
-     *                                  mode.
+     * @param decompositionMode  the new decomposition mode.
      * @see java.text.Collator#getDecomposition
      * @see java.text.Collator#NO_DECOMPOSITION
      * @see java.text.Collator#CANONICAL_DECOMPOSITION
      * @see java.text.Collator#FULL_DECOMPOSITION
+     * @exception IllegalArgumentException If the given value is not a valid decomposition
+     * mode.
      */
     public synchronized void setDecomposition(int decompositionMode) {
         icuColl.setDecomposition(decompositionMode_Java_ICU(decompositionMode));
     }
 
+    /**
+     * Returns an array of all locales for which the
+     * <code>getInstance</code> methods of this class can return
+     * localized instances.
+     * The returned array represents the union of locales supported
+     * by the Java runtime and by installed
+     * {@link java.text.spi.CollatorProvider CollatorProvider} implementations.
+     * It must contain at least a Locale instance equal to
+     * {@link java.util.Locale#US Locale.US}.
+     *
+     * @return An array of locales for which localized
+     *         <code>Collator</code> instances are available.
+     */
+    public static synchronized Locale[] getAvailableLocales() {
+        return ICU.getAvailableCollatorLocales();
+    }
+
     private int decompositionMode_Java_ICU(int mode) {
         switch (mode) {
             case Collator.CANONICAL_DECOMPOSITION:
@@ -466,16 +422,42 @@
     }
 
     /**
-     * Compares the equality of two Collators.
+     * Returns a new collator with the same decomposition mode and
+     * strength value as this collator.
      *
+     * @return a shallow copy of this collator.
+     * @see java.lang.Cloneable
+     */
+    @Override
+    public Object clone()
+    {
+        try {
+            Collator clone = (Collator) super.clone();
+            clone.icuColl = (android.icu.text.Collator) icuColl.clone();
+            return clone;
+        } catch (CloneNotSupportedException e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    /**
+     * Compares the equality of two Collators.
      * @param that the Collator to be compared with this.
      * @return true if this Collator is the same as that Collator;
      * false otherwise.
      */
-    public boolean equals(Object that) {
-        if (this == that) return true;
-        if (that == null) return false;
-        if (getClass() != that.getClass()) return false;
+    @Override
+    public boolean equals(Object that)
+    {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
         Collator other = (Collator) that;
         return icuColl == null ? other.icuColl == null : icuColl.equals(other.icuColl);
     }
@@ -483,5 +465,23 @@
     /**
      * Generates the hash code for this Collator.
      */
+    @Override
     abstract public int hashCode();
+
+    /**
+     * Default constructor.  This constructor is
+     * protected so subclasses can get access to it. Users typically create
+     * a Collator sub-class by calling the factory method getInstance.
+     * @see java.text.Collator#getInstance
+     */
+    protected Collator()
+    {
+        icuColl = android.icu.text.RuleBasedCollator.getInstance(Locale.getDefault());
+    }
+
+    android.icu.text.Collator icuColl;
+
+    Collator(android.icu.text.Collator icuColl) {
+        this.icuColl = icuColl;
+    }
 }
diff --git a/ojluni/src/main/java/java/text/DateFormat.java b/ojluni/src/main/java/java/text/DateFormat.java
index 0e841dd..6d7c956 100755
--- a/ojluni/src/main/java/java/text/DateFormat.java
+++ b/ojluni/src/main/java/java/text/DateFormat.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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,7 +57,7 @@
  * {@code DateFormat} is an abstract class for date/time formatting subclasses which
  * formats and parses dates or time in a language-independent manner.
  * The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for
- * formatting (i.e., date -> text), parsing (text -> date), and
+ * formatting (i.e., date &rarr; text), parsing (text &rarr; date), and
  * normalization.  The date is represented as a <code>Date</code> object or
  * as the milliseconds since January 1, 1970, 00:00:00 GMT.
  *
@@ -73,28 +73,36 @@
  *
  * <p>To format a date for the current Locale, use one of the
  * static factory methods:
- * <pre>
- *  myString = DateFormat.getDateInstance().format(myDate);
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * myString = DateFormat.getDateInstance().format(myDate);
+ * }</pre>
+ * </blockquote>
  * <p>If you are formatting multiple dates, it is
  * more efficient to get the format and use it multiple times so that
  * the system doesn't have to fetch the information about the local
  * language and country conventions multiple times.
- * <pre>
- *  DateFormat df = DateFormat.getDateInstance();
- *  for (int i = 0; i < myDate.length; ++i) {
- *    output.println(df.format(myDate[i]) + "; ");
- *  }
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * DateFormat df = DateFormat.getDateInstance();
+ * for (int i = 0; i < myDate.length; ++i) {
+ *     output.println(df.format(myDate[i]) + "; ");
+ * }
+ * }</pre>
+ * </blockquote>
  * <p>To format a date for a different Locale, specify it in the
  * call to {@link #getDateInstance(int, Locale) getDateInstance()}.
- * <pre>
- *  DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
+ * }</pre>
+ * </blockquote>
  * <p>You can use a DateFormat to parse also.
- * <pre>
- *  myDate = df.parse(myString);
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * myDate = df.parse(myString);
+ * }</pre>
+ * </blockquote>
  * <p>Use {@code getDateInstance} to get the normal date format for that country.
  * There are other static factory methods available.
  * Use {@code getTimeInstance} to get the time format for that country.
@@ -125,7 +133,7 @@
  * on the screen.
  * </ul>
  *
- * <h4><a name="synchronization">Synchronization</a></h4>
+ * <h3><a name="synchronization">Synchronization</a></h3>
  *
  * <p>
  * Date formats are not synchronized.
@@ -439,7 +447,12 @@
 
     /**
      * Gets the time formatter with the default formatting style
-     * for the default locale.
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getTimeInstance(int, Locale) getTimeInstance(DEFAULT,
+     *     Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @return a time formatter.
      */
     public final static DateFormat getTimeInstance()
@@ -449,7 +462,12 @@
 
     /**
      * Gets the time formatter with the given formatting style
-     * for the default locale.
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getTimeInstance(int, Locale) getTimeInstance(style,
+     *     Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @param style the given formatting style. For example,
      * SHORT for "h:mm a" in the US locale.
      * @return a time formatter.
@@ -475,7 +493,12 @@
 
     /**
      * Gets the date formatter with the default formatting style
-     * for the default locale.
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getDateInstance(int, Locale) getDateInstance(DEFAULT,
+     *     Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @return a date formatter.
      */
     public final static DateFormat getDateInstance()
@@ -485,7 +508,12 @@
 
     /**
      * Gets the date formatter with the given formatting style
-     * for the default locale.
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getDateInstance(int, Locale) getDateInstance(style,
+     *     Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @param style the given formatting style. For example,
      * SHORT for "M/d/yy" in the US locale.
      * @return a date formatter.
@@ -511,7 +539,12 @@
 
     /**
      * Gets the date/time formatter with the default formatting style
-     * for the default locale.
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getDateTimeInstance(int, int, Locale) getDateTimeInstance(DEFAULT,
+     *     DEFAULT, Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @return a date/time formatter.
      */
     public final static DateFormat getDateTimeInstance()
@@ -521,7 +554,12 @@
 
     /**
      * Gets the date/time formatter with the given date and time
-     * formatting styles for the default locale.
+     * formatting styles for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getDateTimeInstance(int, int, Locale) getDateTimeInstance(dateStyle,
+     *     timeStyle, Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @param dateStyle the given date formatting style. For example,
      * SHORT for "M/d/yy" in the US locale.
      * @param timeStyle the given time formatting style. For example,
@@ -551,6 +589,8 @@
     /**
      * Get a default date/time formatter that uses the SHORT style for both the
      * date and the time.
+     *
+     * @return a date/time formatter
      */
     public final static DateFormat getInstance() {
         return getDateTimeInstance(SHORT, SHORT);
@@ -633,9 +673,9 @@
     /**
      * Sets the time zone for the calendar of this {@code DateFormat} object.
      * This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().setTimeZone(zone)
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().setTimeZone(zone)
+     * }</pre></blockquote>
      *
      * <p>The {@code TimeZone} set by this method is overwritten by a
      * {@link #setCalendar(java.util.Calendar) setCalendar} call.
@@ -653,9 +693,9 @@
     /**
      * Gets the time zone.
      * This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().getTimeZone()
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().getTimeZone()
+     * }</pre></blockquote>
      *
      * @return the time zone associated with the calendar of DateFormat.
      */
@@ -671,9 +711,9 @@
      * inputs must match this object's format.
      *
      * <p>This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().setLenient(lenient)
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().setLenient(lenient)
+     * }</pre></blockquote>
      *
      * <p>This leniency value is overwritten by a call to {@link
      * #setCalendar(java.util.Calendar) setCalendar()}.
@@ -689,9 +729,9 @@
     /**
      * Tell whether date/time parsing is to be lenient.
      * This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().isLenient()
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().isLenient()
+     * }</pre></blockquote>
      *
      * @return {@code true} if the {@link #calendar} is lenient;
      *         {@code false} otherwise.
@@ -809,7 +849,7 @@
         private static final long serialVersionUID = 7441350119349544720L;
 
         // table of all instances in this class, used by readResolve
-        private static final Map instanceMap = new HashMap(18);
+        private static final Map<String, Field> instanceMap = new HashMap<>(18);
         // Maps from Calendar constant (such as Calendar.ERA) to Field
         // constant (such as Field.ERA).
         private static final Field[] calendarToFieldMapping =
@@ -882,6 +922,7 @@
          *         resolved.
          * @return resolved DateFormat.Field constant
          */
+        @Override
         protected Object readResolve() throws InvalidObjectException {
             if (this.getClass() != DateFormat.Field.class) {
                 throw new InvalidObjectException("subclass didn't correctly implement readResolve");
diff --git a/ojluni/src/main/java/java/text/DateFormatSymbols.java b/ojluni/src/main/java/java/text/DateFormatSymbols.java
index 0297205..1e591e0 100755
--- a/ojluni/src/main/java/java/text/DateFormatSymbols.java
+++ b/ojluni/src/main/java/java/text/DateFormatSymbols.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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
@@ -59,7 +59,7 @@
  * <code>DateFormatSymbols</code> is a public class for encapsulating
  * localizable date-time formatting data, such as the names of the
  * months, the names of the days of the week, and the time zone data.
- * <code>DateFormat</code> and <code>SimpleDateFormat</code> both use
+ * <code>SimpleDateFormat</code> uses
  * <code>DateFormatSymbols</code> to encapsulate this information.
  *
  * <p>
@@ -104,14 +104,19 @@
 
     /**
      * Construct a DateFormatSymbols object by loading format data from
-     * resources for the default locale. This constructor can only
+     * resources for the default {@link java.util.Locale.Category#FORMAT FORMAT}
+     * locale. This constructor can only
      * construct instances for the locales supported by the Java
      * runtime environment, not for those supported by installed
      * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
      * implementations. For full locale coverage, use the
      * {@link #getInstance(Locale) getInstance} method.
-     *
+     * <p>This is equivalent to calling
+     * {@link #DateFormatSymbols(Locale)
+     *     DateFormatSymbols(Locale.getDefault(Locale.Category.FORMAT))}.
      * @see #getInstance()
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @exception  java.util.MissingResourceException
      *             if the resources for the default locale cannot be
      *             found or cannot be loaded.
@@ -130,6 +135,7 @@
      * implementations. For full locale coverage, use the
      * {@link #getInstance(Locale) getInstance} method.
      *
+     * @param locale the desired locale
      * @see #getInstance(Locale)
      * @exception  java.util.MissingResourceException
      *             if the resources for the specified locale cannot be
@@ -381,6 +387,10 @@
      * as for those supported by installed
      * {@link java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider}
      * implementations.
+     * <p>This is equivalent to calling {@link #getInstance(Locale)
+     *     getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @return a <code>DateFormatSymbols</code> instance.
      * @since 1.6
      */
@@ -708,7 +718,7 @@
             copyMembers(this, other);
             return other;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
@@ -716,6 +726,7 @@
      * Override hashCode.
      * Generates a hash code for the DateFormatSymbols object.
      */
+    @Override
     public int hashCode() {
         int hashcode = 0;
         String[][] zoneStrings = getZoneStringsWrapper();
@@ -901,7 +912,7 @@
         return aCopy;
     }
 
-    private final boolean isSubclassObject() {
+    private boolean isSubclassObject() {
         return !getClass().getName().equals("java.text.DateFormatSymbols");
     }
 
@@ -911,7 +922,7 @@
      * @param src the source DateFormatSymbols.
      * @param dst the target DateFormatSymbols.
      */
-    private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst)
+    private void copyMembers(DateFormatSymbols src, DateFormatSymbols dst)
     {
         dst.eras = Arrays.copyOf(src.eras, src.eras.length);
         dst.months = Arrays.copyOf(src.months, src.months.length);
diff --git a/ojluni/src/main/java/java/text/DecimalFormat.java b/ojluni/src/main/java/java/text/DecimalFormat.java
index 0ea60b8..3ceb9cd 100755
--- a/ojluni/src/main/java/java/text/DecimalFormat.java
+++ b/ojluni/src/main/java/java/text/DecimalFormat.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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
@@ -87,7 +87,7 @@
  * the <code>NumberFormat</code> factory methods, the pattern and symbols are
  * read from localized <code>ResourceBundle</code>s.
  *
- * <h4>Patterns</h4>
+ * <h3>Patterns</h3>
  *
  * <code>DecimalFormat</code> patterns have the following syntax:
  * <blockquote><pre>
@@ -174,7 +174,7 @@
  * <blockquote>
  * <table border=0 cellspacing=3 cellpadding=0 summary="Chart showing symbol,
  *  location, localized, and meaning.">
- *     <tr bgcolor="#ccccff">
+ *     <tr style="background-color: rgb(204, 204, 255);">
  *          <th align=left>Symbol
  *          <th align=left>Location
  *          <th align=left>Localized?
@@ -184,7 +184,7 @@
  *          <td>Number
  *          <td>Yes
  *          <td>Digit
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>#</code>
  *          <td>Number
  *          <td>Yes
@@ -194,7 +194,7 @@
  *          <td>Number
  *          <td>Yes
  *          <td>Decimal separator or monetary decimal separator
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>-</code>
  *          <td>Number
  *          <td>Yes
@@ -204,7 +204,7 @@
  *          <td>Number
  *          <td>Yes
  *          <td>Grouping separator
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>E</code>
  *          <td>Number
  *          <td>Yes
@@ -215,7 +215,7 @@
  *          <td>Subpattern boundary
  *          <td>Yes
  *          <td>Separates positive and negative subpatterns
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>%</code>
  *          <td>Prefix or suffix
  *          <td>Yes
@@ -225,7 +225,7 @@
  *          <td>Prefix or suffix
  *          <td>Yes
  *          <td>Multiply by 1000 and show as per mille value
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>&#164;</code> (<code>&#92;u00A4</code>)
  *          <td>Prefix or suffix
  *          <td>No
@@ -248,7 +248,8 @@
  *
  * <p>Numbers in scientific notation are expressed as the product of a mantissa
  * and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3.  The
- * mantissa is often in the range 1.0 <= x < 10.0, but it need not be.
+ * mantissa is often in the range 1.0 &le; x {@literal <} 10.0, but it need not
+ * be.
  * <code>DecimalFormat</code> can be instructed to format and parse scientific
  * notation <em>only via a pattern</em>; there is currently no factory method
  * that creates a scientific notation format.  In a pattern, the exponent
@@ -336,13 +337,13 @@
  *
  * <h4>Example</h4>
  *
- * <blockquote><pre>
+ * <blockquote><pre>{@code
  * <strong>// Print out a number using the localized number, integer, currency,
  * // and percent format for each locale</strong>
  * Locale[] locales = NumberFormat.getAvailableLocales();
  * double myNumber = -1234.56;
  * NumberFormat form;
- * for (int j=0; j<4; ++j) {
+ * for (int j = 0; j < 4; ++j) {
  *     System.out.println("FORMAT");
  *     for (int i = 0; i < locales.length; ++i) {
  *         if (locales[i].getCountry().length() == 0) {
@@ -368,9 +369,9 @@
  *         } catch (ParseException e) {}
  *     }
  * }
- * </pre></blockquote>
+ * }</pre></blockquote>
  *
- * @see          <a href="http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html">Java Tutorial</a>
+ * @see          <a href="https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html">Java Tutorial</a>
  * @see          NumberFormat
  * @see          DecimalFormatSymbols
  * @see          ParsePosition
@@ -383,7 +384,8 @@
 
     /**
      * Creates a DecimalFormat using the default pattern and symbols
-     * for the default locale. This is a convenient way to obtain a
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * This is a convenient way to obtain a
      * DecimalFormat when internationalization is not the main concern.
      * <p>
      * To obtain standard formats for a given locale, use the factory methods
@@ -397,6 +399,7 @@
      * @see java.text.NumberFormat#getPercentInstance
      */
     public DecimalFormat() {
+        // Get the pattern for the default locale.
         Locale def = Locale.getDefault(Locale.Category.FORMAT);
         // try to get the pattern from the cache
         String pattern = cachedLocaleData.get(def);
@@ -413,7 +416,8 @@
 
     /**
      * Creates a DecimalFormat using the given pattern and the symbols
-     * for the default locale. This is a convenient way to obtain a
+     * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * This is a convenient way to obtain a
      * DecimalFormat when internationalization is not the main concern.
      * <p>
      * To obtain standard formats for a given locale, use the factory methods
@@ -421,7 +425,7 @@
      * return the most appropriate sub-class of NumberFormat for a given
      * locale.
      *
-     * @param pattern A non-localized pattern string.
+     * @param pattern a non-localized pattern string.
      * @exception NullPointerException if <code>pattern</code> is null
      * @exception IllegalArgumentException if the given pattern is invalid.
      * @see java.text.NumberFormat#getInstance
@@ -573,6 +577,7 @@
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see              java.text.FieldPosition
      */
+    @Override
     public final StringBuffer format(Object number,
                                      StringBuffer toAppendTo,
                                      FieldPosition pos) {
@@ -605,6 +610,7 @@
      * @return The formatted number string
      * @see java.text.FieldPosition
      */
+    @Override
     public StringBuffer format(double number, StringBuffer result,
                                FieldPosition fieldPosition) {
         FieldPosition icuFieldPosition = getIcuFieldPosition(fieldPosition);
@@ -625,6 +631,7 @@
      * @return The formatted number string
      * @see java.text.FieldPosition
      */
+    @Override
     public StringBuffer format(long number, StringBuffer result,
                                FieldPosition fieldPosition) {
         FieldPosition icuFieldPosition = getIcuFieldPosition(fieldPosition);
@@ -693,6 +700,7 @@
      * @return AttributedCharacterIterator describing the formatted value.
      * @since 1.4
      */
+    @Override
     public AttributedCharacterIterator formatToCharacterIterator(Object obj) {
         if (obj == null) {
             throw new NullPointerException("object == null");
@@ -785,6 +793,7 @@
      * @exception  NullPointerException if <code>text</code> or
      *             <code>pos</code> is null.
      */
+    @Override
     public Number parse(String text, ParsePosition pos) {
         // Return early if the parse position is bogus.
         if (pos.index < 0 || pos.index >= text.length()) {
@@ -851,6 +860,8 @@
     /**
      * Get the positive prefix.
      * <P>Examples: +123, $123, sFr123
+     *
+     * @return the positive prefix
      */
     public String getPositivePrefix () {
         return icuDecimalFormat.getPositivePrefix();
@@ -859,6 +870,8 @@
     /**
      * Set the positive prefix.
      * <P>Examples: +123, $123, sFr123
+     *
+     * @param newValue the new positive prefix
      */
     public void setPositivePrefix (String newValue) {
         icuDecimalFormat.setPositivePrefix(newValue);
@@ -867,6 +880,8 @@
     /**
      * Get the  prefix.
      * <P>Examples: -123, ($123) (with negative suffix), sFr-123
+     *
+     * @return the negative prefix
      */
     public String getNegativePrefix () {
         return icuDecimalFormat.getNegativePrefix();
@@ -875,6 +890,8 @@
     /**
      * Set the negative prefix.
      * <P>Examples: -123, ($123) (with negative suffix), sFr-123
+     *
+     * @param newValue the new negative prefix
      */
     public void setNegativePrefix (String newValue) {
         icuDecimalFormat.setNegativePrefix(newValue);
@@ -883,6 +900,8 @@
     /**
      * Get the positive suffix.
      * <P>Example: 123%
+     *
+     * @return the positive suffix
      */
     public String getPositiveSuffix () {
         return icuDecimalFormat.getPositiveSuffix();
@@ -891,6 +910,8 @@
     /**
      * Set the positive suffix.
      * <P>Example: 123%
+     *
+     * @param newValue the new positive suffix
      */
     public void setPositiveSuffix (String newValue) {
         icuDecimalFormat.setPositiveSuffix(newValue);
@@ -899,6 +920,8 @@
     /**
      * Get the negative suffix.
      * <P>Examples: -123%, ($123) (with positive suffixes)
+     *
+     * @return the negative suffix
      */
     public String getNegativeSuffix () {
         return icuDecimalFormat.getNegativeSuffix();
@@ -907,6 +930,8 @@
     /**
      * Set the negative suffix.
      * <P>Examples: 123%
+     *
+     * @param newValue the new negative suffix
      */
     public void setNegativeSuffix (String newValue) {
         icuDecimalFormat.setNegativeSuffix(newValue);
@@ -916,6 +941,7 @@
      * Gets the multiplier for use in percent, per mille, and similar
      * formats.
      *
+     * @return the multiplier
      * @see #setMultiplier(int)
      */
     public int getMultiplier () {
@@ -933,6 +959,7 @@
      * <P>Example: with multiplier 100, 1.23 is formatted as "123", and
      * "123" is parsed into 1.23.
      *
+     * @param newValue the new multiplier
      * @see #getMultiplier
      */
     public void setMultiplier (int newValue) {
@@ -943,6 +970,8 @@
      * Return the grouping size. Grouping size is the number of digits between
      * grouping separators in the integer portion of a number.  For example,
      * in the number "123,456.78", the grouping size is 3.
+     *
+     * @return the grouping size
      * @see #setGroupingSize
      * @see java.text.NumberFormat#isGroupingUsed
      * @see java.text.DecimalFormatSymbols#getGroupingSeparator
@@ -957,6 +986,8 @@
      * in the number "123,456.78", the grouping size is 3.
      * <br>
      * The value passed in is converted to a byte, which may lose information.
+     *
+     * @param newValue the new grouping size
      * @see #getGroupingSize
      * @see java.text.NumberFormat#setGroupingUsed
      * @see java.text.DecimalFormatSymbols#setGroupingSeparator
@@ -987,7 +1018,10 @@
     /**
      * Allows you to get the behavior of the decimal separator with integers.
      * (The decimal separator will always appear with decimals.)
-     * <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
+     * <P>Example: Decimal ON: 12345 &rarr; 12345.; OFF: 12345 &rarr; 12345
+     *
+     * @return {@code true} if the decimal separator is always shown;
+     *         {@code false} otherwise
      */
     public boolean isDecimalSeparatorAlwaysShown() {
         return icuDecimalFormat.isDecimalSeparatorAlwaysShown();
@@ -996,7 +1030,10 @@
     /**
      * Allows you to set the behavior of the decimal separator with integers.
      * (The decimal separator will always appear with decimals.)
-     * <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
+     * <P>Example: Decimal ON: 12345 &rarr; 12345.; OFF: 12345 &rarr; 12345
+     *
+     * @param newValue {@code true} if the decimal separator is always shown;
+     *                 {@code false} otherwise
      */
     public void setDecimalSeparatorAlwaysShown(boolean newValue) {
         icuDecimalFormat.setDecimalSeparatorAlwaysShown(newValue);
@@ -1005,6 +1042,9 @@
     /**
      * Returns whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
      * method returns <code>BigDecimal</code>. The default value is false.
+     *
+     * @return {@code true} if the parse method returns BigDecimal;
+     *         {@code false} otherwise
      * @see #setParseBigDecimal
      * @since 1.5
      */
@@ -1015,6 +1055,9 @@
     /**
      * Sets whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
      * method returns <code>BigDecimal</code>.
+     *
+     * @param newValue {@code true} if the parse method returns BigDecimal;
+     *                 {@code false} otherwise
      * @see #isParseBigDecimal
      * @since 1.5
      */
@@ -1046,6 +1089,7 @@
     /**
      * Standard override; no change in semantics.
      */
+    @Override
     public Object clone() {
         try {
             DecimalFormat other = (DecimalFormat) super.clone();
@@ -1060,6 +1104,7 @@
     /**
      * Overrides equals
      */
+    @Override
     public boolean equals(Object obj)
     {
         if (obj == null) {
@@ -1088,6 +1133,7 @@
     /**
      * Overrides hashCode
      */
+    @Override
     public int hashCode() {
         return super.hashCode() * 37 + getPositivePrefix().hashCode();
         // just enough fields for a reasonable distribution
@@ -1096,6 +1142,8 @@
     /**
      * Synthesizes a pattern string that represents the current state
      * of this Format object.
+     *
+     * @return a pattern string
      * @see #applyPattern
      */
     public String toPattern() {
@@ -1105,6 +1153,8 @@
     /**
      * Synthesizes a localized pattern string that represents the current
      * state of this Format object.
+     *
+     * @return a localized pattern string
      * @see #applyPattern
      */
     public String toLocalizedPattern() {
@@ -1121,7 +1171,7 @@
      * by this routine, since that is the typical end-user desire;
      * use setMaximumInteger if you want to set a real value.
      * For negative numbers, use a second pattern, separated by a semicolon
-     * <P>Example <code>"#,#00.0#"</code> -> 1,234.56
+     * <P>Example <code>"#,#00.0#"</code> &rarr; 1,234.56
      * <P>This means a minimum of 2 integer digits, 1 fraction digit, and
      * a maximum of 2 fraction digits.
      * <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
@@ -1129,6 +1179,7 @@
      * <p>In negative patterns, the minimum and maximum counts are ignored;
      * these are presumed to be set in the positive pattern.
      *
+     * @param pattern a new pattern
      * @exception NullPointerException if <code>pattern</code> is null
      * @exception IllegalArgumentException if the given pattern is invalid.
      */
@@ -1149,7 +1200,7 @@
      * by this routine, since that is the typical end-user desire;
      * use setMaximumInteger if you want to set a real value.
      * For negative numbers, use a second pattern, separated by a semicolon
-     * <P>Example <code>"#,#00.0#"</code> -> 1,234.56
+     * <P>Example <code>"#,#00.0#"</code> &rarr; 1,234.56
      * <P>This means a minimum of 2 integer digits, 1 fraction digit, and
      * a maximum of 2 fraction digits.
      * <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
@@ -1157,6 +1208,7 @@
      * <p>In negative patterns, the minimum and maximum counts are ignored;
      * these are presumed to be set in the positive pattern.
      *
+     * @param pattern a new pattern
      * @exception NullPointerException if <code>pattern</code> is null
      * @exception IllegalArgumentException if the given pattern is invalid.
      */
@@ -1186,6 +1238,7 @@
      * 309 is used. Negative input values are replaced with 0.
      * @see NumberFormat#setMaximumIntegerDigits
      */
+    @Override
     public void setMaximumIntegerDigits(int newValue) {
         maximumIntegerDigits = Math.min(Math.max(0, newValue), MAXIMUM_INTEGER_DIGITS);
         super.setMaximumIntegerDigits((maximumIntegerDigits > DOUBLE_INTEGER_DIGITS) ?
@@ -1206,6 +1259,7 @@
      * 309 is used. Negative input values are replaced with 0.
      * @see NumberFormat#setMinimumIntegerDigits
      */
+    @Override
     public void setMinimumIntegerDigits(int newValue) {
         minimumIntegerDigits = Math.min(Math.max(0, newValue), MAXIMUM_INTEGER_DIGITS);
         super.setMinimumIntegerDigits((minimumIntegerDigits > DOUBLE_INTEGER_DIGITS) ?
@@ -1226,6 +1280,7 @@
      * 340 is used. Negative input values are replaced with 0.
      * @see NumberFormat#setMaximumFractionDigits
      */
+    @Override
     public void setMaximumFractionDigits(int newValue) {
         maximumFractionDigits = Math.min(Math.max(0, newValue), MAXIMUM_FRACTION_DIGITS);
         super.setMaximumFractionDigits((maximumFractionDigits > DOUBLE_FRACTION_DIGITS) ?
@@ -1246,6 +1301,7 @@
      * 340 is used. Negative input values are replaced with 0.
      * @see NumberFormat#setMinimumFractionDigits
      */
+    @Override
     public void setMinimumFractionDigits(int newValue) {
         minimumFractionDigits = Math.min(Math.max(0, newValue), MAXIMUM_FRACTION_DIGITS);
         super.setMinimumFractionDigits((minimumFractionDigits > DOUBLE_FRACTION_DIGITS) ?
@@ -1266,6 +1322,7 @@
      * 309 is used.
      * @see #setMaximumIntegerDigits
      */
+    @Override
     public int getMaximumIntegerDigits() {
         return maximumIntegerDigits;
     }
@@ -1278,6 +1335,7 @@
      * 309 is used.
      * @see #setMinimumIntegerDigits
      */
+    @Override
     public int getMinimumIntegerDigits() {
         return minimumIntegerDigits;
     }
@@ -1290,6 +1348,7 @@
      * 340 is used.
      * @see #setMaximumFractionDigits
      */
+    @Override
     public int getMaximumFractionDigits() {
         return maximumFractionDigits;
     }
@@ -1302,6 +1361,7 @@
      * 340 is used.
      * @see #setMinimumFractionDigits
      */
+    @Override
     public int getMinimumFractionDigits() {
         return minimumFractionDigits;
     }
@@ -1316,6 +1376,7 @@
      * @return the currency used by this decimal format, or <code>null</code>
      * @since 1.4
      */
+    @Override
     public Currency getCurrency() {
         return symbols.getCurrency();
     }
@@ -1332,6 +1393,7 @@
      * @exception NullPointerException if <code>currency</code> is null
      * @since 1.4
      */
+    @Override
     public void setCurrency(Currency currency) {
         // Set the international currency symbol, and currency symbol on the DecimalFormatSymbols
         // object and tell ICU to use that.
@@ -1353,6 +1415,7 @@
      * @see #setRoundingMode(RoundingMode)
      * @since 1.6
      */
+    @Override
     public RoundingMode getRoundingMode() {
         return roundingMode;
     }
@@ -1387,6 +1450,7 @@
      * @exception NullPointerException if <code>roundingMode</code> is null.
      * @since 1.6
      */
+    @Override
     public void setRoundingMode(RoundingMode roundingMode) {
         if (roundingMode == null) {
             throw new NullPointerException();
diff --git a/ojluni/src/main/java/java/text/DecimalFormatSymbols.java b/ojluni/src/main/java/java/text/DecimalFormatSymbols.java
index c4cacc1..67e27aa 100755
--- a/ojluni/src/main/java/java/text/DecimalFormatSymbols.java
+++ b/ojluni/src/main/java/java/text/DecimalFormatSymbols.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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
@@ -69,13 +69,19 @@
 public class DecimalFormatSymbols implements Cloneable, Serializable {
 
     /**
-     * Create a DecimalFormatSymbols object for the default locale.
+     * Create a DecimalFormatSymbols object for the default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * This constructor can only construct instances for the locales
      * supported by the Java runtime environment, not for those
      * supported by installed
      * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
      * implementations. For full locale coverage, use the
      * {@link #getInstance(Locale) getInstance} method.
+     * <p>This is equivalent to calling
+     * {@link #DecimalFormatSymbols(Locale)
+     *     DecimalFormatSymbols(Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      */
     public DecimalFormatSymbols() {
         initialize( Locale.getDefault(Locale.Category.FORMAT) );
@@ -89,7 +95,16 @@
      * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
      * implementations. For full locale coverage, use the
      * {@link #getInstance(Locale) getInstance} method.
+     * If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
+     * for the numbering system, the instance is initialized with the specified numbering
+     * system if the JRE implementation supports it. For example,
+     * <pre>
+     * NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
+     * </pre>
+     * This may return a {@code NumberFormat} instance with the Thai numbering system,
+     * instead of the Latin numbering system.
      *
+     * @param locale the desired locale
      * @exception NullPointerException if <code>locale</code> is null
      */
     public DecimalFormatSymbols( Locale locale ) {
@@ -106,7 +121,7 @@
      * implementations.  It must contain at least a <code>Locale</code>
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
-     * @return An array of locales for which localized
+     * @return an array of locales for which localized
      *         <code>DecimalFormatSymbols</code> instances are available.
      * @since 1.6
      */
@@ -123,6 +138,11 @@
      * as for those supported by installed
      * {@link java.text.spi.DecimalFormatSymbolsProvider
      * DecimalFormatSymbolsProvider} implementations.
+     * <p>This is equivalent to calling
+     * {@link #getInstance(Locale)
+     *     getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @return a <code>DecimalFormatSymbols</code> instance.
      * @since 1.6
      */
@@ -137,6 +157,15 @@
      * as for those supported by installed
      * {@link java.text.spi.DecimalFormatSymbolsProvider
      * DecimalFormatSymbolsProvider} implementations.
+     * If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
+     * for the numbering system, the instance is initialized with the specified numbering
+     * system if the JRE implementation supports it. For example,
+     * <pre>
+     * NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
+     * </pre>
+     * This may return a {@code NumberFormat} instance with the Thai numbering system,
+     * instead of the Latin numbering system.
+     *
      * @param locale the desired locale.
      * @return a <code>DecimalFormatSymbols</code> instance.
      * @exception NullPointerException if <code>locale</code> is null
@@ -161,6 +190,8 @@
 
     /**
      * Gets the character used for zero. Different for Arabic, etc.
+     *
+     * @return the character used for zero
      */
     public char getZeroDigit() {
         return zeroDigit;
@@ -168,6 +199,8 @@
 
     /**
      * Sets the character used for zero. Different for Arabic, etc.
+     *
+     * @param zeroDigit the character used for zero
      */
     public void setZeroDigit(char zeroDigit) {
         this.zeroDigit = zeroDigit;
@@ -176,6 +209,8 @@
 
     /**
      * Gets the character used for thousands separator. Different for French, etc.
+     *
+     * @return the grouping separator
      */
     public char getGroupingSeparator() {
         return groupingSeparator;
@@ -183,6 +218,8 @@
 
     /**
      * Sets the character used for thousands separator. Different for French, etc.
+     *
+     * @param groupingSeparator the grouping separator
      */
     public void setGroupingSeparator(char groupingSeparator) {
         this.groupingSeparator = groupingSeparator;
@@ -191,6 +228,8 @@
 
     /**
      * Gets the character used for decimal sign. Different for French, etc.
+     *
+     * @return the character used for decimal sign
      */
     public char getDecimalSeparator() {
         return decimalSeparator;
@@ -198,6 +237,8 @@
 
     /**
      * Sets the character used for decimal sign. Different for French, etc.
+     *
+     * @param decimalSeparator the character used for decimal sign
      */
     public void setDecimalSeparator(char decimalSeparator) {
         this.decimalSeparator = decimalSeparator;
@@ -206,6 +247,8 @@
 
     /**
      * Gets the character used for per mille sign. Different for Arabic, etc.
+     *
+     * @return the character used for per mille sign
      */
     public char getPerMill() {
         return perMill;
@@ -213,6 +256,8 @@
 
     /**
      * Sets the character used for per mille sign. Different for Arabic, etc.
+     *
+     * @param perMill the character used for per mille sign
      */
     public void setPerMill(char perMill) {
         this.perMill = perMill;
@@ -221,6 +266,8 @@
 
     /**
      * Gets the character used for percent sign. Different for Arabic, etc.
+     *
+     * @return the character used for percent sign
      */
     public char getPercent() {
         return percent;
@@ -235,6 +282,8 @@
 
     /**
      * Sets the character used for percent sign. Different for Arabic, etc.
+     *
+     * @param percent the character used for percent sign
      */
     public void setPercent(char percent) {
         this.percent = percent;
@@ -243,6 +292,8 @@
 
     /**
      * Gets the character used for a digit in a pattern.
+     *
+     * @return the character used for a digit in a pattern
      */
     public char getDigit() {
         return digit;
@@ -250,6 +301,8 @@
 
     /**
      * Sets the character used for a digit in a pattern.
+     *
+     * @param digit the character used for a digit in a pattern
      */
     public void setDigit(char digit) {
         this.digit = digit;
@@ -259,6 +312,8 @@
     /**
      * Gets the character used to separate positive and negative subpatterns
      * in a pattern.
+     *
+     * @return the pattern separator
      */
     public char getPatternSeparator() {
         return patternSeparator;
@@ -267,6 +322,8 @@
     /**
      * Sets the character used to separate positive and negative subpatterns
      * in a pattern.
+     *
+     * @param patternSeparator the pattern separator
      */
     public void setPatternSeparator(char patternSeparator) {
         this.patternSeparator = patternSeparator;
@@ -276,6 +333,8 @@
     /**
      * Gets the string used to represent infinity. Almost always left
      * unchanged.
+     *
+     * @return the string representing infinity
      */
     public String getInfinity() {
         return infinity;
@@ -284,6 +343,8 @@
     /**
      * Sets the string used to represent infinity. Almost always left
      * unchanged.
+     *
+     * @param infinity the string representing infinity
      */
     public void setInfinity(String infinity) {
         this.infinity = infinity;
@@ -293,6 +354,8 @@
     /**
      * Gets the string used to represent "not a number". Almost always left
      * unchanged.
+     *
+     * @return the string representing "not a number"
      */
     public String getNaN() {
         return NaN;
@@ -301,6 +364,8 @@
     /**
      * Sets the string used to represent "not a number". Almost always left
      * unchanged.
+     *
+     * @param NaN the string representing "not a number"
      */
     public void setNaN(String NaN) {
         this.NaN = NaN;
@@ -311,6 +376,8 @@
      * Gets the character used to represent minus sign. If no explicit
      * negative format is specified, one is formed by prefixing
      * minusSign to the positive format.
+     *
+     * @return the character representing minus sign
      */
     public char getMinusSign() {
         return minusSign;
@@ -330,6 +397,8 @@
      * Sets the character used to represent minus sign. If no explicit
      * negative format is specified, one is formed by prefixing
      * minusSign to the positive format.
+     *
+     * @param minusSign the character representing minus sign
      */
     public void setMinusSign(char minusSign) {
         this.minusSign = minusSign;
@@ -339,6 +408,8 @@
     /**
      * Returns the currency symbol for the currency of these
      * DecimalFormatSymbols in their locale.
+     *
+     * @return the currency symbol
      * @since 1.2
      */
     public String getCurrencySymbol()
@@ -349,6 +420,8 @@
     /**
      * Sets the currency symbol for the currency of these
      * DecimalFormatSymbols in their locale.
+     *
+     * @param currency the currency symbol
      * @since 1.2
      */
     public void setCurrencySymbol(String currency)
@@ -360,6 +433,8 @@
     /**
      * Returns the ISO 4217 currency code of the currency of these
      * DecimalFormatSymbols.
+     *
+     * @return the currency code
      * @since 1.2
      */
     public String getInternationalCurrencySymbol()
@@ -378,6 +453,7 @@
      * then the currency attribute is set to null and the currency symbol
      * attribute is not modified.
      *
+     * @param currencyCode the currency code
      * @see #setCurrency
      * @see #setCurrencySymbol
      * @since 1.2
@@ -433,6 +509,8 @@
 
     /**
      * Returns the monetary decimal separator.
+     *
+     * @return the monetary decimal separator
      * @since 1.2
      */
     public char getMonetaryDecimalSeparator()
@@ -442,6 +520,8 @@
 
     /**
      * Sets the monetary decimal separator.
+     *
+     * @param sep the monetary decimal separator
      * @since 1.2
      */
     public void setMonetaryDecimalSeparator(char sep)
@@ -508,18 +588,20 @@
     /**
      * Standard override.
      */
+    @Override
     public Object clone() {
         try {
             return (DecimalFormatSymbols)super.clone();
             // other fields are bit-copied
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
     /**
      * Override equals.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == null) return false;
         if (this == obj) return true;
@@ -546,6 +628,7 @@
     /**
      * Override hashCode.
      */
+    @Override
     public int hashCode() {
             int result = zeroDigit;
             result = result * 37 + groupingSeparator;
diff --git a/ojluni/src/main/java/java/text/DigitList.java b/ojluni/src/main/java/java/text/DigitList.java
index a355944..c916b4c 100755
--- a/ojluni/src/main/java/java/text/DigitList.java
+++ b/ojluni/src/main/java/java/text/DigitList.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -270,7 +270,7 @@
      * @param maximumFractionDigits The most fractional digits which should
      * be converted.
      */
-    public final void set(boolean isNegative, double source, int maximumFractionDigits) {
+    final void set(boolean isNegative, double source, int maximumFractionDigits) {
         set(isNegative, source, maximumFractionDigits, true);
     }
 
@@ -496,7 +496,7 @@
     /**
      * Utility routine to set the value of the digit list from a long
      */
-    public final void set(boolean isNegative, long source) {
+    final void set(boolean isNegative, long source) {
         set(isNegative, source, 0);
     }
 
@@ -509,7 +509,7 @@
      * If maximumDigits is lower than the number of significant digits
      * in source, the representation will be rounded.  Ignored if <= 0.
      */
-    public final void set(boolean isNegative, long source, int maximumDigits) {
+    final void set(boolean isNegative, long source, int maximumDigits) {
         this.isNegative = isNegative;
 
         // This method does not expect a negative number. However,
@@ -632,7 +632,7 @@
             other.tempBuffer = null;
             return other;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
diff --git a/ojluni/src/main/java/java/text/FieldPosition.java b/ojluni/src/main/java/java/text/FieldPosition.java
index 15a9353..955221d 100755
--- a/ojluni/src/main/java/java/text/FieldPosition.java
+++ b/ojluni/src/main/java/java/text/FieldPosition.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2002, 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
@@ -100,6 +100,7 @@
      * identified by constants, whose names typically end with _FIELD,
      * in the various subclasses of Format.
      *
+     * @param field the field identifier
      * @see java.text.NumberFormat#INTEGER_FIELD
      * @see java.text.NumberFormat#FRACTION_FIELD
      * @see java.text.DateFormat#YEAR_FIELD
@@ -135,7 +136,7 @@
      * constant, <code>fieldID</code> should be -1.
      *
      * @param attribute Format.Field constant identifying a field
-     * @param fieldID integer constantce identifying a field
+     * @param fieldID integer constant identifying a field
      * @since 1.4
      */
     public FieldPosition(Format.Field attribute, int fieldID) {
@@ -157,6 +158,8 @@
 
     /**
      * Retrieves the field identifier.
+     *
+     * @return the field identifier
      */
     public int getField() {
         return field;
@@ -164,6 +167,8 @@
 
     /**
      * Retrieves the index of the first character in the requested field.
+     *
+     * @return the begin index
      */
     public int getBeginIndex() {
         return beginIndex;
@@ -172,6 +177,8 @@
     /**
      * Retrieves the index of the character following the last character in the
      * requested field.
+     *
+     * @return the end index
      */
     public int getEndIndex() {
         return endIndex;
@@ -179,6 +186,8 @@
 
     /**
      * Sets the begin index.  For use by subclasses of Format.
+     *
+     * @param bi the begin index
      * @since 1.2
      */
     public void setBeginIndex(int bi) {
@@ -187,6 +196,8 @@
 
     /**
      * Sets the end index.  For use by subclasses of Format.
+     *
+     * @param ei the end index
      * @since 1.2
      */
     public void setEndIndex(int ei) {
diff --git a/ojluni/src/main/java/java/text/Format.java b/ojluni/src/main/java/java/text/Format.java
index a0ed993..74fcc37 100755
--- a/ojluni/src/main/java/java/text/Format.java
+++ b/ojluni/src/main/java/java/text/Format.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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
@@ -58,7 +58,7 @@
  * no separator in between, and in this case the <code>parseObject</code> could
  * not tell which digits belong to which number.
  *
- * <h4>Subclassing</h4>
+ * <h3>Subclassing</h3>
  *
  * <p>
  * The Java Platform provides three specialized subclasses of <code>Format</code>--
@@ -258,7 +258,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // will never happen
-            return null;
+            throw new InternalError(e);
         }
     }
 
@@ -281,7 +281,7 @@
     }
 
     /**
-     * Creates an <code>AttributedCharacterIterator</code> containg the
+     * Creates an <code>AttributedCharacterIterator</code> containing the
      * concatenated contents of the passed in
      * <code>AttributedCharacterIterator</code>s.
      *
@@ -370,7 +370,7 @@
      * Delegates should NOT assume that the <code>Format</code> will notify
      * the delegate of fields in any particular order.
      *
-     * @see FieldPosition.Delegate
+     * @see FieldPosition#getFieldDelegate
      * @see CharacterIteratorFieldDelegate
      */
     interface FieldDelegate {
diff --git a/ojluni/src/main/java/java/text/MergeCollation.java b/ojluni/src/main/java/java/text/MergeCollation.java
index d764f03..bd541a5 100755
--- a/ojluni/src/main/java/java/text/MergeCollation.java
+++ b/ojluni/src/main/java/java/text/MergeCollation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -88,19 +88,19 @@
     public String getPattern(boolean withWhiteSpace) {
         StringBuffer result = new StringBuffer();
         PatternEntry tmp = null;
-        ArrayList extList = null;
+        ArrayList<PatternEntry> extList = null;
         int i;
         for (i = 0; i < patterns.size(); ++i) {
-            PatternEntry entry = (PatternEntry) patterns.get(i);
+            PatternEntry entry = patterns.get(i);
             if (entry.extension.length() != 0) {
                 if (extList == null)
-                    extList = new ArrayList();
+                    extList = new ArrayList<>();
                 extList.add(entry);
             } else {
                 if (extList != null) {
                     PatternEntry last = findLastWithNoExtension(i-1);
                     for (int j = extList.size() - 1; j >= 0 ; j--) {
-                        tmp = (PatternEntry)(extList.get(j));
+                        tmp = extList.get(j);
                         tmp.addToBuffer(result, false, withWhiteSpace, last);
                     }
                     extList = null;
@@ -111,7 +111,7 @@
         if (extList != null) {
             PatternEntry last = findLastWithNoExtension(i-1);
             for (int j = extList.size() - 1; j >= 0 ; j--) {
-                tmp = (PatternEntry)(extList.get(j));
+                tmp = extList.get(j);
                 tmp.addToBuffer(result, false, withWhiteSpace, last);
             }
             extList = null;
@@ -121,7 +121,7 @@
 
     private final PatternEntry findLastWithNoExtension(int i) {
         for (--i;i >= 0; --i) {
-            PatternEntry entry = (PatternEntry) patterns.get(i);
+            PatternEntry entry = patterns.get(i);
             if (entry.extension.length() == 0) {
                 return entry;
             }
@@ -149,7 +149,7 @@
         StringBuffer result = new StringBuffer();
         for (int i = 0; i < patterns.size(); ++i)
         {
-            PatternEntry entry = (PatternEntry) patterns.get(i);
+            PatternEntry entry = patterns.get(i);
             if (entry != null) {
                 entry.addToBuffer(result, true, withWhiteSpace, null);
             }
@@ -198,13 +198,13 @@
      * @return the requested pattern entry
      */
     public PatternEntry getItemAt(int index) {
-        return (PatternEntry) patterns.get(index);
+        return patterns.get(index);
     }
 
     //============================================================
     // privates
     //============================================================
-    ArrayList patterns = new ArrayList(); // a list of PatternEntries
+    ArrayList<PatternEntry> patterns = new ArrayList<>(); // a list of PatternEntries
 
     private transient PatternEntry saveEntry = null;
     private transient PatternEntry lastEntry = null;
@@ -326,7 +326,7 @@
         } else {
             int i;
             for (i = patterns.size() - 1; i >= 0; --i) {
-                PatternEntry e = (PatternEntry) patterns.get(i);
+                PatternEntry e = patterns.get(i);
                 if (e.chars.regionMatches(0,entry.chars,0,
                                               e.chars.length())) {
                     excessChars.append(entry.chars.substring(e.chars.length(),
diff --git a/ojluni/src/main/java/java/text/MessageFormat.java b/ojluni/src/main/java/java/text/MessageFormat.java
index 68bf84d..d7431ef 100755
--- a/ojluni/src/main/java/java/text/MessageFormat.java
+++ b/ojluni/src/main/java/java/text/MessageFormat.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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
@@ -69,7 +69,7 @@
  * behavior is defined by the pattern that you provide as well as the
  * subformats used for inserted arguments.
  *
- * <h4><a name="patterns">Patterns and Their Interpretation</a></h4>
+ * <h3><a name="patterns">Patterns and Their Interpretation</a></h3>
  *
  * <code>MessageFormat</code> uses patterns of the following form:
  * <blockquote><pre>
@@ -126,7 +126,6 @@
  * valid patterns, but <code>"ab {0'}' de"</code>, <code>"ab } de"</code>
  * and <code>"''{''"</code> are not.
  *
- * <p>
  * <dl><dt><b>Warning:</b><dd>The rules for using quotes within message
  * format patterns unfortunately have shown to be somewhat confusing.
  * In particular, it isn't always obvious to localizers whether single
@@ -147,7 +146,7 @@
  * table shows how the values map to {@code Format} instances. Combinations not
  * shown in the table are illegal. A <i>SubformatPattern</i> must
  * be a valid pattern string for the {@code Format} subclass used.
- * <p>
+ *
  * <table border=1 summary="Shows how FormatType and FormatStyle values map to Format instances">
  *    <tr>
  *       <th id="ft" class="TableHeadingColor">FormatType
@@ -216,7 +215,6 @@
  *       <td headers="fs"><i>SubformatPattern</i>
  *       <td headers="sc">{@code new} {@link ChoiceFormat#ChoiceFormat(String) ChoiceFormat}{@code (subformatPattern)}
  * </table>
- * <p>
  *
  * <h4>Usage Information</h4>
  *
@@ -288,10 +286,10 @@
  * You can create the <code>ChoiceFormat</code> programmatically, as in the
  * above example, or by using a pattern. See {@link ChoiceFormat}
  * for more information.
- * <blockquote><pre>
+ * <blockquote><pre>{@code
  * form.applyPattern(
- *    "There {0,choice,0#are no files|1#is one file|1&lt;are {0,number,integer} files}.");
- * </pre></blockquote>
+ *    "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.");
+ * }</pre></blockquote>
  *
  * <p>
  * <strong>Note:</strong> As we see above, the string produced
@@ -349,7 +347,8 @@
     private static final long serialVersionUID = 6479157306784022952L;
 
     /**
-     * Constructs a MessageFormat for the default locale and the
+     * Constructs a MessageFormat for the default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale and the
      * specified pattern.
      * The constructor first sets the locale, then parses the pattern and
      * creates a list of subformats for the format elements contained in it.
@@ -423,6 +422,7 @@
      * @param pattern the pattern for this message format
      * @exception IllegalArgumentException if the pattern is invalid
      */
+    @SuppressWarnings("fallthrough") // fallthrough in switch is expected, suppress it
     public void applyPattern(String pattern) {
             StringBuilder[] segments = new StringBuilder[4];
             // Allocate only segments[SEG_RAW] here. The rest are
@@ -763,7 +763,7 @@
      * as indicated by the first matching line of the following table. An
      * argument is <i>unavailable</i> if <code>arguments</code> is
      * <code>null</code> or has fewer than argumentIndex+1 elements.
-     * <p>
+     *
      * <table border=1 summary="Examples of subformat,argument,and formatted text">
      *    <tr>
      *       <th>Subformat
@@ -780,7 +780,7 @@
      *    <tr>
      *       <td><code>instanceof ChoiceFormat</code>
      *       <td><i>any</i>
-     *       <td><code>subformat.format(argument).indexOf('{') >= 0 ?<br>
+     *       <td><code>subformat.format(argument).indexOf('{') &gt;= 0 ?<br>
      *           (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :
      *           subformat.format(argument)</code>
      *    <tr>
@@ -813,6 +813,8 @@
      * @param result where text is appended.
      * @param pos On input: an alignment field, if desired.
      *            On output: the offsets of the alignment field.
+     * @return the string buffer passed in as {@code result}, with formatted
+     * text appended
      * @exception IllegalArgumentException if an argument in the
      *            <code>arguments</code> array is not of the type
      *            expected by the format element(s) that use it.
@@ -830,6 +832,9 @@
      *     <code>(new {@link #MessageFormat(String) MessageFormat}(pattern)).{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>
      * </blockquote>
      *
+     * @param pattern   the pattern string
+     * @param arguments object(s) to format
+     * @return the formatted string
      * @exception IllegalArgumentException if the pattern is invalid,
      *            or if an argument in the <code>arguments</code> array
      *            is not of the type expected by the format element(s)
@@ -901,7 +906,7 @@
      */
     public AttributedCharacterIterator formatToCharacterIterator(Object arguments) {
         StringBuffer result = new StringBuffer();
-        ArrayList iterators = new ArrayList();
+        ArrayList<AttributedCharacterIterator> iterators = new ArrayList<>();
 
         if (arguments == null) {
             throw new NullPointerException(
@@ -912,7 +917,7 @@
             return createAttributedCharacterIterator("");
         }
         return createAttributedCharacterIterator(
-                     (AttributedCharacterIterator[])iterators.toArray(
+                     iterators.toArray(
                      new AttributedCharacterIterator[iterators.size()]));
     }
 
@@ -942,6 +947,10 @@
      * is comparing against the pattern "AAD {0} BBB", the error index is
      * 0. When an error occurs, the call to this method will return null.
      * If the source is null, return an empty array.
+     *
+     * @param source the string to parse
+     * @param pos    the parse position
+     * @return an array of parsed objects
      */
     public Object[] parse(String source, ParsePosition pos) {
         if (source == null) {
@@ -1078,14 +1087,14 @@
         MessageFormat other = (MessageFormat) super.clone();
 
         // clone arrays. Can't do with utility because of bug in Cloneable
-        other.formats = (Format[]) formats.clone(); // shallow clone
+        other.formats = formats.clone(); // shallow clone
         for (int i = 0; i < formats.length; ++i) {
             if (formats[i] != null)
                 other.formats[i] = (Format)formats[i].clone();
         }
         // for primitives or immutables, shallow clone is enough
-        other.offsets = (int[]) offsets.clone();
-        other.argumentNumbers = (int[]) argumentNumbers.clone();
+        other.offsets = offsets.clone();
+        other.argumentNumbers = argumentNumbers.clone();
 
         return other;
     }
@@ -1228,7 +1237,7 @@
      *            expected by the format element(s) that use it.
      */
     private StringBuffer subformat(Object[] arguments, StringBuffer result,
-                                   FieldPosition fp, List characterIterators) {
+                                   FieldPosition fp, List<AttributedCharacterIterator> characterIterators) {
         // note: this implementation assumes a fast substring & index.
         // if this is not true, would be better to append chars one by one.
         int lastOffset = 0;
diff --git a/ojluni/src/main/java/java/text/Normalizer.java b/ojluni/src/main/java/java/text/Normalizer.java
index 8bb33b5..4c551c3 100755
--- a/ojluni/src/main/java/java/text/Normalizer.java
+++ b/ojluni/src/main/java/java/text/Normalizer.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -51,16 +51,14 @@
  * several different ways in Unicode.  For example, take the character A-acute.
  * In Unicode, this can be encoded as a single character (the "composed" form):
  *
- * <p><pre>
+ * <pre>
  *      U+00C1    LATIN CAPITAL LETTER A WITH ACUTE</pre>
- * </p>
  *
  * or as two separate characters (the "decomposed" form):
  *
- * <p><pre>
+ * <pre>
  *      U+0041    LATIN CAPITAL LETTER A
  *      U+0301    COMBINING ACUTE ACCENT</pre>
- * </p>
  *
  * To a user of your program, however, both of these sequences should be
  * treated as the same "user-level" character "A with acute accent".  When you
@@ -72,17 +70,15 @@
  * <p>
  * Similarly, the string "ffi" can be encoded as three separate letters:
  *
- * <p><pre>
+ * <pre>
  *      U+0066    LATIN SMALL LETTER F
  *      U+0066    LATIN SMALL LETTER F
  *      U+0069    LATIN SMALL LETTER I</pre>
- * </p>
  *
  * or as the single character
  *
- * <p><pre>
+ * <pre>
  *      U+FB03    LATIN SMALL LIGATURE FFI</pre>
- * </p>
  *
  * The ffi ligature is not a distinct semantic character, and strictly speaking
  * it shouldn't be in Unicode at all, but it was included for compatibility
diff --git a/ojluni/src/main/java/java/text/NumberFormat.java b/ojluni/src/main/java/java/text/NumberFormat.java
index 8b11d63..476983f 100755
--- a/ojluni/src/main/java/java/text/NumberFormat.java
+++ b/ojluni/src/main/java/java/text/NumberFormat.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, 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
@@ -74,34 +74,34 @@
  * To format a number for the current Locale, use one of the factory
  * class methods:
  * <blockquote>
- * <pre>
- *  myString = NumberFormat.getInstance().format(myNumber);
- * </pre>
+ * <pre>{@code
+ * myString = NumberFormat.getInstance().format(myNumber);
+ * }</pre>
  * </blockquote>
  * If you are formatting multiple numbers, it is
  * more efficient to get the format and use it multiple times so that
  * the system doesn't have to fetch the information about the local
  * language and country conventions multiple times.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * NumberFormat nf = NumberFormat.getInstance();
  * for (int i = 0; i < myNumber.length; ++i) {
  *     output.println(nf.format(myNumber[i]) + "; ");
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * To format a number for a different Locale, specify it in the
  * call to <code>getInstance</code>.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
- * </pre>
+ * }</pre>
  * </blockquote>
  * You can also use a <code>NumberFormat</code> to parse numbers:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * myNumber = nf.parse(myString);
- * </pre>
+ * }</pre>
  * </blockquote>
  * Use <code>getInstance</code> or <code>getNumberInstance</code> to get the
  * normal number format. Use <code>getIntegerInstance</code> to get an
@@ -126,8 +126,8 @@
  * the detailed description for each these control methods,
  * <p>
  * setParseIntegerOnly : only affects parsing, e.g.
- * if true,  "3456.78" -> 3456 (and leaves the parse position just after index 6)
- * if false, "3456.78" -> 3456.78 (and leaves the parse position just after index 8)
+ * if true,  "3456.78" &rarr; 3456 (and leaves the parse position just after index 6)
+ * if false, "3456.78" &rarr; 3456.78 (and leaves the parse position just after index 8)
  * This is independent of formatting.  If you want to not show a decimal point
  * where there might be no digits after the decimal point, use
  * setDecimalSeparatorAlwaysShown.
@@ -135,8 +135,8 @@
  * setDecimalSeparatorAlwaysShown : only affects formatting, and only where
  * there might be no digits after the decimal point, such as with a pattern
  * like "#,##0.##", e.g.,
- * if true,  3456.00 -> "3,456."
- * if false, 3456.00 -> "3456"
+ * if true,  3456.00 &rarr; "3,456."
+ * if false, 3456.00 &rarr; "3456"
  * This is independent of parsing.  If you want parsing to stop at the decimal
  * point, use setParseIntegerOnly.
  *
@@ -167,7 +167,7 @@
  *      numbers: "(12)" for -12.
  * </ol>
  *
- * <h4><a name="synchronization">Synchronization</a></h4>
+ * <h3><a name="synchronization">Synchronization</a></h3>
  *
  * <p>
  * Number formats are generally not synchronized.
@@ -233,6 +233,7 @@
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see              java.text.FieldPosition
      */
+    @Override
     public StringBuffer format(Object number,
                                StringBuffer toAppendTo,
                                FieldPosition pos) {
@@ -273,12 +274,16 @@
      *         error, returns null.
      * @exception NullPointerException if <code>pos</code> is null.
      */
+    @Override
     public final Object parseObject(String source, ParsePosition pos) {
         return parse(source, pos);
     }
 
    /**
      * Specialization of format.
+     *
+     * @param number the double number to format
+     * @return the formatted String
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -290,6 +295,9 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number the long number to format
+     * @return the formatted String
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -301,6 +309,12 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number     the double number to format
+     * @param toAppendTo the StringBuffer to which the formatted text is to be
+     *                   appended
+     * @param pos        the field position
+     * @return the formatted StringBuffer
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -311,6 +325,12 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number     the long number to format
+     * @param toAppendTo the StringBuffer to which the formatted text is to be
+     *                   appended
+     * @param pos        the field position
+     * @return the formatted StringBuffer
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -327,6 +347,10 @@
      * after the 1).
      * Does not throw an exception; if no object can be parsed, index is
      * unchanged!
+     *
+     * @param source the String to parse
+     * @param parsePosition the parse position
+     * @return the parsed value
      * @see java.text.NumberFormat#isParseIntegerOnly
      * @see java.text.Format#parseObject
      */
@@ -361,6 +385,9 @@
      * would stop at the "." character.  Of course, the exact format accepted
      * by the parse operation is locale dependant and determined by sub-classes
      * of NumberFormat.
+     *
+     * @return {@code true} if numbers should be parsed as integers only;
+     *         {@code false} otherwise
      */
     public boolean isParseIntegerOnly() {
         return parseIntegerOnly;
@@ -368,6 +395,9 @@
 
     /**
      * Sets whether or not numbers should be parsed as integers only.
+     *
+     * @param value {@code true} if numbers should be parsed as integers only;
+     *              {@code false} otherwise
      * @see #isParseIntegerOnly
      */
     public void setParseIntegerOnly(boolean value) {
@@ -377,9 +407,13 @@
     //============== Locale Stuff =====================
 
     /**
-     * Returns a general-purpose number format for the current default locale.
+     * Returns a general-purpose number format for the current default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * This is the same as calling
      * {@link #getNumberInstance() getNumberInstance()}.
+     *
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      */
     public final static NumberFormat getInstance() {
         return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE);
@@ -389,13 +423,26 @@
      * Returns a general-purpose number format for the specified locale.
      * This is the same as calling
      * {@link #getNumberInstance(java.util.Locale) getNumberInstance(inLocale)}.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      */
     public static NumberFormat getInstance(Locale inLocale) {
         return getInstance(inLocale, NUMBERSTYLE);
     }
 
     /**
-     * Returns a general-purpose number format for the current default locale.
+     * Returns a general-purpose number format for the current default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getNumberInstance(Locale)
+     *     getNumberInstance(Locale.getDefault(Locale.Category.FORMAT))}.
+     *
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      */
     public final static NumberFormat getNumberInstance() {
         return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE);
@@ -403,20 +450,30 @@
 
     /**
      * Returns a general-purpose number format for the specified locale.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      */
     public static NumberFormat getNumberInstance(Locale inLocale) {
         return getInstance(inLocale, NUMBERSTYLE);
     }
 
     /**
-     * Returns an integer number format for the current default locale. The
+     * Returns an integer number format for the current default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale. The
      * returned number format is configured to round floating point numbers
      * to the nearest integer using half-even rounding (see {@link
      * java.math.RoundingMode#HALF_EVEN RoundingMode.HALF_EVEN}) for formatting,
      * and to parse only the integer part of an input string (see {@link
      * #isParseIntegerOnly isParseIntegerOnly}).
+     * <p>This is equivalent to calling
+     * {@link #getIntegerInstance(Locale)
+     *     getIntegerInstance(Locale.getDefault(Locale.Category.FORMAT))}.
      *
      * @see #getRoundingMode()
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @return a number format for integer values
      * @since 1.4
      */
@@ -432,6 +489,7 @@
      * and to parse only the integer part of an input string (see {@link
      * #isParseIntegerOnly isParseIntegerOnly}).
      *
+     * @param inLocale the desired locale
      * @see #getRoundingMode()
      * @return a number format for integer values
      * @since 1.4
@@ -441,7 +499,15 @@
     }
 
     /**
-     * Returns a currency format for the current default locale.
+     * Returns a currency format for the current default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getCurrencyInstance(Locale)
+     *     getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT))}.
+     *
+     * @return the {@code NumberFormat} instance for currency formatting
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      */
     public final static NumberFormat getCurrencyInstance() {
         return getInstance(Locale.getDefault(Locale.Category.FORMAT), CURRENCYSTYLE);
@@ -449,13 +515,24 @@
 
     /**
      * Returns a currency format for the specified locale.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for currency formatting
      */
     public static NumberFormat getCurrencyInstance(Locale inLocale) {
         return getInstance(inLocale, CURRENCYSTYLE);
     }
 
     /**
-     * Returns a percentage format for the current default locale.
+     * Returns a percentage format for the current default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
+     * <p>This is equivalent to calling
+     * {@link #getPercentInstance(Locale)
+     *     getPercentInstance(Locale.getDefault(Locale.Category.FORMAT))}.
+     *
+     * @return the {@code NumberFormat} instance for percentage formatting
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      */
     public final static NumberFormat getPercentInstance() {
         return getInstance(Locale.getDefault(Locale.Category.FORMAT), PERCENTSTYLE);
@@ -463,6 +540,9 @@
 
     /**
      * Returns a percentage format for the specified locale.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for percentage formatting
      */
     public static NumberFormat getPercentInstance(Locale inLocale) {
         return getInstance(inLocale, PERCENTSTYLE);
@@ -488,16 +568,18 @@
     }
 
     /**
-     * Overrides hashCode
+     * Overrides hashCode.
      */
+    @Override
     public int hashCode() {
         return maximumIntegerDigits * 37 + maxFractionDigits;
         // just enough fields for a reasonable distribution
     }
 
     /**
-     * Overrides equals
+     * Overrides equals.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == null) {
             return false;
@@ -518,8 +600,9 @@
     }
 
     /**
-     * Overrides Cloneable
+     * Overrides Cloneable.
      */
+    @Override
     public Object clone() {
         NumberFormat other = (NumberFormat) super.clone();
         return other;
@@ -530,6 +613,9 @@
      * English locale, with grouping on, the number 1234567 might be formatted
      * as "1,234,567". The grouping separator as well as the size of each group
      * is locale dependant and is determined by sub-classes of NumberFormat.
+     *
+     * @return {@code true} if grouping is used;
+     *         {@code false} otherwise
      * @see #setGroupingUsed
      */
     public boolean isGroupingUsed() {
@@ -538,6 +624,9 @@
 
     /**
      * Set whether or not grouping will be used in this format.
+     *
+     * @param newValue {@code true} if grouping is used;
+     *                 {@code false} otherwise
      * @see #isGroupingUsed
      */
     public void setGroupingUsed(boolean newValue) {
@@ -547,6 +636,8 @@
     /**
      * Returns the maximum number of digits allowed in the integer portion of a
      * number.
+     *
+     * @return the maximum number of digits
      * @see #setMaximumIntegerDigits
      */
     public int getMaximumIntegerDigits() {
@@ -555,10 +646,11 @@
 
     /**
      * Sets the maximum number of digits allowed in the integer portion of a
-     * number. maximumIntegerDigits must be >= minimumIntegerDigits.  If the
+     * number. maximumIntegerDigits must be &ge; minimumIntegerDigits.  If the
      * new value for maximumIntegerDigits is less than the current value
      * of minimumIntegerDigits, then minimumIntegerDigits will also be set to
      * the new value.
+     *
      * @param newValue the maximum number of integer digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -574,6 +666,8 @@
     /**
      * Returns the minimum number of digits allowed in the integer portion of a
      * number.
+     *
+     * @return the minimum number of digits
      * @see #setMinimumIntegerDigits
      */
     public int getMinimumIntegerDigits() {
@@ -582,10 +676,11 @@
 
     /**
      * Sets the minimum number of digits allowed in the integer portion of a
-     * number. minimumIntegerDigits must be <= maximumIntegerDigits.  If the
+     * number. minimumIntegerDigits must be &le; maximumIntegerDigits.  If the
      * new value for minimumIntegerDigits exceeds the current value
      * of maximumIntegerDigits, then maximumIntegerDigits will also be set to
      * the new value
+     *
      * @param newValue the minimum number of integer digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -601,6 +696,8 @@
     /**
      * Returns the maximum number of digits allowed in the fraction portion of a
      * number.
+     *
+     * @return the maximum number of digits.
      * @see #setMaximumFractionDigits
      */
     public int getMaximumFractionDigits() {
@@ -609,10 +706,11 @@
 
     /**
      * Sets the maximum number of digits allowed in the fraction portion of a
-     * number. maximumFractionDigits must be >= minimumFractionDigits.  If the
+     * number. maximumFractionDigits must be &ge; minimumFractionDigits.  If the
      * new value for maximumFractionDigits is less than the current value
      * of minimumFractionDigits, then minimumFractionDigits will also be set to
      * the new value.
+     *
      * @param newValue the maximum number of fraction digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -628,6 +726,8 @@
     /**
      * Returns the minimum number of digits allowed in the fraction portion of a
      * number.
+     *
+     * @return the minimum number of digits
      * @see #setMinimumFractionDigits
      */
     public int getMinimumFractionDigits() {
@@ -636,10 +736,11 @@
 
     /**
      * Sets the minimum number of digits allowed in the fraction portion of a
-     * number. minimumFractionDigits must be <= maximumFractionDigits.  If the
+     * number. minimumFractionDigits must be &le; maximumFractionDigits.  If the
      * new value for minimumFractionDigits exceeds the current value
      * of maximumFractionDigits, then maximumIntegerDigits will also be set to
      * the new value
+     *
      * @param newValue the minimum number of fraction digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -1025,7 +1126,7 @@
         private static final long serialVersionUID = 7494728892700160890L;
 
         // table of all instances in this class, used by readResolve
-        private static final Map instanceMap = new HashMap(11);
+        private static final Map<String, Field> instanceMap = new HashMap<>(11);
 
         /**
          * Creates a Field instance with the specified
@@ -1046,6 +1147,7 @@
          * @throws InvalidObjectException if the constant could not be resolved.
          * @return resolved NumberFormat.Field constant
          */
+        @Override
         protected Object readResolve() throws InvalidObjectException {
             if (this.getClass() != NumberFormat.Field.class) {
                 throw new InvalidObjectException("subclass didn't correctly implement readResolve");
diff --git a/ojluni/src/main/java/java/text/ParseException.java b/ojluni/src/main/java/java/text/ParseException.java
index ee0fd5c..0e9870c 100755
--- a/ojluni/src/main/java/java/text/ParseException.java
+++ b/ojluni/src/main/java/java/text/ParseException.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
@@ -53,6 +53,7 @@
      * Constructs a ParseException with the specified detail message and
      * offset.
      * A detail message is a String that describes this particular exception.
+     *
      * @param s the detail message
      * @param errorOffset the position where the error is found while parsing.
      */
@@ -63,6 +64,8 @@
 
     /**
      * Returns the position where the error was found.
+     *
+     * @return the position where the error was found
      */
     public int getErrorOffset () {
         return errorOffset;
diff --git a/ojluni/src/main/java/java/text/ParsePosition.java b/ojluni/src/main/java/java/text/ParsePosition.java
index a187bb8..be3ffce 100755
--- a/ojluni/src/main/java/java/text/ParsePosition.java
+++ b/ojluni/src/main/java/java/text/ParsePosition.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2002, 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
@@ -69,6 +69,8 @@
      * Retrieve the current parse position.  On input to a parse method, this
      * is the index of the character at which parsing will begin; on output, it
      * is the index of the character following the last character parsed.
+     *
+     * @return the current parse position
      */
     public int getIndex() {
         return index;
@@ -76,6 +78,8 @@
 
     /**
      * Set the current parse position.
+     *
+     * @param index the current parse position
      */
     public void setIndex(int index) {
         this.index = index;
@@ -83,6 +87,8 @@
 
     /**
      * Create a new ParsePosition with the given initial index.
+     *
+     * @param index initial index
      */
     public ParsePosition(int index) {
         this.index = index;
@@ -91,6 +97,8 @@
      * Set the index at which a parse error occurred.  Formatters
      * should set this before returning an error code from their
      * parseObject method.  The default value is -1 if this is not set.
+     *
+     * @param ei the index at which an error occurred
      * @since 1.2
      */
     public void setErrorIndex(int ei)
@@ -101,12 +109,15 @@
     /**
      * Retrieve the index at which an error occurred, or -1 if the
      * error index has not been set.
+     *
+     * @return the index at which an error occurred
      * @since 1.2
      */
     public int getErrorIndex()
     {
         return errorIndex;
     }
+
     /**
      * Overrides equals
      */
diff --git a/ojluni/src/main/java/java/text/RuleBasedCollator.java b/ojluni/src/main/java/java/text/RuleBasedCollator.java
index 3c82624..a82080b 100755
--- a/ojluni/src/main/java/java/text/RuleBasedCollator.java
+++ b/ojluni/src/main/java/java/text/RuleBasedCollator.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1997, 2010, 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
@@ -53,9 +53,9 @@
  * for efficiency (other subclasses may be used for more complex languages) :
  * <ol>
  * <li>If a special collation rule controlled by a &lt;modifier&gt; is
- * specified it applies to the whole collator object.
+      specified it applies to the whole collator object.
  * <li>All non-mentioned characters are at the end of the
- * collation order.
+ *     collation order.
  * </ol>
  *
  * <p>
@@ -67,40 +67,40 @@
  *    &lt;reset&gt; &lt;text-argument&gt;
  * </pre>
  * The definitions of the rule elements is as follows:
- * <UL Type=disc>
- * <LI><strong>Text-Argument</strong>: A text-argument is any sequence of
- * characters, excluding special characters (that is, common
- * whitespace characters [0009-000D, 0020] and rule syntax characters
- * [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
- * characters are desired, you can put them in single quotes
- * (e.g. ampersand => '&'). Note that unquoted white space characters
- * are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
- * <LI><strong>Modifier</strong>: There are currently two modifiers that
- * turn on special collation rules.
- * <UL Type=square>
- * <LI>'@' : Turns on backwards sorting of accents (secondary
- * differences), as in French.
- * <LI>'!' : Turns on Thai/Lao vowel-consonant swapping.  If this
- * rule is in force when a Thai vowel of the range
- * &#92;U0E40-&#92;U0E44 precedes a Thai consonant of the range
- * &#92;U0E01-&#92;U0E2E OR a Lao vowel of the range &#92;U0EC0-&#92;U0EC4
- * precedes a Lao consonant of the range &#92;U0E81-&#92;U0EAE then
- * the vowel is placed after the consonant for collation
- * purposes.
- * </UL>
- * <p>'@' : Indicates that accents are sorted backwards, as in French.
- * <LI><strong>Relation</strong>: The relations are the following:
- * <UL Type=square>
- * <LI>'&lt;' : Greater, as a letter difference (primary)
- * <LI>';' : Greater, as an accent difference (secondary)
- * <LI>',' : Greater, as a case difference (tertiary)
- * <LI>'=' : Equal
- * </UL>
- * <LI><strong>Reset</strong>: There is a single reset
- * which is used primarily for contractions and expansions, but which
- * can also be used to add a modification at the end of a set of rules.
- * <p>'&' : Indicates that the next rule follows the position to where
- * the reset text-argument would be sorted.
+ * <UL>
+ *    <LI><strong>Text-Argument</strong>: A text-argument is any sequence of
+ *        characters, excluding special characters (that is, common
+ *        whitespace characters [0009-000D, 0020] and rule syntax characters
+ *        [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
+ *        characters are desired, you can put them in single quotes
+ *        (e.g. ampersand =&gt; '&amp;'). Note that unquoted white space characters
+ *        are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
+ *    <LI><strong>Modifier</strong>: There are currently two modifiers that
+ *        turn on special collation rules.
+ *        <UL>
+ *            <LI>'@' : Turns on backwards sorting of accents (secondary
+ *                      differences), as in French.
+ *            <LI>'!' : Turns on Thai/Lao vowel-consonant swapping.  If this
+ *                      rule is in force when a Thai vowel of the range
+ *                      &#92;U0E40-&#92;U0E44 precedes a Thai consonant of the range
+ *                      &#92;U0E01-&#92;U0E2E OR a Lao vowel of the range &#92;U0EC0-&#92;U0EC4
+ *                      precedes a Lao consonant of the range &#92;U0E81-&#92;U0EAE then
+ *                      the vowel is placed after the consonant for collation
+ *                      purposes.
+ *        </UL>
+ *        <p>'@' : Indicates that accents are sorted backwards, as in French.
+ *    <LI><strong>Relation</strong>: The relations are the following:
+ *        <UL>
+ *            <LI>'&lt;' : Greater, as a letter difference (primary)
+ *            <LI>';' : Greater, as an accent difference (secondary)
+ *            <LI>',' : Greater, as a case difference (tertiary)
+ *            <LI>'=' : Equal
+ *        </UL>
+ *    <LI><strong>Reset</strong>: There is a single reset
+ *        which is used primarily for contractions and expansions, but which
+ *        can also be used to add a modification at the end of a set of rules.
+ *        <p>'&amp;' : Indicates that the next rule follows the position to where
+ *            the reset text-argument would be sorted.
  * </UL>
  *
  * <p>
@@ -165,14 +165,14 @@
  * <p><strong>Errors</strong>
  * <p>
  * The following are errors:
- * <UL Type=disc>
- * <LI>A text-argument contains unquoted punctuation symbols
- * (e.g. "a &lt; b-c &lt; d").
- * <LI>A relation or reset character not followed by a text-argument
- * (e.g. "a &lt; ,b").
- * <LI>A reset where the text-argument (or an initial substring of the
- * text-argument) is not already in the sequence.
- * (e.g. "a &lt; b &amp; e &lt; f")
+ * <UL>
+ *     <LI>A text-argument contains unquoted punctuation symbols
+ *        (e.g. "a &lt; b-c &lt; d").
+ *     <LI>A relation or reset character not followed by a text-argument
+ *        (e.g. "a &lt; ,b").
+ *     <LI>A reset where the text-argument (or an initial substring of the
+ *         text-argument) is not already in the sequence.
+ *         (e.g. "a &lt; b &amp; e &lt; f")
  * </UL>
  * If you produce one of these errors, a <code>RuleBasedCollator</code> throws
  * a <code>ParseException</code>.
@@ -180,14 +180,14 @@
  * <p><strong>Examples</strong>
  * <p>Simple:     "&lt; a &lt; b &lt; c &lt; d"
  * <p>Norwegian:  "&lt; a, A &lt; b, B &lt; c, C &lt; d, D &lt; e, E &lt; f, F
- * &lt; g, G &lt; h, H &lt; i, I &lt; j, J &lt; k, K &lt; l, L
- * &lt; m, M &lt; n, N &lt; o, O &lt; p, P &lt; q, Q &lt; r, R
- * &lt; s, S &lt; t, T &lt; u, U &lt; v, V &lt; w, W &lt; x, X
- * &lt; y, Y &lt; z, Z
- * &lt; &#92;u00E6, &#92;u00C6
- * &lt; &#92;u00F8, &#92;u00D8
- * &lt; &#92;u00E5 = a&#92;u030A, &#92;u00C5 = A&#92;u030A;
- * aa, AA"
+ *                 &lt; g, G &lt; h, H &lt; i, I &lt; j, J &lt; k, K &lt; l, L
+ *                 &lt; m, M &lt; n, N &lt; o, O &lt; p, P &lt; q, Q &lt; r, R
+ *                 &lt; s, S &lt; t, T &lt; u, U &lt; v, V &lt; w, W &lt; x, X
+ *                 &lt; y, Y &lt; z, Z
+ *                 &lt; &#92;u00E6, &#92;u00C6
+ *                 &lt; &#92;u00F8, &#92;u00D8
+ *                 &lt; &#92;u00E5 = a&#92;u030A, &#92;u00C5 = A&#92;u030A;
+ *                      aa, AA"
  *
  * <p>
  * To create a <code>RuleBasedCollator</code> object with specialized
@@ -202,17 +202,11 @@
  * Or:
  * <blockquote>
  * <pre>
- * String Norwegian = "&lt; a, A &lt; b, B &lt; c, C &lt; d, D &lt; e, E &lt; f, F &lt; g, G &lt;
- * h,
- * H &lt; i, I" +
- *                    "&lt; j, J &lt; k, K &lt; l, L &lt; m, M &lt; n, N &lt; o, O &lt; p, P &lt;
- * q,
- * Q &lt; r, R" +
- *                    "&lt; s, S &lt; t, T &lt; u, U &lt; v, V &lt; w, W &lt; x, X &lt; y, Y &lt;
- * z,
- * Z" +
- *                    "&lt; &#92;u00E6, &#92;u00C6" +     // Latin letter ae & AE
- *                    "&lt; &#92;u00F8, &#92;u00D8" +     // Latin letter o & O with stroke
+ * String Norwegian = "&lt; a, A &lt; b, B &lt; c, C &lt; d, D &lt; e, E &lt; f, F &lt; g, G &lt; h, H &lt; i, I" +
+ *                    "&lt; j, J &lt; k, K &lt; l, L &lt; m, M &lt; n, N &lt; o, O &lt; p, P &lt; q, Q &lt; r, R" +
+ *                    "&lt; s, S &lt; t, T &lt; u, U &lt; v, V &lt; w, W &lt; x, X &lt; y, Y &lt; z, Z" +
+ *                    "&lt; &#92;u00E6, &#92;u00C6" +     // Latin letter ae &amp; AE
+ *                    "&lt; &#92;u00F8, &#92;u00D8" +     // Latin letter o &amp; O with stroke
  *                    "&lt; &#92;u00E5 = a&#92;u030A," +  // Latin letter a with ring above
  *                    "  &#92;u00C5 = A&#92;u030A;" +  // Latin letter A with ring above
  *                    "  aa, AA";
@@ -237,9 +231,9 @@
  *                 + ";&#92;u030B;&#92;u030C;&#92;u030D;&#92;u030E"    // main accents
  *                 + ";&#92;u030F;&#92;u0310;&#92;u0311;&#92;u0312"    // main accents
  *                 + "&lt; a , A ; ae, AE ; &#92;u00e6 , &#92;u00c6"
- *                 + "&lt; b , B &lt; c, C &lt; e, E & C &lt; d, D";
+ *                 + "&lt; b , B &lt; c, C &lt; e, E &amp; C &lt; d, D";
  * // change the order of accent characters
- * String addOn = "& &#92;u0300 ; &#92;u0308 ; &#92;u0302";
+ * String addOn = "&amp; &#92;u0300 ; &#92;u0308 ; &#92;u0302";
  * RuleBasedCollator myCollator = new RuleBasedCollator(oldRules + addOn);
  * </pre>
  * </blockquote>
@@ -278,13 +272,12 @@
      * RuleBasedCollator constructor.  This takes the table rules and builds
      * a collation table out of them.  Please see RuleBasedCollator class
      * description for more details on the collation rule syntax.
-     *
-     * @param rules the collation rules to build the collation table from.
-     * @throws ParseException A format exception
-     *                        will be thrown if the build process of the rules fails. For
-     *                        example, build rule "a < ? < d" will cause the constructor to
-     *                        throw the ParseException because the '?' is not quoted.
      * @see java.util.Locale
+     * @param rules the collation rules to build the collation table from.
+     * @exception ParseException A format exception
+     * will be thrown if the build process of the rules fails. For
+     * example, build rule "a &lt; ? &lt; d" will cause the constructor to
+     * throw the ParseException because the '?' is not quoted.
      */
     public RuleBasedCollator(String rules) throws ParseException {
         if (rules == null) {
@@ -313,13 +306,16 @@
      * @return returns the collation rules that the table collation object
      * was created from.
      */
-    public String getRules() {
+    public String getRules()
+    {
         return collAsICU().getRules();
     }
 
     /**
-     * Return a CollationElementIterator for the given String.
+     * Returns a CollationElementIterator for the given String.
      *
+     * @param source the string to be collated
+     * @return a {@code CollationElementIterator} object
      * @see java.text.CollationElementIterator
      */
     public CollationElementIterator getCollationElementIterator(String source) {
@@ -330,14 +326,16 @@
     }
 
     /**
-     * Return a CollationElementIterator for the given String.
+     * Returns a CollationElementIterator for the given CharacterIterator.
      *
+     * @param source the character iterator to be collated
+     * @return a {@code CollationElementIterator} object
      * @see java.text.CollationElementIterator
      * @since 1.2
      */
     public CollationElementIterator getCollationElementIterator(
-            CharacterIterator source) {
-        if (source == null) {
+                                                CharacterIterator source) {
+       if (source == null) {
             throw new NullPointerException("source == null");
         }
         return new CollationElementIterator(collAsICU().getCollationElementIterator(source));
@@ -349,9 +347,10 @@
      * than, greater than or equal to another string in a language.
      * This can be overriden in a subclass.
      *
-     * @throws NullPointerException if <code>source</code> or <code>target</code> is null.
+     * @exception NullPointerException if <code>source</code> or <code>target</code> is null.
      */
-    public synchronized int compare(String source, String target) {
+    public synchronized int compare(String source, String target)
+    {
         if (source == null || target == null) {
             throw new NullPointerException();
         }
@@ -363,7 +362,8 @@
      * with CollationKey.compareTo. This overrides java.text.Collator.getCollationKey.
      * It can be overriden in a subclass.
      */
-    public synchronized CollationKey getCollationKey(String source) {
+    public synchronized CollationKey getCollationKey(String source)
+    {
         if (source == null) {
             return null;
         }
@@ -379,7 +379,6 @@
 
     /**
      * Compares the equality of two collation objects.
-     *
      * @param obj the table-based collation object to be compared with this.
      * @return true if the current table-based collation object is the same
      * as the table-based collation object obj; false otherwise.
diff --git a/ojluni/src/main/java/java/text/SimpleDateFormat.java b/ojluni/src/main/java/java/text/SimpleDateFormat.java
index b435583..61eb11e 100755
--- a/ojluni/src/main/java/java/text/SimpleDateFormat.java
+++ b/ojluni/src/main/java/java/text/SimpleDateFormat.java
@@ -59,7 +59,7 @@
 /**
  * <code>SimpleDateFormat</code> is a concrete class for formatting and
  * parsing dates in a locale-sensitive manner. It allows for formatting
- * (date -> text), parsing (text -> date), and normalization.
+ * (date &rarr; text), parsing (text &rarr; date), and normalization.
  *
  * <p>
  * <code>SimpleDateFormat</code> allows you to start by choosing
@@ -73,7 +73,7 @@
  * For more information on using these methods, see
  * {@link DateFormat}.
  *
- * <h4>Date and Time Patterns</h4>
+ * <h3>Date and Time Patterns</h3>
  * <p>
  * Date and time formats are specified by <em>date and time pattern</em>
  * strings.
@@ -93,7 +93,7 @@
  * <code>'z'</code> are reserved):
  * <blockquote>
  * <table border=0 cellspacing=3 cellpadding=0 summary="Chart shows pattern letters, date/time component, presentation, and examples.">
- *     <tr bgcolor="#ccccff">
+ *     <tr style="background-color: rgb(204, 204, 255);">
  *         <th align=left>Letter
  *         <th align=left>Date or Time Component
  *         <th align=left>Presentation
@@ -103,7 +103,7 @@
  *         <td>Era designator
  *         <td><a href="#text">Text</a>
  *         <td><code>AD</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>y</code>
  *         <td>Year
  *         <td><a href="#year">Year</a>
@@ -113,9 +113,9 @@
  *         <td>Week year
  *         <td><a href="#year">Year</a>
  *         <td><code>2009</code>; <code>09</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>M</code>
- *         <td>Month in year
+ *         <td>Month in year (context sensitive)
  *         <td><a href="#month">Month</a>
  *         <td><code>July</code>; <code>Jul</code>; <code>07</code>
  *     <tr>
@@ -123,87 +123,87 @@
  *         <td>Week in year
  *         <td><a href="#number">Number</a>
  *         <td><code>27</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>W</code>
  *         <td>Week in month
  *         <td><a href="#number">Number</a>
  *         <td><code>2</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>D</code>
  *         <td>Day in year
  *         <td><a href="#number">Number</a>
  *         <td><code>189</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>d</code>
  *         <td>Day in month
  *         <td><a href="#number">Number</a>
  *         <td><code>10</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>F</code>
  *         <td>Day of week in month
  *         <td><a href="#number">Number</a>
  *         <td><code>2</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>E</code>
  *         <td>Day name in week
  *         <td><a href="#text">Text</a>
  *         <td><code>Tuesday</code>; <code>Tue</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>u</code>
  *         <td>Day number of week (1 = Monday, ..., 7 = Sunday)
  *         <td><a href="#number">Number</a>
  *         <td><code>1</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>a</code>
  *         <td>Am/pm marker
  *         <td><a href="#text">Text</a>
  *         <td><code>PM</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>H</code>
  *         <td>Hour in day (0-23)
  *         <td><a href="#number">Number</a>
  *         <td><code>0</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>k</code>
  *         <td>Hour in day (1-24)
  *         <td><a href="#number">Number</a>
  *         <td><code>24</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>K</code>
  *         <td>Hour in am/pm (0-11)
  *         <td><a href="#number">Number</a>
  *         <td><code>0</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>h</code>
  *         <td>Hour in am/pm (1-12)
  *         <td><a href="#number">Number</a>
  *         <td><code>12</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>m</code>
  *         <td>Minute in hour
  *         <td><a href="#number">Number</a>
  *         <td><code>30</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>s</code>
  *         <td>Second in minute
  *         <td><a href="#number">Number</a>
  *         <td><code>55</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>S</code>
  *         <td>Millisecond
  *         <td><a href="#number">Number</a>
  *         <td><code>978</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>z</code>
  *         <td>Time zone
  *         <td><a href="#timezone">General time zone</a>
  *         <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
- *     <tr>
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>Z</code>
  *         <td>Time zone
  *         <td><a href="#rfc822timezone">RFC 822 time zone</a>
  *         <td><code>-0800</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr>
  *         <td><code>X</code>
  *         <td>Time zone
  *         <td><a href="#iso8601timezone">ISO 8601 time zone</a>
@@ -341,7 +341,6 @@
  * may be replaced with other, locale dependent, pattern letters.
  * <code>SimpleDateFormat</code> does not deal with the localization of text
  * other than the pattern letters; that's up to the client of the class.
- * <p>
  *
  * <h4>Examples</h4>
  *
@@ -350,37 +349,37 @@
  * in the U.S. Pacific Time time zone.
  * <blockquote>
  * <table border=0 cellspacing=3 cellpadding=0 summary="Examples of date and time patterns interpreted in the U.S. locale">
- *     <tr bgcolor="#ccccff">
+ *     <tr style="background-color: rgb(204, 204, 255);">
  *         <th align=left>Date and Time Pattern
  *         <th align=left>Result
  *     <tr>
  *         <td><code>"yyyy.MM.dd G 'at' HH:mm:ss z"</code>
  *         <td><code>2001.07.04 AD at 12:08:56 PDT</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"EEE, MMM d, ''yy"</code>
  *         <td><code>Wed, Jul 4, '01</code>
  *     <tr>
  *         <td><code>"h:mm a"</code>
  *         <td><code>12:08 PM</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"hh 'o''clock' a, zzzz"</code>
  *         <td><code>12 o'clock PM, Pacific Daylight Time</code>
  *     <tr>
  *         <td><code>"K:mm a, z"</code>
  *         <td><code>0:08 PM, PDT</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code>
  *         <td><code>02001.July.04 AD 12:08 PM</code>
  *     <tr>
  *         <td><code>"EEE, d MMM yyyy HH:mm:ss Z"</code>
  *         <td><code>Wed, 4 Jul 2001 12:08:56 -0700</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"yyMMddHHmmssZ"</code>
  *         <td><code>010704120856-0700</code>
  *     <tr>
  *         <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSZ"</code>
  *         <td><code>2001-07-04T12:08:56.235-0700</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"</code>
  *         <td><code>2001-07-04T12:08:56.235-07:00</code>
  *     <tr>
@@ -397,7 +396,7 @@
  * If multiple threads access a format concurrently, it must be synchronized
  * externally.
  *
- * @see          <a href="http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html">Java Tutorial</a>
+ * @see          <a href="https://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html">Java Tutorial</a>
  * @see          java.util.Calendar
  * @see          java.util.TimeZone
  * @see          DateFormat
@@ -533,7 +532,8 @@
 
     /**
      * Constructs a <code>SimpleDateFormat</code> using the default pattern and
-     * date format symbols for the default locale.
+     * date format symbols for the default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * <b>Note:</b> This constructor may not support all locales.
      * For full coverage, use the factory methods in the {@link DateFormat}
      * class.
@@ -544,11 +544,17 @@
 
     /**
      * Constructs a <code>SimpleDateFormat</code> using the given pattern and
-     * the default date format symbols for the default locale.
+     * the default date format symbols for the default
+     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * <b>Note:</b> This constructor may not support all locales.
      * For full coverage, use the factory methods in the {@link DateFormat}
      * class.
+     * <p>This is equivalent to calling
+     * {@link #SimpleDateFormat(String, Locale)
+     *     SimpleDateFormat(pattern, Locale.getDefault(Locale.Category.FORMAT))}.
      *
+     * @see java.util.Locale#getDefault(java.util.Locale.Category)
+     * @see java.util.Locale.Category#FORMAT
      * @param pattern the pattern describing the date and time format
      * @exception NullPointerException if the given pattern is null
      * @exception IllegalArgumentException if the given pattern is invalid
@@ -871,7 +877,7 @@
     /**
      * Encodes the given tag and length and puts encoded char(s) into buffer.
      */
-    private static final void encode(int tag, int length, StringBuilder buffer) {
+    private static void encode(int tag, int length, StringBuilder buffer) {
         if (tag == PATTERN_ISO_ZONE && length >= 4) {
             throw new IllegalArgumentException("invalid ISO 8601 format: length=" + length);
         }
@@ -939,6 +945,7 @@
      * @return the formatted date-time string.
      * @exception NullPointerException if the given {@code date} is {@code null}.
      */
+    @Override
     public StringBuffer format(Date date, StringBuffer toAppendTo,
                                FieldPosition pos)
     {
@@ -997,6 +1004,7 @@
      * @return AttributedCharacterIterator describing the formatted value.
      * @since 1.4
      */
+    @Override
     public AttributedCharacterIterator formatToCharacterIterator(Object obj) {
         StringBuffer sb = new StringBuffer();
         CharacterIteratorFieldDelegate delegate = new
@@ -1020,18 +1028,28 @@
     }
 
     // Map index into pattern character string to Calendar field number
-    private static final int[] PATTERN_INDEX_TO_CALENDAR_FIELD =
-    {
-        Calendar.ERA, Calendar.YEAR, Calendar.MONTH, Calendar.DATE,
-        Calendar.HOUR_OF_DAY, Calendar.HOUR_OF_DAY, Calendar.MINUTE,
-        Calendar.SECOND, Calendar.MILLISECOND, Calendar.DAY_OF_WEEK,
-        Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK_IN_MONTH,
-        Calendar.WEEK_OF_YEAR, Calendar.WEEK_OF_MONTH,
-        Calendar.AM_PM, Calendar.HOUR, Calendar.HOUR, Calendar.ZONE_OFFSET,
+    private static final int[] PATTERN_INDEX_TO_CALENDAR_FIELD = {
+        Calendar.ERA,
+        Calendar.YEAR,
+        Calendar.MONTH,
+        Calendar.DATE,
+        Calendar.HOUR_OF_DAY,
+        Calendar.HOUR_OF_DAY,
+        Calendar.MINUTE,
+        Calendar.SECOND,
+        Calendar.MILLISECOND,
+        Calendar.DAY_OF_WEEK,
+        Calendar.DAY_OF_YEAR,
+        Calendar.DAY_OF_WEEK_IN_MONTH,
+        Calendar.WEEK_OF_YEAR,
+        Calendar.WEEK_OF_MONTH,
+        Calendar.AM_PM,
+        Calendar.HOUR,
+        Calendar.HOUR,
         Calendar.ZONE_OFFSET,
-        // Pseudo Calendar fields
-        CalendarBuilder.WEEK_YEAR,
-        CalendarBuilder.ISO_DAY_OF_WEEK,
+        Calendar.ZONE_OFFSET,
+        CalendarBuilder.WEEK_YEAR,         // Pseudo Calendar field
+        CalendarBuilder.ISO_DAY_OF_WEEK,   // Pseudo Calendar field
         Calendar.ZONE_OFFSET,
         // 'L' and 'c',
         Calendar.MONTH,
@@ -1040,16 +1058,27 @@
 
     // Map index into pattern character string to DateFormat field number
     private static final int[] PATTERN_INDEX_TO_DATE_FORMAT_FIELD = {
-        DateFormat.ERA_FIELD, DateFormat.YEAR_FIELD, DateFormat.MONTH_FIELD,
-        DateFormat.DATE_FIELD, DateFormat.HOUR_OF_DAY1_FIELD,
-        DateFormat.HOUR_OF_DAY0_FIELD, DateFormat.MINUTE_FIELD,
-        DateFormat.SECOND_FIELD, DateFormat.MILLISECOND_FIELD,
-        DateFormat.DAY_OF_WEEK_FIELD, DateFormat.DAY_OF_YEAR_FIELD,
-        DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD, DateFormat.WEEK_OF_YEAR_FIELD,
-        DateFormat.WEEK_OF_MONTH_FIELD, DateFormat.AM_PM_FIELD,
-        DateFormat.HOUR1_FIELD, DateFormat.HOUR0_FIELD,
-        DateFormat.TIMEZONE_FIELD, DateFormat.TIMEZONE_FIELD,
-        DateFormat.YEAR_FIELD, DateFormat.DAY_OF_WEEK_FIELD,
+        DateFormat.ERA_FIELD,
+        DateFormat.YEAR_FIELD,
+        DateFormat.MONTH_FIELD,
+        DateFormat.DATE_FIELD,
+        DateFormat.HOUR_OF_DAY1_FIELD,
+        DateFormat.HOUR_OF_DAY0_FIELD,
+        DateFormat.MINUTE_FIELD,
+        DateFormat.SECOND_FIELD,
+        DateFormat.MILLISECOND_FIELD,
+        DateFormat.DAY_OF_WEEK_FIELD,
+        DateFormat.DAY_OF_YEAR_FIELD,
+        DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD,
+        DateFormat.WEEK_OF_YEAR_FIELD,
+        DateFormat.WEEK_OF_MONTH_FIELD,
+        DateFormat.AM_PM_FIELD,
+        DateFormat.HOUR1_FIELD,
+        DateFormat.HOUR0_FIELD,
+        DateFormat.TIMEZONE_FIELD,
+        DateFormat.TIMEZONE_FIELD,
+        DateFormat.YEAR_FIELD,
+        DateFormat.DAY_OF_WEEK_FIELD,
         DateFormat.TIMEZONE_FIELD,
         // 'L' and 'c'
         DateFormat.MONTH_FIELD,
@@ -1058,14 +1087,27 @@
 
     // Maps from DecimalFormatSymbols index to Field constant
     private static final Field[] PATTERN_INDEX_TO_DATE_FORMAT_FIELD_ID = {
-        Field.ERA, Field.YEAR, Field.MONTH, Field.DAY_OF_MONTH,
-        Field.HOUR_OF_DAY1, Field.HOUR_OF_DAY0, Field.MINUTE,
-        Field.SECOND, Field.MILLISECOND, Field.DAY_OF_WEEK,
-        Field.DAY_OF_YEAR, Field.DAY_OF_WEEK_IN_MONTH,
-        Field.WEEK_OF_YEAR, Field.WEEK_OF_MONTH,
-        Field.AM_PM, Field.HOUR1, Field.HOUR0, Field.TIME_ZONE,
+        Field.ERA,
+        Field.YEAR,
+        Field.MONTH,
+        Field.DAY_OF_MONTH,
+        Field.HOUR_OF_DAY1,
+        Field.HOUR_OF_DAY0,
+        Field.MINUTE,
+        Field.SECOND,
+        Field.MILLISECOND,
+        Field.DAY_OF_WEEK,
+        Field.DAY_OF_YEAR,
+        Field.DAY_OF_WEEK_IN_MONTH,
+        Field.WEEK_OF_YEAR,
+        Field.WEEK_OF_MONTH,
+        Field.AM_PM,
+        Field.HOUR1,
+        Field.HOUR0,
         Field.TIME_ZONE,
-        Field.YEAR, Field.DAY_OF_WEEK,
+        Field.TIME_ZONE,
+        Field.YEAR,
+        Field.DAY_OF_WEEK,
         Field.TIME_ZONE,
         // 'L' and 'c'
         Field.MONTH,
@@ -1113,20 +1155,23 @@
         case PATTERN_ERA: // 'G'
             if (useDateFormatSymbols) {
                 String[] eras = formatData.getEras();
-                if (value < eras.length)
+                if (value < eras.length) {
                     current = eras[value];
+                }
             }
-            if (current == null)
+            if (current == null) {
                 current = "";
+            }
             break;
 
         case PATTERN_WEEK_YEAR: // 'Y'
         case PATTERN_YEAR:      // 'y'
             if (calendar instanceof GregorianCalendar) {
-                if (count != 2)
+                if (count != 2) {
                     zeroPaddingNumber(value, count, maxIntCount, buffer);
-                else // count == 2
-                    zeroPaddingNumber(value, 2, 2, buffer); // clip 1996 to 96
+                } else { // count == 2
+                    zeroPaddingNumber(value, 2, 2, buffer);
+                } // clip 1996 to 96
             } else {
                 if (current == null) {
                     zeroPaddingNumber(value, style == Calendar.LONG ? 1 : count,
@@ -1135,13 +1180,6 @@
             }
             break;
 
-        case PATTERN_STANDALONE_MONTH: // 'L'
-        {
-            current = formatMonth(count, value, maxIntCount, buffer, useDateFormatSymbols,
-                    true /* standalone */);
-            break;
-        }
-
         case PATTERN_MONTH: // 'M'
         {
             current = formatMonth(count, value, maxIntCount, buffer, useDateFormatSymbols,
@@ -1149,28 +1187,36 @@
             break;
         }
 
-        case PATTERN_HOUR_OF_DAY1: // 'k' 1-based.  eg, 23:59 + 1 hour =>> 24:59
-            if (current == null) {
-                if (value == 0)
-                    zeroPaddingNumber(calendar.getMaximum(Calendar.HOUR_OF_DAY)+1,
-                                      count, maxIntCount, buffer);
-                else
-                    zeroPaddingNumber(value, count, maxIntCount, buffer);
-            }
-            break;
-
-        case PATTERN_STANDALONE_DAY_OF_WEEK: // 'c'
+        case PATTERN_STANDALONE_MONTH: // 'L'
         {
-            current = formatWeekday(count, value, useDateFormatSymbols, true /* standalone */);
+            current = formatMonth(count, value, maxIntCount, buffer, useDateFormatSymbols,
+                    true /* standalone */);
             break;
         }
 
+        case PATTERN_HOUR_OF_DAY1: // 'k' 1-based.  eg, 23:59 + 1 hour =>> 24:59
+            if (current == null) {
+                if (value == 0) {
+                    zeroPaddingNumber(calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1,
+                                      count, maxIntCount, buffer);
+                } else {
+                    zeroPaddingNumber(value, count, maxIntCount, buffer);
+                }
+            }
+            break;
+
         case PATTERN_DAY_OF_WEEK: // 'E'
         {
             current = formatWeekday(count, value, useDateFormatSymbols, false /* standalone */);
             break;
         }
 
+        case PATTERN_STANDALONE_DAY_OF_WEEK: // 'c'
+        {
+            current = formatWeekday(count, value, useDateFormatSymbols, true /* standalone */);
+            break;
+        }
+
         case PATTERN_AM_PM:    // 'a'
             if (useDateFormatSymbols) {
                 String[] ampm = formatData.getAmPmStrings();
@@ -1180,11 +1226,12 @@
 
         case PATTERN_HOUR1:    // 'h' 1-based.  eg, 11PM + 1 hour =>> 12 AM
             if (current == null) {
-                if (value == 0)
-                    zeroPaddingNumber(calendar.getLeastMaximum(Calendar.HOUR)+1,
+                if (value == 0) {
+                    zeroPaddingNumber(calendar.getLeastMaximum(Calendar.HOUR) + 1,
                                       count, maxIntCount, buffer);
-                else
+                } else {
                     zeroPaddingNumber(value, count, maxIntCount, buffer);
+                }
             }
             break;
 
@@ -1334,7 +1381,7 @@
     /**
      * Formats a number with the specified minimum and maximum number of digits.
      */
-    private final void zeroPaddingNumber(int value, int minDigits, int maxDigits, StringBuffer buffer)
+    private void zeroPaddingNumber(int value, int minDigits, int maxDigits, StringBuffer buffer)
     {
         // Optimization for 1, 2 and 4 digit numbers. This should
         // cover most cases of formatting date/time related items.
@@ -1416,6 +1463,7 @@
      *         error, returns null.
      * @exception NullPointerException if <code>text</code> or <code>pos</code> is null.
      */
+    @Override
     public Date parse(String text, ParsePosition pos) {
         // Make sure the timezone associated with this dateformat instance (set via
         // {@code setTimeZone} isn't change as a side-effect of parsing a date.
@@ -1560,7 +1608,9 @@
         int i = 0;
         int count = data.length;
 
-        if (field == Calendar.DAY_OF_WEEK) i = 1;
+        if (field == Calendar.DAY_OF_WEEK) {
+            i = 1;
+        }
 
         // There may be multiple strings in the data[] array which begin with
         // the same prefix (e.g., Cerven and Cervenec (June and July) in Czech).
@@ -1792,7 +1842,7 @@
      * timeFields. Returns -start (for ParsePosition) if failed.
      * @param text the time text to be parsed.
      * @param start where to start parsing.
-     * @param ch the pattern character for the date field text to be parsed.
+     * @param patternCharIndex the index of the pattern character.
      * @param count the count of a pattern character.
      * @param obeyCount if true, then the next field directly abuts this one,
      * and we should use the count to know when to stop parsing.
@@ -1808,7 +1858,7 @@
                          boolean obeyCount, boolean[] ambiguousYear,
                          ParsePosition origPos,
                          boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) {
-        Number number = null;
+        Number number;
         int value = 0;
         ParsePosition pos = new ParsePosition(0);
         pos.index = start;
@@ -1826,7 +1876,9 @@
                 return -1;
             }
             char c = text.charAt(pos.index);
-            if (c != ' ' && c != '\t') break;
+            if (c != ' ' && c != '\t') {
+                break;
+            }
             ++pos.index;
         }
 
@@ -1929,16 +1981,6 @@
                 calb.set(field, value);
                 return pos.index;
 
-            case PATTERN_STANDALONE_MONTH: // 'L'.
-            {
-                final int idx = parseMonth(text, count, value, start, field, pos,
-                        useDateFormatSymbols, true /* isStandalone */, calb);
-                if (idx > 0) {
-                    return idx;
-                }
-                break parsing;
-            }
-
             case PATTERN_MONTH: // 'M'
             {
                 final int idx = parseMonth(text, count, value, start, field, pos,
@@ -1950,6 +1992,16 @@
                 break parsing;
             }
 
+            case PATTERN_STANDALONE_MONTH: // 'L'.
+            {
+                final int idx = parseMonth(text, count, value, start, field, pos,
+                        useDateFormatSymbols, true /* isStandalone */, calb);
+                if (idx > 0) {
+                    return idx;
+                }
+                break parsing;
+            }
+
             case PATTERN_HOUR_OF_DAY1: // 'k' 1-based.  eg, 23:59 + 1 hour =>> 24:59
                 if (!isLenient()) {
                     // Validate the hour value in non-lenient
@@ -1958,11 +2010,22 @@
                     }
                 }
                 // [We computed 'value' above.]
-                if (value == calendar.getMaximum(Calendar.HOUR_OF_DAY)+1)
+                if (value == calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1) {
                     value = 0;
+                }
                 calb.set(Calendar.HOUR_OF_DAY, value);
                 return pos.index;
 
+            case PATTERN_DAY_OF_WEEK:  // 'E'
+            {
+                final int idx = parseWeekday(text, start, field, useDateFormatSymbols,
+                        false /* standalone */, calb);
+                if (idx > 0) {
+                    return idx;
+                }
+                break parsing;
+            }
+
             case PATTERN_STANDALONE_DAY_OF_WEEK: // 'c'
             {
                 final int idx = parseWeekday(text, start, field, useDateFormatSymbols,
@@ -1974,18 +2037,6 @@
                 break parsing;
             }
 
-            case PATTERN_DAY_OF_WEEK:  // 'E'
-            {
-                final int idx = parseWeekday(text, start, field, useDateFormatSymbols,
-                        false /* standalone */, calb);
-                if (idx > 0) {
-                    return idx;
-                }
-
-                break parsing;
-            }
-
-
             case PATTERN_AM_PM:    // 'a'
                 if (useDateFormatSymbols) {
                     if ((index = matchString(text, start, Calendar.AM_PM,
@@ -2008,8 +2059,9 @@
                     }
                 }
                 // [We computed 'value' above.]
-                if (value == calendar.getLeastMaximum(Calendar.HOUR)+1)
+                if (value == calendar.getLeastMaximum(Calendar.HOUR) + 1) {
                     value = 0;
+                }
                 calb.set(Calendar.HOUR, value);
                 return pos.index;
 
@@ -2082,7 +2134,7 @@
                         break parsing;
                     }
 
-                    int sign = 0;
+                    int sign;
                     char c = text.charAt(pos.index);
                     if (c == 'Z') {
                         calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0);
@@ -2098,7 +2150,8 @@
                         ++pos.index;
                         break parsing;
                     }
-                    int i = subParseNumericZone(text, ++pos.index, sign, count, (count == 3), calb);
+                    int i = subParseNumericZone(text, ++pos.index, sign, count,
+                                                count == 3, calb);
                     if (i > 0) {
                         return i;
                     }
@@ -2146,10 +2199,10 @@
                     }
 
                     if (useFollowingMinusSignAsDelimiter && (value < 0) &&
-                            (((pos.index < text.length()) &&
-                                    (text.charAt(pos.index) != minusSign)) ||
-                                    ((pos.index == text.length()) &&
-                                            (text.charAt(pos.index - 1) == minusSign)))) {
+                        (((pos.index < text.length()) &&
+                         (text.charAt(pos.index) != minusSign)) ||
+                         ((pos.index == text.length()) &&
+                          (text.charAt(pos.index-1) == minusSign)))) {
                         value = -value;
                         pos.index--;
                     }
@@ -2270,13 +2323,14 @@
         for (int i = 0; i < pattern.length(); ++i) {
             char c = pattern.charAt(i);
             if (inQuote) {
-                if (c == '\'')
+                if (c == '\'') {
                     inQuote = false;
+                }
             }
             else {
-                if (c == '\'')
+                if (c == '\'') {
                     inQuote = true;
-                else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
+                } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
                     int ci = from.indexOf(c);
                     if (ci >= 0) {
                         // patternChars is longer than localPatternChars due
@@ -2294,8 +2348,9 @@
             }
             result.append(c);
         }
-        if (inQuote)
+        if (inQuote) {
             throw new IllegalArgumentException("Unfinished quote in pattern");
+        }
         return result.toString();
     }
 
@@ -2378,6 +2433,7 @@
      *
      * @return a clone of this <code>SimpleDateFormat</code>
      */
+    @Override
     public Object clone() {
         SimpleDateFormat other = (SimpleDateFormat) super.clone();
         other.formatData = (DateFormatSymbols) formatData.clone();
@@ -2389,6 +2445,7 @@
      *
      * @return the hash code value for this <code>SimpleDateFormat</code> object.
      */
+    @Override
     public int hashCode()
     {
         return pattern.hashCode();
@@ -2402,9 +2459,12 @@
      * @return true if the given object is equal to this
      * <code>SimpleDateFormat</code>
      */
+    @Override
     public boolean equals(Object obj)
     {
-        if (!super.equals(obj)) return false; // super does class check
+        if (!super.equals(obj)) {
+            return false; // super does class check
+        }
         SimpleDateFormat that = (SimpleDateFormat) obj;
         return (pattern.equals(that.pattern)
                 && formatData.equals(that.formatData));
diff --git a/ojluni/src/main/java/java/text/StringCharacterIterator.java b/ojluni/src/main/java/java/text/StringCharacterIterator.java
index 4d10518..66b5be6 100755
--- a/ojluni/src/main/java/java/text/StringCharacterIterator.java
+++ b/ojluni/src/main/java/java/text/StringCharacterIterator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2002, 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
@@ -59,6 +59,8 @@
 
     /**
      * Constructs an iterator with an initial index of 0.
+     *
+     * @param text the {@code String} to be iterated over
      */
     public StringCharacterIterator(String text)
     {
@@ -272,7 +274,7 @@
             return other;
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
diff --git a/ojluni/src/main/java/java/text/spi/DecimalFormatSymbolsProvider.java b/ojluni/src/main/java/java/text/spi/DecimalFormatSymbolsProvider.java
index d814a3a..d1d078c 100755
--- a/ojluni/src/main/java/java/text/spi/DecimalFormatSymbolsProvider.java
+++ b/ojluni/src/main/java/java/text/spi/DecimalFormatSymbolsProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -34,7 +34,17 @@
  * provide instances of the
  * {@link java.text.DecimalFormatSymbols DecimalFormatSymbols} class.
  *
+ * <p>The requested {@code Locale} may contain an <a
+ * href="../../util/Locale.html#def_locale_extension"> extension</a> for
+ * specifying the desired numbering system. For example, {@code "ar-u-nu-arab"}
+ * (in the BCP 47 language tag form) specifies Arabic with the Arabic-Indic
+ * digits and symbols, while {@code "ar-u-nu-latn"} specifies Arabic with the
+ * Latin digits and symbols. Refer to the <em>Unicode Locale Data Markup
+ * Language (LDML)</em> specification for numbering systems.
+ *
  * @since        1.6
+ * @see Locale#forLanguageTag(String)
+ * @see Locale#getExtension(char)
  */
 public abstract class DecimalFormatSymbolsProvider extends LocaleServiceProvider {
 
diff --git a/ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java b/ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java
new file mode 100644
index 0000000..73c67d8
--- /dev/null
+++ b/ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 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
+ * 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 jdk.net;
+
+import java.net.SocketOption;
+
+/**
+ * Defines extended socket options, beyond those defined in
+ * {@link java.net.StandardSocketOptions}. These options may be platform
+ * specific.
+ */
+//@jdk.Exported
+public final class ExtendedSocketOptions {
+
+    private static class ExtSocketOption<T> implements SocketOption<T> {
+        private final String name;
+        private final Class<T> type;
+        ExtSocketOption(String name, Class<T> type) {
+            this.name = name;
+            this.type = type;
+        }
+        @Override public String name() { return name; }
+        @Override public Class<T> type() { return type; }
+        @Override public String toString() { return name; }
+    }
+
+    private ExtendedSocketOptions() {}
+
+    /**
+     * Service level properties. When a security manager is installed,
+     * setting or getting this option requires a {@link NetworkPermission}
+     * {@code ("setOption.SO_FLOW_SLA")} or {@code "getOption.SO_FLOW_SLA"}
+     * respectively.
+     */
+    public static final SocketOption<SocketFlow> SO_FLOW_SLA = new
+        ExtSocketOption<SocketFlow>("SO_FLOW_SLA", SocketFlow.class);
+}
diff --git a/ojluni/src/main/java/jdk/net/NetworkPermission.java b/ojluni/src/main/java/jdk/net/NetworkPermission.java
new file mode 100644
index 0000000..420c74f
--- /dev/null
+++ b/ojluni/src/main/java/jdk/net/NetworkPermission.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 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
+ * 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 jdk.net;
+
+import java.security.BasicPermission;
+
+/**
+ * Legacy security code; do not use.
+ */
+
+//@jdk.Exported
+public final class NetworkPermission extends BasicPermission {
+
+    public NetworkPermission(String name) {
+        super("");
+    }
+
+    public NetworkPermission(String name, String actions) {
+        super("", "");
+    }
+}
diff --git a/ojluni/src/main/java/jdk/net/SocketFlow.java b/ojluni/src/main/java/jdk/net/SocketFlow.java
new file mode 100644
index 0000000..a8ca749
--- /dev/null
+++ b/ojluni/src/main/java/jdk/net/SocketFlow.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 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
+ * 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 jdk.net;
+
+import java.lang.annotation.Native;
+
+/**
+ * Represents the service level properties for the platform specific socket
+ * option {@link ExtendedSocketOptions#SO_FLOW_SLA}.
+ * <p>
+ * The priority and bandwidth parameters must be set before
+ * setting the socket option.
+ * <p>
+ * When the {@code SO_FLOW_SLA} option is set then it may not take effect
+ * immediately. If the value of the socket option is obtained with
+ * {@code getOption()} then the status may be returned as {@code INPROGRESS}
+ * until it takes effect. The priority and bandwidth values are only valid when
+ * the status is returned as OK.
+ * <p>
+ * When a security manager is installed, a {@link NetworkPermission}
+ * is required to set or get this option.
+ */
+//@jdk.Exported
+public class SocketFlow {
+
+    private static final int UNSET = -1;
+    @Native public static final int NORMAL_PRIORITY = 1;
+    @Native public static final int HIGH_PRIORITY = 2;
+
+    private int priority = NORMAL_PRIORITY;
+
+    private long bandwidth = UNSET;
+
+    private Status status = Status.NO_STATUS;
+
+    private SocketFlow() {}
+
+    /**
+     * Enumeration of the return values from the SO_FLOW_SLA
+     * socket option. Both setting and getting the option return
+     * one of these statuses, which reflect the state of socket's
+     * flow.
+     */
+//    @jdk.Exported
+    public enum Status {
+        /**
+         * Set or get socket option has not been called yet. Status
+         * values can only be retrieved after calling set or get.
+         */
+        NO_STATUS,
+        /**
+         * Flow successfully created.
+         */
+        OK,
+        /**
+         * Caller has no permission to create flow.
+         */
+        NO_PERMISSION,
+        /**
+         * Flow can not be created because socket is not connected.
+         */
+        NOT_CONNECTED,
+        /**
+         * Flow creation not supported for this socket.
+         */
+        NOT_SUPPORTED,
+        /**
+         * A flow already exists with identical attributes.
+         */
+        ALREADY_CREATED,
+        /**
+         * A flow is being created.
+         */
+        IN_PROGRESS,
+        /**
+         * Some other unspecified error.
+         */
+        OTHER
+    }
+
+    /**
+     * Creates a new SocketFlow that can be used to set the SO_FLOW_SLA
+     * socket option and create a socket flow.
+     */
+    public static SocketFlow create() {
+        return new SocketFlow();
+    }
+
+    /**
+     * Sets this SocketFlow's priority. Must be either NORMAL_PRIORITY
+     * HIGH_PRIORITY. If not set, a flow's priority is normal.
+     *
+     * @throws IllegalArgumentException if priority is not NORMAL_PRIORITY or
+     *         HIGH_PRIORITY.
+     */
+    public SocketFlow priority(int priority) {
+        if (priority != NORMAL_PRIORITY && priority != HIGH_PRIORITY) {
+            throw new IllegalArgumentException("invalid priority");
+        }
+        this.priority = priority;
+        return this;
+    }
+
+    /**
+     * Sets this SocketFlow's bandwidth. Must be greater than or equal to zero.
+     * A value of zero drops all packets for the socket.
+     *
+     * @throws IllegalArgumentException if bandwidth is less than zero.
+     */
+    public SocketFlow bandwidth(long bandwidth) {
+        if (bandwidth < 0) {
+            throw new IllegalArgumentException("invalid bandwidth");
+        } else {
+            this.bandwidth = bandwidth;
+        }
+        return this;
+    }
+
+    /**
+     * Returns this SocketFlow's priority.
+     */
+    public int priority() {
+        return priority;
+    }
+
+    /**
+     * Returns this SocketFlow's bandwidth.
+     *
+     * @return this SocketFlow's bandwidth, or {@code -1} if status is not OK.
+     */
+    public long bandwidth() {
+        return bandwidth;
+    }
+
+    /**
+     * Returns the Status value of this SocketFlow. NO_STATUS is returned
+     * if the object was not used in a call to set or get the option.
+     */
+    public Status status() {
+        return status;
+    }
+}
diff --git a/ojluni/src/main/java/jdk/net/Sockets.java b/ojluni/src/main/java/jdk/net/Sockets.java
new file mode 100644
index 0000000..1187eb3
--- /dev/null
+++ b/ojluni/src/main/java/jdk/net/Sockets.java
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 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
+ * 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 jdk.net;
+
+import java.net.*;
+import java.io.IOException;
+import java.io.FileDescriptor;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.lang.reflect.*;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Collections;
+import sun.net.ExtendedOptionsImpl;
+
+/**
+ * Defines static methods to set and get socket options defined by the
+ * {@link java.net.SocketOption} interface. All of the standard options defined
+ * by {@link java.net.Socket}, {@link java.net.ServerSocket}, and
+ * {@link java.net.DatagramSocket} can be set this way, as well as additional
+ * or platform specific options supported by each socket type.
+ * <p>
+ * The {@link #supportedOptions(Class)} method can be called to determine
+ * the complete set of options available (per socket type) on the
+ * current system.
+ * <p>
+ * When a security manager is installed, some non-standard socket options
+ * may require a security permission before being set or get.
+ * The details are specified in {@link ExtendedSocketOptions}. No permission
+ * is required for {@link java.net.StandardSocketOptions}.
+ *
+ * @see java.nio.channels.NetworkChannel
+ */
+//@jdk.Exported
+public class Sockets {
+
+    private final static HashMap<Class<?>,Set<SocketOption<?>>>
+        options = new HashMap<>();
+
+    static {
+        initOptionSets();
+        AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    initMethods();
+                    return null;
+                }
+            }
+        );
+    }
+
+    private static Method siSetOption;
+    private static Method siGetOption;
+    private static Method dsiSetOption;
+    private static Method dsiGetOption;
+
+    private static void initMethods() {
+        try {
+            Class<?> clazz = Class.forName("java.net.SocketSecrets");
+
+            siSetOption = clazz.getDeclaredMethod(
+                "setOption", Object.class,
+                SocketOption.class, Object.class
+            );
+            siSetOption.setAccessible(true);
+
+            siGetOption = clazz.getDeclaredMethod(
+                "getOption", Object.class, SocketOption.class
+            );
+            siGetOption.setAccessible(true);
+
+            dsiSetOption = clazz.getDeclaredMethod(
+                "setOption", DatagramSocket.class,
+                SocketOption.class, Object.class
+            );
+            dsiSetOption.setAccessible(true);
+
+            dsiGetOption = clazz.getDeclaredMethod(
+                "getOption", DatagramSocket.class, SocketOption.class
+            );
+            dsiGetOption.setAccessible(true);
+        } catch (ReflectiveOperationException e) {
+            throw new InternalError(e);
+        }
+    }
+
+    private static <T> void invokeSet(
+        Method method, Object socket,
+        SocketOption<T> option, T value) throws IOException
+    {
+        try {
+            method.invoke(null, socket, option, value);
+        } catch (Exception e) {
+            if (e instanceof InvocationTargetException) {
+                Throwable t = ((InvocationTargetException)e).getTargetException();
+                if (t instanceof IOException) {
+                    throw (IOException)t;
+                } else if (t instanceof RuntimeException) {
+                    throw (RuntimeException)t;
+                }
+            }
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static <T> T invokeGet(
+        Method method, Object socket, SocketOption<T> option) throws IOException
+    {
+        try {
+            return (T)method.invoke(null, socket, option);
+        } catch (Exception e) {
+            if (e instanceof InvocationTargetException) {
+                Throwable t = ((InvocationTargetException)e).getTargetException();
+                if (t instanceof IOException) {
+                    throw (IOException)t;
+                } else if (t instanceof RuntimeException) {
+                    throw (RuntimeException)t;
+                }
+            }
+            throw new RuntimeException(e);
+        }
+    }
+
+    private Sockets() {}
+
+    /**
+     * Sets the value of a socket option on a {@link java.net.Socket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     * @param value The value of the socket option. May be null for some
+     *              options.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IllegalArgumentException if the value is not valid for
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs, or socket is closed.
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> void setOption(Socket s, SocketOption<T> name, T value) throws IOException
+    {
+        if (!isSupported(Socket.class, name)) {
+            throw new UnsupportedOperationException(name.name());
+        }
+        invokeSet(siSetOption, s, name, value);
+    }
+
+    /**
+     * Returns the value of a socket option from a {@link java.net.Socket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     *
+     * @return The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> T getOption(Socket s, SocketOption<T> name) throws IOException
+    {
+        if (!isSupported(Socket.class, name)) {
+            throw new UnsupportedOperationException(name.name());
+        }
+        return invokeGet(siGetOption, s, name);
+    }
+
+    /**
+     * Sets the value of a socket option on a {@link java.net.ServerSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     * @param value The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IllegalArgumentException if the value is not valid for
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> void setOption(ServerSocket s, SocketOption<T> name, T value) throws IOException
+    {
+        if (!isSupported(ServerSocket.class, name)) {
+            throw new UnsupportedOperationException(name.name());
+        }
+        invokeSet(siSetOption, s, name, value);
+    }
+
+    /**
+     * Returns the value of a socket option from a {@link java.net.ServerSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     *
+     * @return The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> T getOption(ServerSocket s, SocketOption<T> name) throws IOException
+    {
+        if (!isSupported(ServerSocket.class, name)) {
+            throw new UnsupportedOperationException(name.name());
+        }
+        return invokeGet(siGetOption, s, name);
+    }
+
+    /**
+     * Sets the value of a socket option on a {@link java.net.DatagramSocket}
+     * or {@link java.net.MulticastSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     * @param value The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IllegalArgumentException if the value is not valid for
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> void setOption(DatagramSocket s, SocketOption<T> name, T value) throws IOException
+    {
+        if (!isSupported(s.getClass(), name)) {
+            throw new UnsupportedOperationException(name.name());
+        }
+        invokeSet(dsiSetOption, s, name, value);
+    }
+
+    /**
+     * Returns the value of a socket option from a
+     * {@link java.net.DatagramSocket} or {@link java.net.MulticastSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     *
+     * @return The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> T getOption(DatagramSocket s, SocketOption<T> name) throws IOException
+    {
+        if (!isSupported(s.getClass(), name)) {
+            throw new UnsupportedOperationException(name.name());
+        }
+        return invokeGet(dsiGetOption, s, name);
+    }
+
+    /**
+     * Returns a set of {@link java.net.SocketOption}s supported by the
+     * given socket type. This set may include standard options and also
+     * non standard extended options.
+     *
+     * @param socketType the type of java.net socket
+     *
+     * @throws IllegalArgumentException if socketType is not a valid
+     *         socket type from the java.net package.
+     */
+    public static Set<SocketOption<?>> supportedOptions(Class<?> socketType) {
+        Set<SocketOption<?>> set = options.get(socketType);
+        if (set == null) {
+            throw new IllegalArgumentException("unknown socket type");
+        }
+        return set;
+    }
+
+    private static boolean isSupported(Class<?> type, SocketOption<?> option) {
+        Set<SocketOption<?>> options = supportedOptions(type);
+        return options.contains(option);
+    }
+
+    private static void initOptionSets() {
+        boolean flowsupported = ExtendedOptionsImpl.flowSupported();
+
+        // Socket
+
+        Set<SocketOption<?>> set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_KEEPALIVE);
+        set.add(StandardSocketOptions.SO_SNDBUF);
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        set.add(StandardSocketOptions.SO_LINGER);
+        set.add(StandardSocketOptions.IP_TOS);
+        set.add(StandardSocketOptions.TCP_NODELAY);
+        if (flowsupported) {
+            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        }
+        set = Collections.unmodifiableSet(set);
+        options.put(Socket.class, set);
+
+        // ServerSocket
+
+        set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        set.add(StandardSocketOptions.IP_TOS);
+        set = Collections.unmodifiableSet(set);
+        options.put(ServerSocket.class, set);
+
+        // DatagramSocket
+
+        set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_SNDBUF);
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        set.add(StandardSocketOptions.IP_TOS);
+        if (flowsupported) {
+            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        }
+        set = Collections.unmodifiableSet(set);
+        options.put(DatagramSocket.class, set);
+
+        // MulticastSocket
+
+        set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_SNDBUF);
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        set.add(StandardSocketOptions.IP_TOS);
+        set.add(StandardSocketOptions.IP_MULTICAST_IF);
+        set.add(StandardSocketOptions.IP_MULTICAST_TTL);
+        set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
+        if (flowsupported) {
+            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        }
+        set = Collections.unmodifiableSet(set);
+        options.put(MulticastSocket.class, set);
+    }
+}
diff --git a/ojluni/src/main/java/jdk/net/package-info.java b/ojluni/src/main/java/jdk/net/package-info.java
new file mode 100644
index 0000000..b05d543
--- /dev/null
+++ b/ojluni/src/main/java/jdk/net/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+/**
+ * Platform specific socket options for the {@code java.net} and {@code java.nio.channels}
+ * socket classes.
+ */
+
+@jdk.Exported
+package jdk.net;
diff --git a/ojluni/src/main/java/sun/net/ExtendedOptionsImpl.java b/ojluni/src/main/java/sun/net/ExtendedOptionsImpl.java
new file mode 100644
index 0000000..94005e0
--- /dev/null
+++ b/ojluni/src/main/java/sun/net/ExtendedOptionsImpl.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 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
+ * 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.net;
+
+import java.net.*;
+import jdk.net.*;
+import java.io.IOException;
+import java.io.FileDescriptor;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.lang.reflect.Field;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * Contains the native implementation for extended socket options
+ * together with some other static utilities
+ */
+public class ExtendedOptionsImpl {
+
+    private ExtendedOptionsImpl() {}
+
+    public static void checkSetOptionPermission(SocketOption<?> option) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            return;
+        }
+        String check = "setOption." + option.name();
+        sm.checkPermission(new NetworkPermission(check));
+    }
+
+    public static void checkGetOptionPermission(SocketOption<?> option) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            return;
+        }
+        String check = "getOption." + option.name();
+        sm.checkPermission(new NetworkPermission(check));
+    }
+
+    public static void checkValueType(Object value, Class<?> type) {
+        if (!type.isAssignableFrom(value.getClass())) {
+            String s = "Found: " + value.getClass().toString() + " Expected: "
+                        + type.toString();
+            throw new IllegalArgumentException(s);
+        }
+    }
+
+    /*
+     * Extension native implementations
+     *
+     * SO_FLOW_SLA
+     */
+    // Android-changed: Linux does not support flow operations.
+    public static void setFlowOption(FileDescriptor fd, SocketFlow f) {
+        throw new UnsupportedOperationException("unsupported socket option");
+    }
+
+    public static void getFlowOption(FileDescriptor fd, SocketFlow f) {
+        throw new UnsupportedOperationException("unsupported socket option");
+    }
+
+    public static boolean flowSupported() {
+        return false;
+    }
+}
diff --git a/ojluni/src/main/java/sun/nio/ch/AsynchronousSocketChannelImpl.java b/ojluni/src/main/java/sun/nio/ch/AsynchronousSocketChannelImpl.java
index af20709..a106d41 100755
--- a/ojluni/src/main/java/sun/nio/ch/AsynchronousSocketChannelImpl.java
+++ b/ojluni/src/main/java/sun/nio/ch/AsynchronousSocketChannelImpl.java
@@ -39,6 +39,7 @@
 import java.util.concurrent.*;
 import java.util.concurrent.locks.*;
 import sun.net.NetHooks;
+import sun.net.ExtendedOptionsImpl;
 
 /**
  * Base implementation of AsynchronousSocketChannel
@@ -504,6 +505,9 @@
             set.add(StandardSocketOptions.SO_KEEPALIVE);
             set.add(StandardSocketOptions.SO_REUSEADDR);
             set.add(StandardSocketOptions.TCP_NODELAY);
+            if (ExtendedOptionsImpl.flowSupported()) {
+                set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
+            }
             return Collections.unmodifiableSet(set);
         }
     }
diff --git a/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java b/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
index d1b398fa..c93e82d 100755
--- a/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
+++ b/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
@@ -33,6 +33,7 @@
 import java.nio.channels.*;
 import java.nio.channels.spi.*;
 import java.util.*;
+import sun.net.ExtendedOptionsImpl;
 
 import dalvik.system.BlockGuard;
 import sun.net.ResourceManager;
@@ -321,6 +322,9 @@
             set.add(StandardSocketOptions.IP_MULTICAST_IF);
             set.add(StandardSocketOptions.IP_MULTICAST_TTL);
             set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
+            if (ExtendedOptionsImpl.flowSupported()) {
+                set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
+            }
             return Collections.unmodifiableSet(set);
         }
     }
diff --git a/ojluni/src/main/java/sun/nio/ch/Net.java b/ojluni/src/main/java/sun/nio/ch/Net.java
index 99d2629..24ea94c 100755
--- a/ojluni/src/main/java/sun/nio/ch/Net.java
+++ b/ojluni/src/main/java/sun/nio/ch/Net.java
@@ -30,11 +30,13 @@
 
 import java.io.*;
 import java.net.*;
+import jdk.net.*;
 import java.nio.channels.*;
 import java.util.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
+import sun.net.ExtendedOptionsImpl;
 
 
 class Net {                                             // package-private
@@ -337,6 +339,16 @@
 
         // only simple values supported by this method
         Class<?> type = name.type();
+
+        if (type == SocketFlow.class) {
+            SecurityManager sm = System.getSecurityManager();
+            if (sm != null) {
+                sm.checkPermission(new NetworkPermission("setOption.SO_FLOW_SLA"));
+            }
+            ExtendedOptionsImpl.setFlowOption(fd, (SocketFlow)value);
+            return;
+        }
+
         if (type != Integer.class && type != Boolean.class)
             throw new AssertionError("Should not reach here");
 
@@ -389,6 +401,16 @@
     {
         Class<?> type = name.type();
 
+        if (type == SocketFlow.class) {
+            SecurityManager sm = System.getSecurityManager();
+            if (sm != null) {
+                sm.checkPermission(new NetworkPermission("setOption.SO_FLOW_SLA"));
+            }
+            SocketFlow flow = SocketFlow.create();
+            ExtendedOptionsImpl.getFlowOption(fd, flow);
+            return flow;
+        }
+
         // only simple values supported by this method
         if (type != Integer.class && type != Boolean.class)
             throw new AssertionError("Should not reach here");
diff --git a/ojluni/src/main/java/sun/nio/ch/SocketChannelImpl.java b/ojluni/src/main/java/sun/nio/ch/SocketChannelImpl.java
index 453b15b..c73eec5 100755
--- a/ojluni/src/main/java/sun/nio/ch/SocketChannelImpl.java
+++ b/ojluni/src/main/java/sun/nio/ch/SocketChannelImpl.java
@@ -37,6 +37,7 @@
 import dalvik.system.BlockGuard;
 import sun.net.NetHooks;
 import sun.misc.IoTrace;
+import sun.net.ExtendedOptionsImpl;
 
 /**
  * An implementation of SocketChannels
@@ -240,6 +241,9 @@
             // additional options required by socket adaptor
             set.add(StandardSocketOptions.IP_TOS);
             set.add(ExtendedSocketOption.SO_OOBINLINE);
+            if (ExtendedOptionsImpl.flowSupported()) {
+                set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
+            }
             return Collections.unmodifiableSet(set);
         }
     }
diff --git a/ojluni/src/main/native/Register.cpp b/ojluni/src/main/native/Register.cpp
index 89dca05..cced144 100644
--- a/ojluni/src/main/native/Register.cpp
+++ b/ojluni/src/main/native/Register.cpp
@@ -46,7 +46,6 @@
 extern void register_java_lang_Float(JNIEnv*);
 extern void register_java_lang_ProcessEnvironment(JNIEnv*);
 extern void register_java_lang_Runtime(JNIEnv*);
-extern void register_java_lang_Shutdown(JNIEnv*);
 extern void register_java_lang_StrictMath(JNIEnv*);
 extern void register_java_lang_Math(JNIEnv*);
 extern void register_java_lang_System(JNIEnv*);
@@ -126,7 +125,6 @@
     register_java_lang_ProcessEnvironment(env);
     register_java_lang_Runtime(env);
     register_java_lang_System(env);
-    register_java_lang_Shutdown(env);
     register_java_lang_UNIXProcess(env);
     // register_java_net_InetAddress depends on java_lang_Float & Math being
     // fully registered (getMethodId on InetAddress class triggers its
diff --git a/ojluni/src/main/native/Shutdown.c b/ojluni/src/main/native/Shutdown.c
deleted file mode 100755
index f765a83..0000000
--- a/ojluni/src/main/native/Shutdown.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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 "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-
-#include "JNIHelp.h"
-
-#define NATIVE_METHOD(className, functionName, signature) \
-{ #functionName, signature, (void*)(className ## _ ## functionName) }
-
-
-JNIEXPORT void JNICALL
-Shutdown_halt0(JNIEnv *env, jclass ignored, jint code)
-{
-    JVM_Halt(code);
-}
-
-
-JNIEXPORT void JNICALL
-Shutdown_runAllFinalizers(JNIEnv *env, jclass ignored)
-{
-    jclass cl;
-    jmethodID mid;
-
-    if ((cl = (*env)->FindClass(env, "java/lang/ref/Finalizer"))
-        && (mid = (*env)->GetStaticMethodID(env, cl,
-                                            "runAllFinalizers", "()V"))) {
-        (*env)->CallStaticVoidMethod(env, cl, mid);
-    }
-}
-
-static JNINativeMethod gMethods[] = {
-  NATIVE_METHOD(Shutdown, halt0, "(I)V"),
-  NATIVE_METHOD(Shutdown, runAllFinalizers, "()V"),
-};
-
-void register_java_lang_Shutdown(JNIEnv* env) {
-  jniRegisterNativeMethods(env, "java/lang/Shutdown", gMethods, NELEM(gMethods));
-}
diff --git a/ojluni/src/main/native/net_util.h b/ojluni/src/main/native/net_util.h
index 74e8089..2f5cffd 100755
--- a/ojluni/src/main/native/net_util.h
+++ b/ojluni/src/main/native/net_util.h
@@ -40,7 +40,7 @@
 #define IPv6 AF_INET6
 
 #define NET_ERROR(env, ex, msg) \
-{ if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg) }
+{ if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg); }
 
 #define CHECK_NULL(x) if ((x) == NULL) return;
 #define CHECK_NULL_RETURN(x, y) if ((x) == NULL) return y;
diff --git a/ojluni/src/main/native/openjdksub.mk b/ojluni/src/main/native/openjdksub.mk
index e861230..6767354 100644
--- a/ojluni/src/main/native/openjdksub.mk
+++ b/ojluni/src/main/native/openjdksub.mk
@@ -69,7 +69,6 @@
     ProcessEnvironment_md.c \
     System.c \
     Runtime.c \
-    Shutdown.c \
     UNIXProcess_md.c \
     Bits.c \
     Character.cpp \
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index 26c9d83..1ab9ed6 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -107,7 +107,6 @@
     ojluni/src/main/java/java/lang/annotation/Target.java \
     ojluni/src/main/java/java/lang/annotation/package-info.java \
     ojluni/src/main/java/java/lang/Appendable.java \
-    ojluni/src/main/java/java/lang/ApplicationShutdownHooks.java \
     ojluni/src/main/java/java/lang/ArithmeticException.java \
     ojluni/src/main/java/java/lang/ArrayIndexOutOfBoundsException.java \
     ojluni/src/main/java/java/lang/ArrayStoreException.java \
@@ -1143,7 +1142,6 @@
     ojluni/src/main/java/com/sun/nio/file/ExtendedWatchEventModifier.java \
     ojluni/src/main/java/com/sun/nio/file/SensitivityWatchEventModifier.java \
     ojluni/src/main/java/java/beans/ChangeListenerMap.java \
-    ojluni/src/main/java/java/lang/Shutdown.java \
     ojluni/src/main/java/sun/misc/FDBigInteger.java \
     ojluni/src/main/java/sun/misc/FloatingDecimal.java \
     ojluni/src/main/java/java/text/spi/BreakIteratorProvider.java \
@@ -1156,6 +1154,10 @@
     ojluni/src/main/java/java/util/spi/LocaleNameProvider.java \
     ojluni/src/main/java/java/util/spi/LocaleServiceProvider.java \
     ojluni/src/main/java/java/util/spi/TimeZoneNameProvider.java \
+    ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java \
+    ojluni/src/main/java/jdk/net/NetworkPermission.java \
+    ojluni/src/main/java/jdk/net/SocketFlow.java \
+    ojluni/src/main/java/jdk/net/Sockets.java \
     ojluni/src/main/java/sun/misc/ASCIICaseInsensitiveComparator.java \
     ojluni/src/main/java/sun/misc/BASE64Decoder.java \
     ojluni/src/main/java/sun/misc/BASE64Encoder.java \
@@ -1195,6 +1197,7 @@
     ojluni/src/main/java/sun/misc/VM.java \
     ojluni/src/main/java/sun/net/ApplicationProxy.java \
     ojluni/src/main/java/sun/net/ConnectionResetException.java \
+    ojluni/src/main/java/sun/net/ExtendedOptionsImpl.java \
     ojluni/src/main/java/sun/net/ftp/FtpClient.java \
     ojluni/src/main/java/sun/net/ftp/FtpClientProvider.java \
     ojluni/src/main/java/sun/net/ftp/FtpDirEntry.java \
diff --git a/support/src/test/java/tests/support/Support_TestWebServer.java b/support/src/test/java/tests/support/Support_TestWebServer.java
index 33216a7..4ccf92c 100644
--- a/support/src/test/java/tests/support/Support_TestWebServer.java
+++ b/support/src/test/java/tests/support/Support_TestWebServer.java
@@ -84,12 +84,6 @@
     /* If set, this indicates the reason for redirection */
     int redirectCode = -1;
 
-    /* Set the number of connections the server will accept before shutdown */
-    int acceptLimit = 100;
-
-    /* Count of number of accepted connections */
-    int acceptedConnections = 0;
-
     public Support_TestWebServer() {
     }
 
@@ -166,14 +160,6 @@
     }
 
     /**
-     * Call this to specify the maximum number of sockets to accept
-     * @param limit The number of sockets to accept
-     */
-    public void setAcceptLimit(int limit) {
-        acceptLimit = limit;
-    }
-
-    /**
      * Call this to indicate redirection port requirement.
      * When this value is set, the server will respond to a request with
      * a redirect code with the Location response header set to the value
@@ -195,10 +181,6 @@
         return pathToRequest;
     }
 
-    public int getNumAcceptedConnections() {
-        return acceptedConnections;
-    }
-
     /**
      * Cause the thread accepting connections on the server socket to close
      */
@@ -217,12 +199,8 @@
     class AcceptThread extends Thread {
 
         ServerSocket ss = null;
-        boolean running = false;
+        volatile boolean closed = false;
 
-        /**
-         * @param port the port to use, or 0 to let the OS choose.
-         * Hard-coding ports is evil, so always pass 0!
-         */
         public int init() throws IOException {
             ss = new ServerSocket(0);
             ss.setSoTimeout(5000);
@@ -233,15 +211,10 @@
         /**
          * Main thread responding to new connections
          */
-        public synchronized void run() {
-            running = true;
-            while (running) {
+        public void run() {
+            while (!closed) {
                 try {
                     Socket s = ss.accept();
-                    acceptedConnections++;
-                    if (acceptedConnections >= acceptLimit) {
-                        running = false;
-                    }
                     new Thread(new Worker(s), "additional worker").start();
                 } catch (SocketException e) {
                     log(e.getMessage());
@@ -255,7 +228,7 @@
         // Close this socket
         public void close() {
             try {
-                running = false;
+                closed = true;
                 /* Stop server socket from processing further. Currently
                    this does not cause the SocketException from ss.accept
                    therefore the acceptLimit functionality has been added