Re: RFR JDK-8027308: HttpURLConnection should better handle URLs with literal IPv6 addresses

2014-06-10 Thread Pavel Rappo
The latest webrev can be found at:

http://cr.openjdk.java.net/~prappo/8027308/webrev.02/

Thanks for all your comments. 

-Pavel

On 10 Jun 2014, at 06:48, Andreas Rieber  wrote:

> Hi Pavel,
> 
> it could be shorter and faster with this:
> 
>int pos;
>if (host.charAt(0) != '[' || (pos = host.indexOf('%')) == -1) {
>// not an IPv6-literal or doesn't contain zone info
>return host;
>}
> 
>return host.substring(0, pos) + "]";
> 
> A comment for the stripIpv6ZoneId would be nice as well.
> 
> cheers
> Andreas
> 
> On 09.06.2014 19:06, Pavel Rappo wrote:
>> Alan, it looks simpler, indeed:
>> 
>> http://cr.openjdk.java.net/~prappo/8027308/webrev.01/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java.sdiff.html
>> 
>> I have removed the StringBuilder completely. It doesn't seem to be a 
>> performance critical part of the code :) But from the readability 
>> perspective this is a lot better.
>> 
>> -Pavel
>> 
>> On 9 Jun 2014, at 07:49, Alan Bateman  wrote:
>> 
>>> On 09/06/2014 06:40, Chris Hegarty wrote:
 This looks good to me Pavel.
 
 -Chris.
>>> It looks okay to me too, I was just wondering if it would be simpler to use 
>>> host.substring + sb.append(']').
>>> 
>>> -Alan
>>> 
> 



Re: RFR JDK-8027308: HttpURLConnection should better handle URLs with literal IPv6 addresses

2014-06-10 Thread Chris Hegarty
On 10 Jun 2014, at 11:21, Pavel Rappo  wrote:

> The latest webrev can be found at:
> 
> http://cr.openjdk.java.net/~prappo/8027308/webrev.02/

This final version looks ok to me Pavel. I can sponsor it for you.

-Chris.


> Thanks for all your comments. 
> 
> -Pavel
> 
> On 10 Jun 2014, at 06:48, Andreas Rieber  wrote:
> 
>> Hi Pavel,
>> 
>> it could be shorter and faster with this:
>> 
>>   int pos;
>>   if (host.charAt(0) != '[' || (pos = host.indexOf('%')) == -1) {
>>   // not an IPv6-literal or doesn't contain zone info
>>   return host;
>>   }
>> 
>>   return host.substring(0, pos) + "]";
>> 
>> A comment for the stripIpv6ZoneId would be nice as well.
>> 
>> cheers
>> Andreas
>> 
>> On 09.06.2014 19:06, Pavel Rappo wrote:
>>> Alan, it looks simpler, indeed:
>>> 
>>> http://cr.openjdk.java.net/~prappo/8027308/webrev.01/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java.sdiff.html
>>> 
>>> I have removed the StringBuilder completely. It doesn't seem to be a 
>>> performance critical part of the code :) But from the readability 
>>> perspective this is a lot better.
>>> 
>>> -Pavel
>>> 
>>> On 9 Jun 2014, at 07:49, Alan Bateman  wrote:
>>> 
 On 09/06/2014 06:40, Chris Hegarty wrote:
> This looks good to me Pavel.
> 
> -Chris.
 It looks okay to me too, I was just wondering if it would be simpler to 
 use host.substring + sb.append(']').
 
 -Alan
 
>> 
>