Program: 30811
Project: 30811
Buggy source:
public BitmapIndexWriter(CairoConfiguration configuration,Path path,CharSequence name){
  long pageSize=configuration.getFilesFacade().getMapPageSize();
  int plen=path.length();
  try {
    BitmapIndexUtils.keyFileName(path,name);
    boolean exists=configuration.getFilesFacade().exists(path);
    this.keyMem=new ReadWriteMemory(configuration.getFilesFacade(),path,pageSize);
    if (!exists) {
      LOG.error().$(path).$("String_Node_Str").$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    long keyMemSize=this.keyMem.getAppendOffset();
    if (keyMemSize < BitmapIndexUtils.KEY_FILE_RESERVED) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    if (this.keyMem.getByte(BitmapIndexUtils.KEY_RESERVED_OFFSET_SIGNATURE) != BitmapIndexUtils.SIGNATURE) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.keyCount=this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_KEY_COUNT);
    if (keyMemSize != keyMemSize()) {
      LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(this.keyCount).$(']').$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    if (this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE_CHECK) != this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE)) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.valueMemSize=this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_VALUE_MEM_SIZE);
    BitmapIndexUtils.valueFileName(path.trimTo(plen),name);
    this.valueMem=new ReadWriteMemory(configuration.getFilesFacade(),path,pageSize);
    if (this.valueMem.getAppendOffset() != this.valueMemSize) {
      LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(this.valueMemSize).$(']').$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.blockValueCountMod=this.keyMem.getInt(BitmapIndexUtils.KEY_RESERVED_OFFSET_BLOCK_VALUE_COUNT) - 1;
    this.blockCapacity=(this.blockValueCountMod + 1) * 8 + BitmapIndexUtils.VALUE_BLOCK_FILE_RESERVED;
  }
 catch (  CairoException e) {
    this.close();
    throw e;
  }
 finally {
    path.trimTo(plen);
  }
}

Fixed version (ground truth):
public BitmapIndexWriter(CairoConfiguration configuration,Path path,CharSequence name){
  long pageSize=configuration.getFilesFacade().getMapPageSize();
  int plen=path.length();
  try {
    BitmapIndexUtils.keyFileName(path,name);
    boolean exists=configuration.getFilesFacade().exists(path);
    this.keyMem=new ReadWriteMemory(configuration.getFilesFacade(),path,pageSize);
    if (!exists) {
      LOG.error().$(path).$("String_Node_Str").$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    long keyMemSize=this.keyMem.getAppendOffset();
    if (keyMemSize < BitmapIndexUtils.KEY_FILE_RESERVED) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    if (this.keyMem.getByte(BitmapIndexUtils.KEY_RESERVED_OFFSET_SIGNATURE) != BitmapIndexUtils.SIGNATURE) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.keyCount=this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_KEY_COUNT);
    if (keyMemSize < keyMemSize()) {
      LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(this.keyCount).$(']').$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    if (this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE_CHECK) != this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE)) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.valueMemSize=this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_VALUE_MEM_SIZE);
    BitmapIndexUtils.valueFileName(path.trimTo(plen),name);
    this.valueMem=new ReadWriteMemory(configuration.getFilesFacade(),path,pageSize);
    if (this.valueMem.getAppendOffset() != this.valueMemSize) {
      LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(this.valueMemSize).$(']').$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.blockValueCountMod=this.keyMem.getInt(BitmapIndexUtils.KEY_RESERVED_OFFSET_BLOCK_VALUE_COUNT) - 1;
    this.blockCapacity=(this.blockValueCountMod + 1) * 8 + BitmapIndexUtils.VALUE_BLOCK_FILE_RESERVED;
  }
 catch (  CairoException e) {
    this.close();
    throw e;
  }
 finally {
    path.trimTo(plen);
  }
}