Source:
<code>private PackIndex idx(DfsReader ctx) throws IOException { DfsBlockCache.Ref<PackIndex> idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) return idx; } if (invalid) throw new PackInvalidException(getFileName()); Repository.getGlobalListenerList() .dispatch(new BeforeDfsPackIndexLoadedEvent(this)); synchronized (initLock) { idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) return idx; } DfsStreamKey idxKey = desc.getStreamKey(INDEX); try { idxref = cache.getOrLoadRef(idxKey, () -> { try { ctx.stats.readIdx++; long start = System.nanoTime(); try (ReadableChannel rc = ctx.db.openFile(desc, INDEX)) { InputStream in = Channels.newInputStream(rc); int wantSize = 8192; int bs = rc.blockSize(); <START> if (0 < bs && bs < wantSize) <END> bs = (wantSize / bs) * bs; else if (bs <= 0) bs = wantSize; PackIndex idx = PackIndex .read(new BufferedInputStream(in, bs)); int sz = (int) Math.min( idx.getObjectCount() * REC_SIZE, Integer.MAX_VALUE); ctx.stats.readIdxBytes += rc.position(); return new DfsBlockCache.Ref<>(idxKey, 0, sz, idx); } finally { ctx.stats.readIdxMicros += elapsedMicros(start); } } catch (EOFException e) { throw new IOException(MessageFormat.format( DfsText.get().shortReadOfIndex, desc.getFileName(INDEX)), e); } catch (IOException e) { throw new IOException(MessageFormat.format( DfsText.get().cannotReadIndex, desc.getFileName(INDEX)), e); } }); } catch (IOException e) { invalid = true; throw e; } PackIndex idx = idxref.get(); if (idx != null) { index = idxref; } return idx; } }</code><technical_language>style nit: missing braces</technical_language>

Target:
private PackIndex idx(DfsReader ctx) throws IOException { DfsBlockCache.Ref<PackIndex> idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) { return idx; } } if (invalid) { throw new PackInvalidException(getFileName()); } Repository.getGlobalListenerList() .dispatch(new BeforeDfsPackIndexLoadedEvent(this)); synchronized (initLock) { idxref = index; if (idxref != null) { PackIndex idx = idxref.get(); if (idx != null) { return idx; } } DfsStreamKey idxKey = desc.getStreamKey(INDEX); try { idxref = cache.getOrLoadRef(idxKey, () -> { try { ctx.stats.readIdx++; long start = System.nanoTime(); try (ReadableChannel rc = ctx.db.openFile(desc, INDEX)) { InputStream in = Channels.newInputStream(rc); int wantSize = 8192; int bs = rc.blockSize(); if (0 < bs && bs < wantSize) { bs = (wantSize / bs) * bs; } else if (bs <= 0) { bs = wantSize; } PackIndex idx = PackIndex .read(new BufferedInputStream(in, bs)); int sz = (int) Math.min( idx.getObjectCount() * REC_SIZE, Integer.MAX_VALUE); ctx.stats.readIdxBytes += rc.position(); return new DfsBlockCache.Ref<>(idxKey, 0, sz, idx); } finally { ctx.stats.readIdxMicros += elapsedMicros(start); } } catch (EOFException e) { throw new IOException(MessageFormat.format( DfsText.get().shortReadOfIndex, desc.getFileName(INDEX)), e); } catch (IOException e) { throw new IOException(MessageFormat.format( DfsText.get().cannotReadIndex, desc.getFileName(INDEX)), e); } }); } catch (IOException e) { invalid = true; throw e; } PackIndex idx = idxref.get(); if (idx != null) { index = idxref; } return idx; } }