SocketPermission's implies() interesting behavior

Neil Richards neil.richards at ngmr.net
Thu Mar 10 10:33:45 PST 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 7021280.1.diff
Type: text/x-patch
Size: 808 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/net-dev/attachments/20110310/f16ccc06/7021280.1.diff 


More information about the net-dev mailing list