Code Review Request: 7051862: CookiePolicy spec conflicts with CookiePolicy.ACCEPT_ORIGINAL_SERVER

Chris Hegarty chris.hegarty at oracle.com
Thu Jun 6 02:07:50 PDT 2013


On 06/06/2013 01:06 AM, Kurchi Hazra wrote:
>
> Hi,
>
> Please review this change to fix 7051862. For ACCEPT_ORIGINAL_SERVER,
> shouldAccept() throws a NullPointerException for null arguments.
> Out of the many options to fix this, I think the best way is to return
> false if either of the arguments is null - based on the fact that
> HttpCookie.domainMathes() returns false for null arguments.

I agree with this change. It is a change in behavior ( returns false 
where use to throw NPE ) but unlikely to cause surprise. It is also 
worth noting that we cannot, easily, specify that shouldAccept throw NPE 
since there are two other concrete CookiePolicy instances that would 
need to change ( they would then throw NPE where previously returned 
true/false ), and that would arguably be more surprising.

Many a simple test? Or amend an existing one?

-Chris.

>
>   Bug: http://bugs.sun.com/view_bug.do?bug_id=7051862
>   Webrev: http://cr.openjdk.java.net/~khazra/7051862/webrev.00/
>
> Thanks,
> Kurchi
>



More information about the net-dev mailing list