jdk/src/share/classes/java/lang/SecurityManager.java
changeset 22342 c83795c442b7
parent 22116 49bb2cb8cb51
parent 22339 e91bfaf4360d
child 22581 e868cde95050
equal deleted inserted replaced
22256:191b8793a532 22342:c83795c442b7
  1104     /**
  1104     /**
  1105      * Throws a <code>SecurityException</code> if the
  1105      * Throws a <code>SecurityException</code> if the
  1106      * calling thread is not allowed to wait for a connection request on
  1106      * calling thread is not allowed to wait for a connection request on
  1107      * the specified local port number.
  1107      * the specified local port number.
  1108      * <p>
  1108      * <p>
  1109      * If port is not 0, this method calls
  1109      * This method calls <code>checkPermission</code> with the
  1110      * <code>checkPermission</code> with the
       
  1111      * <code>SocketPermission("localhost:"+port,"listen")</code>.
  1110      * <code>SocketPermission("localhost:"+port,"listen")</code>.
  1112      * If port is zero, this method calls <code>checkPermission</code>
       
  1113      * with <code>SocketPermission("localhost:1024-","listen").</code>
       
  1114      * <p>
  1111      * <p>
  1115      * If you override this method, then you should make a call to
  1112      * If you override this method, then you should make a call to
  1116      * <code>super.checkListen</code>
  1113      * <code>super.checkListen</code>
  1117      * at the point the overridden method would normally throw an
  1114      * at the point the overridden method would normally throw an
  1118      * exception.
  1115      * exception.
  1121      * @exception  SecurityException  if the calling thread does not have
  1118      * @exception  SecurityException  if the calling thread does not have
  1122      *             permission to listen on the specified port.
  1119      *             permission to listen on the specified port.
  1123      * @see        #checkPermission(java.security.Permission) checkPermission
  1120      * @see        #checkPermission(java.security.Permission) checkPermission
  1124      */
  1121      */
  1125     public void checkListen(int port) {
  1122     public void checkListen(int port) {
  1126         if (port == 0) {
  1123         checkPermission(new SocketPermission("localhost:"+port,
  1127             checkPermission(SecurityConstants.LOCAL_LISTEN_PERMISSION);
  1124             SecurityConstants.SOCKET_LISTEN_ACTION));
  1128         } else {
       
  1129             checkPermission(new SocketPermission("localhost:"+port,
       
  1130                 SecurityConstants.SOCKET_LISTEN_ACTION));
       
  1131         }
       
  1132     }
  1125     }
  1133 
  1126 
  1134     /**
  1127     /**
  1135      * Throws a <code>SecurityException</code> if the
  1128      * Throws a <code>SecurityException</code> if the
  1136      * calling thread is not permitted to accept a socket connection from
  1129      * calling thread is not permitted to accept a socket connection from