Re: [JGIT PATCH (RESEND) 3/3] Fix DirCache.findEntry to work on an empty cache
onsdag 02 september 2009 01:16:50 skrev "Shawn O. Pearce" <spearce@spearce.org>:
Show 10 quoted lines
> If the cache has no entries, we want to return -1 rather than throw
> ArrayIndexOutOfBoundsException. This binary search loop was stolen
> from some other code which contained a test before the loop to see if
> the collection was empty or not, but we failed to include that here.
>
> Flipping the loop around to a standard while loop ensures we test
> the condition properly first.
>
> Signed-off-by: Shawn O. Pearce <sop@google.com>
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Is this a new policy?
-- robin