SocketPermission's implies() interesting behavior

Chris Hegarty chris.hegarty at oracle.com
Fri Mar 11 06:39:40 PST 2011


On 10/03/2011 18:33, Neil Richards wrote:
> On 10 March 2011 03:18, Charles Lee<littlee at linux.vnet.ibm.com>  wrote:
>> With a quick search in the SocketPermission using "cname =" as search word,
>> cname always seems to be lower cases. But hostname does not. It may need
>> some rework on the patch.
>
> I think using String.regionMatches() [1] for the comparison (with
> 'ignoreCase' set to 'true') would solve the case-sensitivity problem.
>
> Please find attached an updated diff with how that would look.
> (Apols for not inlining it, I just know my current mail client would
> mangle it with line wrapping).

Thanks Neil,

I pulled your patch into a webrev, and made some minimal changes to 
explicitly state the this reference for instance fields. This style is 
in keeping with other parts of the SocketPermission code, and makes the 
code more readable when trying to debug it later :-)

http://cr.openjdk.java.net/~chegar/7021280/webrev.01/webrev/

As Michael (cc'ed) mentioned in an earlier mail, he is going to be 
making some significant changes in this area in the next week or two. He 
will include this change with the other one, so their impact can be 
considered together, if that is ok?

Oh, when looking for Michaels mail I noticed I can't find it in the 
net-dev archives. You may have missed it ( attached )

-Chris.

>> And more, every place where cname compare with another cname should use
>> normal equalsTo (equalsIgnoreCase is not needed). Every place where getName
>> and hostname is involved should use case-insensitive comparison. Any
>> opinion, Neil and Chris?
>
>  From a quick glance at the code, I think you're correct.
> However, I'd suggest making those improvements under a separate RFE,
> as they wouldn't directly relate to CR 7021280.
>
> Hope this helps,
> Neil
>
> [1] http://download.oracle.com/javase/6/docs/api/java/lang/String.html#regionMatches%28boolean,%20int,%20java.lang.String,%20int,%20int%29
>
> --
> Unless stated above:
> IBM email: neil_richards at uk.ibm.com
> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An embedded message was scrubbed...
From: Michael McMahon <michael.x.mcmahon at oracle.com>
Subject: Re: SocketPermission's implies() interesting behavior
Date: Thu, 03 Mar 2011 16:53:21 +0000
Size: 2227
Url: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20110311/99e5d5cd/AttachedMessage.nws 


More information about the net-dev mailing list