Program: 155151
Project: 155151
Buggy source:
/** 
 * Acquires a windows for <CODE>position</CODE> and <CODE>operationType</CODE> locking the window preventing other threads from using it.
 * @param position The position the needs to be encapsulated by the window
 * @param operationType The type of operation (READ or WRITE)
 * @return A locked window encapsulating the position
 * @throws IOException If unable to acquire the window
 */
PersistenceWindow acquire(long position,OperationType operationType){
  LockableWindow window=null;
synchronized (activeRowWindows) {
    if (brickMiss >= REFRESH_BRICK_COUNT) {
      brickMiss=0;
      refreshBricks();
    }
    if (brickSize > 0) {
      int brickIndex=(int)(position * blockSize / brickSize);
      if (brickIndex < brickArray.length) {
        window=brickArray[brickIndex].getWindow();
        if (window != null && !window.encapsulates(position)) {
          log.severe("String_Node_Str" + position + "String_Node_Str"+ brickIndex+ "String_Node_Str"+ blockSize+ "String_Node_Str"+ brickSize+ "String_Node_Str"+ window);
          throw new RuntimeException("String_Node_Str");
        }
        brickArray[brickIndex].setHit();
      }
 else {
        expandBricks(brickIndex + 1);
        window=brickArray[brickIndex].getWindow();
      }
    }
    if (window == null) {
      miss++;
      brickMiss++;
      PersistenceRow dpw=activeRowWindows.get(position);
      if (dpw == null) {
        dpw=new PersistenceRow(position,blockSize,fileChannel);
        if (operationType == OperationType.READ) {
          dpw.readPosition();
        }
      }
      window=dpw;
      activeRowWindows.put((int)position,dpw);
    }
 else {
      hit++;
    }
    window.mark();
  }
  window.lock();
  window.setOperationType(operationType);
  return window;
}

Fixed version (ground truth):
/** 
 * Acquires a windows for <CODE>position</CODE> and <CODE>operationType</CODE> locking the window preventing other threads from using it.
 * @param position The position the needs to be encapsulated by the window
 * @param operationType The type of operation (READ or WRITE)
 * @return A locked window encapsulating the position
 * @throws IOException If unable to acquire the window
 */
PersistenceWindow acquire(long position,OperationType operationType){
  LockableWindow window=null;
synchronized (activeRowWindows) {
    if (brickMiss >= REFRESH_BRICK_COUNT) {
      brickMiss=0;
      refreshBricks();
    }
    if (brickSize > 0) {
      int brickIndex=(int)(position * blockSize / brickSize);
      if (brickIndex < brickArray.length) {
        window=brickArray[brickIndex].getWindow();
        if (window != null && !window.encapsulates(position)) {
          log.severe("String_Node_Str" + position + "String_Node_Str"+ brickIndex+ "String_Node_Str"+ blockSize+ "String_Node_Str"+ brickSize+ "String_Node_Str"+ window);
          throw new RuntimeException("String_Node_Str");
        }
        brickArray[brickIndex].setHit();
      }
 else {
        expandBricks(brickIndex + 1);
        window=brickArray[brickIndex].getWindow();
      }
    }
    if (window == null) {
      miss++;
      brickMiss++;
      PersistenceRow dpw=activeRowWindows.get((int)position);
      if (dpw == null) {
        dpw=new PersistenceRow(position,blockSize,fileChannel);
        if (operationType == OperationType.READ) {
          dpw.readPosition();
        }
      }
      window=dpw;
      activeRowWindows.put((int)position,dpw);
    }
 else {
      hit++;
    }
    window.mark();
  }
  window.lock();
  window.setOperationType(operationType);
  return window;
}