SocketPermission's implies() interesting behavior

Charles Lee littlee at linux.vnet.ibm.com
Thu Mar 10 22:08:55 PST 2011


On 03/11/2011 02:33 AM, 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).
>
>
>> 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
The patch looks better. Thanks Neil.



More information about the net-dev mailing list