changeset 10891:74f8ec38d1ac

Merge
author asaha
date Mon, 13 Apr 2015 22:44:12 -0700
parents e7c32c6758c0 9692664b2bc9
children 39f3f16bbc96
files .hgtags
diffstat 4 files changed, 100 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Mar 04 15:12:09 2015 -0800
+++ b/.hgtags	Mon Apr 13 22:44:12 2015 -0700
@@ -383,6 +383,8 @@
 d168113f9841a77b3cee3a6a45fcd85b7351ac90 jdk8u40-b22
 41fe61722ce96b75dd3a1ba5072473122e21e5a0 jdk8u40-b23
 9d903721276c8684706db7ecfb6cda568e9f4f69 jdk8u40-b24
+f0d5cb59b0e6a67fa102465458cc4725c6e59089 jdk8u40-b25
+97f258823d7d8ee0ec7d774b79cd30492520cc10 jdk8u40-b26
 1ecc234bd38950a2bc047aa253a5e803f0836a4e jdk8u45-b00
 e0c7864bbca3f76cde680722f2ae58dff2bff61d jdk8u45-b01
 9505c0392cddbfb905401e9fccc23262edc3254f jdk8u45-b02
@@ -392,6 +394,9 @@
 85ffe9aa18ac7c7fc474af03c61e4e96bb045796 jdk8u45-b06
 cdf1a9436aec569615913b96734df7a0e77c20e5 jdk8u45-b07
 6656dca5d05913fa204c79754624cd8fe77d7b49 jdk8u45-b08
+1083da8a8ec17058de5a35be3e5a821affc19e4e jdk8u45-b09
+3edfbb32b3c04941eedc551c02d4eec1e0f92078 jdk8u45-b10
+c669323bd55ac59ad26c7ee4f47a6daefc82af8e jdk8u45-b11
 ac97b69b88e37c18c1b077be8b1f100b6803fea5 jdk8u51-b00
 2e0732282470f7a02d57af5fc8542efa9db7b3e4 jdk8u51-b01
 cc75137936f9a8e97017e7e18b1064b76238116f jdk8u51-b02
--- a/THIRD_PARTY_README	Wed Mar 04 15:12:09 2015 -0800
+++ b/THIRD_PARTY_README	Mon Apr 13 22:44:12 2015 -0700
@@ -1250,7 +1250,7 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libpng 1.5.4, which may be 
+%% This notice is provided with respect to libpng 1.6.16, which may be
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
@@ -1266,8 +1266,8 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
-Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
@@ -1364,7 +1364,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-July 7, 2011
+December 22, 2014
 
 --- end of LICENSE ---
 
--- a/src/share/classes/java/net/SocksSocketImpl.java	Wed Mar 04 15:12:09 2015 -0800
+++ b/src/share/classes/java/net/SocksSocketImpl.java	Mon Apr 13 22:44:12 2015 -0700
@@ -388,14 +388,13 @@
             }
             while (iProxy.hasNext()) {
                 p = iProxy.next();
-                if (p == null || p == Proxy.NO_PROXY) {
+                if (p == null || p.type() != Proxy.Type.SOCKS) {
                     super.connect(epoint, remainingMillis(deadlineMillis));
                     return;
                 }
-                if (p.type() != Proxy.Type.SOCKS)
-                    throw new SocketException("Unknown proxy type : " + p.type());
+
                 if (!(p.address() instanceof InetSocketAddress))
-                    throw new SocketException("Unknow address type for proxy: " + p);
+                    throw new SocketException("Unknown address type for proxy: " + p);
                 // Use getHostString() to avoid reverse lookups
                 server = ((InetSocketAddress) p.address()).getHostString();
                 serverPort = ((InetSocketAddress) p.address()).getPort();
@@ -703,13 +702,12 @@
             }
             while (iProxy.hasNext()) {
                 p = iProxy.next();
-                if (p == null || p == Proxy.NO_PROXY) {
+                if (p == null || p.type() != Proxy.Type.SOCKS) {
                     return;
                 }
-                if (p.type() != Proxy.Type.SOCKS)
-                    throw new SocketException("Unknown proxy type : " + p.type());
+
                 if (!(p.address() instanceof InetSocketAddress))
-                    throw new SocketException("Unknow address type for proxy: " + p);
+                    throw new SocketException("Unknown address type for proxy: " + p);
                 // Use getHostString() to avoid reverse lookups
                 server = ((InetSocketAddress) p.address()).getHostString();
                 serverPort = ((InetSocketAddress) p.address()).getPort();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/Socks/BadProxySelector.java	Mon Apr 13 22:44:12 2015 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7178362
+ * @run main/othervm BadProxySelector
+ */
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.io.*;
+
+public class BadProxySelector {
+    public static void main(String[] args) throws Exception {
+        ProxySelector.setDefault(new HTTPProxySelector());
+        try (ServerSocket ss = new ServerSocket(0);
+             Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
+             Socket s2 = ss.accept()) {
+        }
+
+       ProxySelector.setDefault(new NullHTTPProxySelector());
+        try (ServerSocket ss = new ServerSocket(0);
+             Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
+             Socket s2 = ss.accept()) {
+        }
+    }
+
+    // always returns bogus HTTP proxies
+    private static class HTTPProxySelector extends ProxySelector {
+        @Override
+        public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {}
+
+        @Override
+        public List<Proxy> select(URI uri) {
+            List<Proxy> proxies = new ArrayList<>();
+            proxies.add(new Proxy(Proxy.Type.HTTP,
+                                  new InetSocketAddress("localhost", 0)));
+            proxies.add(new Proxy(Proxy.Type.HTTP,
+                                  new InetSocketAddress("localhost", 0)));
+            return proxies;
+        }
+    }
+
+    private static class NullHTTPProxySelector extends ProxySelector {
+        @Override
+        public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {}
+
+        @Override
+        public List<Proxy> select(URI uri) {
+            List<Proxy> proxies = new ArrayList<>();
+            proxies.add(null);
+            proxies.add(new Proxy(Proxy.Type.HTTP,
+                                  new InetSocketAddress("localhost", 0)));
+            return proxies;
+        }
+    }
+}