harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1200) [classlib][net] SocketPermission.implies((Permission) null)) expected false but throws NPE
Date Tue, 15 Aug 2006 13:49:13 GMT
[classlib][net] SocketPermission.implies((Permission) null)) expected false but throws NPE
------------------------------------------------------------------------------------------

                 Key: HARMONY-1200
                 URL: http://issues.apache.org/jira/browse/HARMONY-1200
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Denis Kishenko


According spec and RI behavior SocketPermission.implies((Permission) null)) should return
FALSE while Harmony throws NPE

=================== Spec =====================

Checks if this socket permission object "implies" the specified permission. 
More specifically, this method first ensures that all of the following are true (and returns
false if any of them are not):

p is an instanceof SocketPermission,

p's actions are a proper subset of this object's actions, and

p's port range is included in this port range. Note: port range is ignored when p only contains
the action, 'resolve'.

Then implies checks each of the following, in order, and for each returns true if the stated
condition is true:

If this object was initialized with a single IP address and one of p's IP addresses is equal
to this object's IP address.

If this object is a wildcard domain (such as *.sun.com), and p's canonical name (the name
without any preceding *) ends with this object's canonical host name. For example, *.sun.com
implies *.eng.sun.com..

If this object was not initialized with a single IP address, and one of this object's IP addresses
equals one of p's IP addresses.

If this canonical name equals p's canonical name.

If none of the above are true, implies returns FALSE. 

===================== Test =====================

import java.net.*;
import java.security.Permission;

public class bug9446 {
    public static void main (String[] args) {
       try {
           SocketPermission sp = new SocketPermission("harmony", "connect");
           System.out.println("res=" + sp.implies((Permission) null));
       } catch (Exception e) {
           e.printStackTrace();
       }
    }
}

================== Output ====================== 

RI
res=false

Harmony
java.lang.NullPointerException
    at java.net.SocketPermission.implies(SocketPermission.java:242)
    at bug9446.main(bug9446.java:9)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message