On 6 March 2012 12:52, Gary Gregory <garydgreg...@gmail.com> wrote: > On Mar 6, 2012, at 6:47, sebb <seb...@gmail.com> wrote: > >> The errors are occuring because some testCases are leaving an item in >> the registry. >> If the next test is one that checks for an empty registry at the end, >> it will fail. >> >> It's very easy to check that the registry is always left empty by >> adding an @After method - I tried this and the code then fails for me >> on WinXP/Eclipse. >> >> I don't know if this is a bug in some test cases or a bug in the code >> - should the registry always be left clean, no matter what call >> sequence is used? >> Or are callers required to call toString() or whatever else it is that >> cleans up the registry? >> >> If so, should the main code be changed to clear the registry when >> creating a StringBuilder (just in case the previous user fails to >> clear up)? > > I do not think that would work because a caller can create more than > one builder and the registry is per thread IIRC. :(
Yes, the registry uses ThreadLocal currently. But if the caller uses multiple builders in a single thread, what stops the registry entries from interfering with each other? Was it a mistake to use ThreadLocal for the registry? Should it be per instance? I've not yet looked at the code in any detail; if anyone else knows how it is supposed to work, please shout! --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org