jdk/src/share/classes/java/net/Socket.java
changeset 10596 39b3a979e600
parent 10439 b36f86ad26e1
child 16061 c80133bafef0
equal deleted inserted replaced
10595:c5be3e19fbab 10596:39b3a979e600
     1 /*
     1 /*
     2  * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   457         // getDeclaredMethod, therefore we need permission to access the member
   457         // getDeclaredMethod, therefore we need permission to access the member
   458 
   458 
   459         oldImpl = AccessController.doPrivileged
   459         oldImpl = AccessController.doPrivileged
   460                                 (new PrivilegedAction<Boolean>() {
   460                                 (new PrivilegedAction<Boolean>() {
   461             public Boolean run() {
   461             public Boolean run() {
   462                 Class[] cl = new Class[2];
   462                 Class<?> clazz = impl.getClass();
   463                 cl[0] = SocketAddress.class;
       
   464                 cl[1] = Integer.TYPE;
       
   465                 Class clazz = impl.getClass();
       
   466                 while (true) {
   463                 while (true) {
   467                     try {
   464                     try {
   468                         clazz.getDeclaredMethod("connect", cl);
   465                         clazz.getDeclaredMethod("connect", SocketAddress.class, int.class);
   469                         return Boolean.FALSE;
   466                         return Boolean.FALSE;
   470                     } catch (NoSuchMethodException e) {
   467                     } catch (NoSuchMethodException e) {
   471                         clazz = clazz.getSuperclass();
   468                         clazz = clazz.getSuperclass();
   472                         // java.net.SocketImpl class will always have this abstract method.
   469                         // java.net.SocketImpl class will always have this abstract method.
   473                         // If we have not found it by now in the hierarchy then it does not
   470                         // If we have not found it by now in the hierarchy then it does not