Sean C. Sullivan wrote: >I updated the code for the HttpClient: > > Cookie.java > TestCookie.java > > >The modification changes the behavior of Cookie.getExpiryDate > >Instead of returning the internal Date object, we return a freshly >instantiated Date object. > >Why: Because java.util.Date is a mutable object. > >I created the patch files using this command: > > cvs diff -c Foo.java > Foo.patch > > -Sean > Hi Sean,
I'm not sure that the original behaviour is flawed as coded. The patch implies that passing setExpiryDate a Date object and then changing that object is a 'bad thing'. But this is the existing behaviour, so under the current code, I can do this: // uncompiled untested code Date d = new Date(); cookie.setExpiryDate(d); d.setTime(System.currentTimeMillis()); and based on the current code set, I expect the expiry date of the cookie to have changed. And ditto, on calling getExpiryDate() I expect to be able to change the Date and have it reflected in the cookie. The patch is effectively a change in the implied contract between httpclient and the user....Comments? -- dIon Gillard, Multitask Consulting http://www.multitask.com.au/developers -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
