Re: Code Review Request: 6953455 CookieStore.add() cannot handle null URI parameter, contrary to the API specification

2012-07-04 Thread Neil Richards
On Fri, 2011-09-30 at 10:08 -0700, Kurchi Hazra wrote:
> 
> 
> Hi,
> 
> The CookieStore.add() method throws a Null Pointer Exception when
> null is passed as the uri parameter, although this is allowed
> according to the method spec. 
> 
>  The exception is thrown because uri.getHost() is called on a null
> uri in an effort to add it to the uriIndex, one of the hash maps
> constituting the CookieStore. The fix would be to simply bypass adding
> the cookie to the uriIndex when uri is null.
>
> 
> The fix involves updates in: 
> src/share/classes/java/net/InMemoryCookieStore.java
> 
> Webrev : http://cr.openjdk.java.net/~chegar/6953455/webrev.00/webrev/ 
> 
> Thanks,
> Kurchi
> 

Hi,
This bug fix looks to have been well bedded into the openjdk 8 code
stream at this point.

Would this be a good item to be applied to the jdk7u code stream ?

Regards,
Neil

-- 
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



Re: Code Review Request: 6953455 CookieStore.add() cannot handle null URI parameter, contrary to the API specification

2012-07-04 Thread Chris Hegarty
Seems like a reasonable candidate for a backport. Are you encountering it in 7?

-Chris

On 4 Jul 2012, at 15:19, Neil Richards  wrote:

> On Fri, 2011-09-30 at 10:08 -0700, Kurchi Hazra wrote:
>> 
>> 
>> Hi,
>> 
>>The CookieStore.add() method throws a Null Pointer Exception when
>> null is passed as the uri parameter, although this is allowed
>> according to the method spec. 
>> 
>> The exception is thrown because uri.getHost() is called on a null
>> uri in an effort to add it to the uriIndex, one of the hash maps
>> constituting the CookieStore. The fix would be to simply bypass adding
>> the cookie to the uriIndex when uri is null.
>> 
>> 
>> The fix involves updates in: 
>> src/share/classes/java/net/InMemoryCookieStore.java
>> 
>> Webrev : http://cr.openjdk.java.net/~chegar/6953455/webrev.00/webrev/ 
>> 
>> Thanks,
>> Kurchi
>> 
> 
> Hi,
> This bug fix looks to have been well bedded into the openjdk 8 code
> stream at this point.
> 
> Would this be a good item to be applied to the jdk7u code stream ?
> 
> Regards,
> Neil
> 
> -- 
> 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
> 


InetAddress should utilize networkaddress.cache.ttl for getLocalHost() too

2012-07-04 Thread Deven You

Hi All,

I noticed that InetAddress.getLocalHost() uses cache to improve the 
performance. However the default implementation is caching local host 
within 5 seconds.


From the spec, networkaddress.cache.ttl should be used to control the 
cache behaviour and I think it is a better solution.


For example, if the networkaddress.cache.ttl is set to -1 which means 
always cache the local host then we can avoid unnecessary operations on 
getAddressesFromNameService to improve the performance.


I have made a patch for this solution, so anyone would like to take a look?

[1] http://cr.openjdk.java.net/~littlee/OJDK-527/webrev.00/ 


Thanks a lot!

--
Best Regards,

Deven