Browse Source

DfsBlockCache: Fix NPE when evicting empty cell

The cache starts with a single empty Ref that has no data, as the
clock list does not support being empty. When this Ref is removed,
the size has to be decremented from the associated DfsPackKey,
which was previously null. Make it always be non-null.

Change-Id: I2af99903e8039405ea6d67f383576ffa43839cff
stable-1.2
Shawn O. Pearce 13 years ago
parent
commit
a6677ef28a
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java

2
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java

@ -206,7 +206,7 @@ public final class DfsBlockCache {
blockSizeShift = Integer.numberOfTrailingZeros(blockSize);
clockLock = new ReentrantLock(true /* fair */);
clockHand = new Ref<Object>(null, -1, 0, null);
clockHand = new Ref<Object>(new DfsPackKey(), -1, 0, null);
clockHand.next = clockHand;
readAheadLimit = cfg.getReadAheadLimit();

Loading…
Cancel
Save