src/share/classes/java/net/SocketPermission.java
Print this page
*** 136,146 ****
*
* @serial exclude
*/
public final class SocketPermission extends Permission
! implements java.io.Serializable
{
private static final long serialVersionUID = -7204263841984476862L;
/**
* Connect to host:port
--- 136,146 ----
*
* @serial exclude
*/
public final class SocketPermission extends Permission
! implements java.io.Serializable
{
private static final long serialVersionUID = -7204263841984476862L;
/**
* Connect to host:port
*** 230,241 ****
Boolean tmp = java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction("sun.net.trustNameService"));
trustNameService = tmp.booleanValue();
}
! private static synchronized Debug getDebug()
! {
if (!debugInit) {
debug = Debug.getInstance("access");
debugInit = true;
}
return debug;
--- 230,240 ----
Boolean tmp = java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction("sun.net.trustNameService"));
trustNameService = tmp.booleanValue();
}
! private static synchronized Debug getDebug() {
if (!debugInit) {
debug = Debug.getInstance("access");
debugInit = true;
}
return debug;
*** 286,297 ****
private void setDeny() {
defaultDeny = true;
}
! private static String getHost(String host)
! {
if (host.equals("")) {
return "localhost";
} else {
/* IPv6 literal address used in this context should follow
* the format specified in RFC 2732;
--- 285,295 ----
private void setDeny() {
defaultDeny = true;
}
! private static String getHost(String host) {
if (host.equals("")) {
return "localhost";
} else {
/* IPv6 literal address used in this context should follow
* the format specified in RFC 2732;
*** 808,818 ****
* @param p the permission to check against.
*
* @return true if the specified permission is implied by this object,
* false if not.
*/
-
public boolean implies(Permission p) {
int i,j;
if (!(p instanceof SocketPermission))
return false;
--- 806,815 ----
*** 842,857 ****
* attempt to match based on the wildcard.
* <li> If this object was not initialized with an IP address, attempt
* to find a match based on the IP addresses in both objects.
* <li> Attempt to match on the canonical hostnames of both objects.
* </ul>
! * @param p the incoming permission request
*
* @return true if "permission" is a proper subset of the current object,
* false if not.
*/
-
boolean impliesIgnoreMask(SocketPermission that) {
int i,j;
if ((that.mask & RESOLVE) != that.mask) {
// check port range
--- 839,853 ----
* attempt to match based on the wildcard.
* <li> If this object was not initialized with an IP address, attempt
* to find a match based on the IP addresses in both objects.
* <li> Attempt to match on the canonical hostnames of both objects.
* </ul>
! * @param that the incoming permission request
*
* @return true if "permission" is a proper subset of the current object,
* false if not.
*/
boolean impliesIgnoreMask(SocketPermission that) {
int i,j;
if ((that.mask & RESOLVE) != that.mask) {
// check port range
*** 1227,1237 ****
*
* @serial include
*/
final class SocketPermissionCollection extends PermissionCollection
! implements Serializable
{
// Not serialized; see serialization section at end of class
private transient List<SocketPermission> perms;
/**
--- 1223,1233 ----
*
* @serial include
*/
final class SocketPermissionCollection extends PermissionCollection
! implements Serializable
{
// Not serialized; see serialization section at end of class
private transient List<SocketPermission> perms;
/**
*** 1253,1265 ****
* SocketPermission
*
* @exception SecurityException - if this SocketPermissionCollection object
* has been marked readonly
*/
!
! public void add(Permission permission)
! {
if (! (permission instanceof SocketPermission))
throw new IllegalArgumentException("invalid permission: "+
permission);
if (isReadOnly())
throw new SecurityException(
--- 1249,1259 ----
* SocketPermission
*
* @exception SecurityException - if this SocketPermissionCollection object
* has been marked readonly
*/
! public void add(Permission permission) {
if (! (permission instanceof SocketPermission))
throw new IllegalArgumentException("invalid permission: "+
permission);
if (isReadOnly())
throw new SecurityException(
*** 1274,1284 ****
/**
* Check and see if this collection of permissions implies the permissions
* expressed in "permission".
*
! * @param p the Permission object to compare
*
* @return true if "permission" is a proper subset of a permission in
* the collection, false if not.
*/
--- 1268,1278 ----
/**
* Check and see if this collection of permissions implies the permissions
* expressed in "permission".
*
! * @param permission the Permission object to compare
*
* @return true if "permission" is a proper subset of a permission in
* the collection, false if not.
*/
*** 1367,1378 ****
}
/*
* Reads in a Vector of SocketPermissions and saves them in the perms field.
*/
! private void readObject(ObjectInputStream in) throws IOException,
! ClassNotFoundException {
// Don't call in.defaultReadObject()
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();
--- 1361,1373 ----
}
/*
* Reads in a Vector of SocketPermissions and saves them in the perms field.
*/
! private void readObject(ObjectInputStream in)
! throws IOException, ClassNotFoundException
! {
// Don't call in.defaultReadObject()
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();