Program: 15924
Project: 15924
Buggy source:
/** 
 * Create and open the store.
 * @param config the configuration to use
 * @throws IllegalStateException if the file is corrupt, or an exceptionoccurred while opening
 * @throws IllegalArgumentException if the directory does not exist
 */
MVStore(HashMap<String,Object> config){
  this.compress=config.containsKey("String_Node_Str");
  Object o=config.get("String_Node_Str");
  pageSplitSize=o == null ? 6 * 1024 : (Integer)o;
  o=config.get("String_Node_Str");
  this.backgroundExceptionHandler=(UncaughtExceptionHandler)o;
  meta=new MVMapConcurrent<String,String>(StringDataType.INSTANCE,StringDataType.INSTANCE);
  HashMap<String,String> c=New.hashMap();
  c.put("String_Node_Str","String_Node_Str");
  c.put("String_Node_Str",Long.toString(currentVersion));
  meta.init(this,c);
  fileStore=(FileStore)config.get("String_Node_Str");
  String fileName=(String)config.get("String_Node_Str");
  if (fileName == null && fileStore == null) {
    cache=null;
    return;
  }
  if (fileStore == null) {
    fileStore=new FileStore();
  }
  retentionTime=fileStore.getDefaultRetentionTime();
  boolean readOnly=config.containsKey("String_Node_Str");
  o=config.get("String_Node_Str");
  int mb=o == null ? 16 : (Integer)o;
  int maxMemoryBytes=mb * 1024 * 1024;
  int averageMemory=pageSplitSize / 2;
  int segmentCount=16;
  int stackMoveDistance=maxMemoryBytes / averageMemory * 2 / 100;
  cache=new CacheLongKeyLIRS<Page>(maxMemoryBytes,averageMemory,segmentCount,stackMoveDistance);
  o=config.get("String_Node_Str");
  mb=o == null ? 4 : (Integer)o;
  int writeBufferSize=mb * 1024 * 1024;
  int div=pageSplitSize;
  unsavedPageCountMax=writeBufferSize / (div == 0 ? 1 : div);
  char[] encryptionKey=(char[])config.get("String_Node_Str");
  try {
    fileStore.open(fileName,readOnly,encryptionKey);
    if (fileStore.size() == 0) {
      creationTime=0;
      creationTime=getTime();
      lastStoreTime=creationTime;
      storeHeader.put("String_Node_Str","String_Node_Str");
      storeHeader.put("String_Node_Str","String_Node_Str" + BLOCK_SIZE);
      storeHeader.put("String_Node_Str","String_Node_Str" + FORMAT_WRITE);
      storeHeader.put("String_Node_Str","String_Node_Str" + creationTime);
      writeStoreHeader();
    }
 else {
      readStoreHeader();
      long format=DataUtils.parseLong(storeHeader.get("String_Node_Str"),0);
      if (format > FORMAT_WRITE && !fileStore.isReadOnly()) {
        throw DataUtils.newIllegalStateException(DataUtils.ERROR_UNSUPPORTED_FORMAT,"String_Node_Str" + "String_Node_Str",format,FORMAT_WRITE);
      }
      format=DataUtils.parseLong(storeHeader.get("String_Node_Str"),format);
      if (format > FORMAT_READ) {
        throw DataUtils.newIllegalStateException(DataUtils.ERROR_UNSUPPORTED_FORMAT,"String_Node_Str",format,FORMAT_READ);
      }
      if (rootChunkStart > 0) {
        readMeta();
      }
    }
    long rollback=DataUtils.parseLong(meta.get("String_Node_Str"),-1);
    if (rollback != -1) {
      rollbackTo(rollback);
    }
  }
 catch (  IllegalStateException e) {
    try {
      closeStore(false);
    }
 catch (    Exception e2) {
    }
    throw e;
  }
 finally {
    if (encryptionKey != null) {
      Arrays.fill(encryptionKey,(char)0);
    }
  }
  lastStoreTime=getTime();
  this.lastCommittedVersion=currentVersion;
  setWriteDelay(1000);
}

Fixed version (ground truth):
/** 
 * Create and open the store.
 * @param config the configuration to use
 * @throws IllegalStateException if the file is corrupt, or an exceptionoccurred while opening
 * @throws IllegalArgumentException if the directory does not exist
 */
MVStore(HashMap<String,Object> config){
  this.compress=config.containsKey("String_Node_Str");
  Object o=config.get("String_Node_Str");
  pageSplitSize=o == null ? 6 * 1024 : (Integer)o;
  o=config.get("String_Node_Str");
  this.backgroundExceptionHandler=(UncaughtExceptionHandler)o;
  meta=new MVMapConcurrent<String,String>(StringDataType.INSTANCE,StringDataType.INSTANCE);
  HashMap<String,String> c=New.hashMap();
  c.put("String_Node_Str","String_Node_Str");
  c.put("String_Node_Str",Long.toString(currentVersion));
  meta.init(this,c);
  fileStore=(FileStore)config.get("String_Node_Str");
  String fileName=(String)config.get("String_Node_Str");
  if (fileName == null && fileStore == null) {
    cache=null;
    return;
  }
  if (fileStore == null) {
    fileStore=new FileStore();
  }
  retentionTime=fileStore.getDefaultRetentionTime();
  boolean readOnly=config.containsKey("String_Node_Str");
  o=config.get("String_Node_Str");
  int mb=o == null ? 16 : (Integer)o;
  int maxMemoryBytes=mb * 1024 * 1024;
  int averageMemory=pageSplitSize / 2;
  int segmentCount=16;
  int stackMoveDistance=maxMemoryBytes / averageMemory * 2 / 100;
  cache=new CacheLongKeyLIRS<Page>(maxMemoryBytes,averageMemory,segmentCount,stackMoveDistance);
  o=config.get("String_Node_Str");
  mb=o == null ? 4 : (Integer)o;
  int writeBufferSize=mb * 1024 * 1024;
  int div=pageSplitSize;
  unsavedPageCountMax=writeBufferSize / (div == 0 ? 1 : div);
  char[] encryptionKey=(char[])config.get("String_Node_Str");
  try {
    fileStore.open(fileName,readOnly,encryptionKey);
    if (fileStore.size() == 0) {
      creationTime=0;
      creationTime=getTime();
      lastStoreTime=creationTime;
      storeHeader.put("String_Node_Str","String_Node_Str");
      storeHeader.put("String_Node_Str","String_Node_Str" + BLOCK_SIZE);
      storeHeader.put("String_Node_Str","String_Node_Str" + FORMAT_WRITE);
      storeHeader.put("String_Node_Str","String_Node_Str" + creationTime);
      writeStoreHeader();
    }
 else {
      readStoreHeader();
      long format=DataUtils.parseLong(storeHeader.get("String_Node_Str"),0);
      if (format > FORMAT_WRITE && !fileStore.isReadOnly()) {
        throw DataUtils.newIllegalStateException(DataUtils.ERROR_UNSUPPORTED_FORMAT,"String_Node_Str" + "String_Node_Str",format,FORMAT_WRITE);
      }
      format=DataUtils.parseLong(storeHeader.get("String_Node_Str"),format);
      if (format > FORMAT_READ) {
        throw DataUtils.newIllegalStateException(DataUtils.ERROR_UNSUPPORTED_FORMAT,"String_Node_Str",format,FORMAT_READ);
      }
      if (rootChunkStart > 0) {
        readMeta();
      }
    }
    long rollback=DataUtils.parseLong(meta.get("String_Node_Str"),-1);
    if (rollback != -1) {
      rollbackTo(rollback);
    }
  }
 catch (  IllegalStateException e) {
    try {
      closeStore(false);
    }
 catch (    Exception e2) {
    }
    throw e;
  }
 finally {
    if (encryptionKey != null) {
      Arrays.fill(encryptionKey,(char)0);
    }
  }
  lastStoreTime=getTime();
  this.lastCommittedVersion=currentVersion;
  o=config.get("String_Node_Str");
  int writeDelay=o == null ? 1000 : (Integer)o;
  setWriteDelay(writeDelay);
}