Code review: 8010464: Evolve java networking same origin policy
Michael McMahon
michael.x.mcmahon at oracle.com
Wed May 15 04:12:59 PDT 2013
On 15/05/13 12:02, Alan Bateman wrote:
> On 15/05/2013 11:34, Michael McMahon wrote:
>> :
>>
>>> On MessageHeader then getHeaderNamesInList could use
>>> java.util.StringJoiner to avoid rolling your own.
>>>
>>
>> I can see the benefit of using StringJoiner (and a lambda) if I am
>> starting off from a Collection
>> and this is something that only struck me when looking at this. I was
>> surprised
>> to see that Arrays.asList() doesn't have a variant that limits the
>> number of
>> elements coming from the array. So, I can't use it here. Maybe this
>> is something
>> we could look at again later, with the other changes we're contemplating?
> I think getHeaderNamesInList needs to be checked anyway as it looks to
> me that it just appends the keys and will never insert a comma.
>
> The only reason I suggested StringJoiner here is because I thought
> this method was trying to do this:
>
> StringJoiner joiner = new StringJoiner(",");
> for (int i=0; i<nkeys; i++) {
> joiner.add(keys[i]);
> }
> return joiner.toString();
>
well spotted and that's a simpler way of doing it. I messed the change
up from the previous revision.
It's unfortunate the actual end to end HttpURLConnection tests only use
one header in each
request. So, they didn't catch that. I'll update the test as well.
Thanks
Michael
>>
>> I'll post one more webrev, and push it soon afterwards as I'd like to
>> make the
>> code freeze today.
> Okay.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20130515/f74e04ea/attachment.html
More information about the net-dev
mailing list