Guilty as charged, fixed on my copy and never sent the patch back to the Restlet list. Will do when I get back from holiday travels!
On Fri, Dec 26, 2008 at 12:36 PM, Tim Peierls <t...@peierls.net> wrote: > On Fri, Dec 26, 2008 at 5:05 AM, Jerome Louvel <jerome.lou...@noelios.com > > wrote: > >> Also, Rob Heittman previously a CookieUtility class to the public domain: >> >> http://gogoego.googlecode.com/svn/trunk/modules/RestletFoundation/src/com/solertium/container/CookieUtility.java >> > > There is a race condition in this code, in newUniqueID: > > final long lincr = incr.getAndIncrement(); > if (lincr > Integer.MAX_VALUE) > incr.set(0); > > > I think Rob meant to fix this, but didn't get around to it. Here's a > reasonable fix for those lines: > > long lincr; > while (true) { > lincr = incr.get(); > long next = lincr < Integer.MAX_VALUE ? (lincr + 1) : 0; > if (incr.compareAndSet(lincr, next)) > break; > // Another thread interfered; try again. > } > > > --tim > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=993203