#fixed code
                              protected String readWord(final int index)
    throws IOException
  {
    FileWord w;
    int i;
    synchronized (cache) {
      final Cache.Entry entry = cache.get(index);
      i = entry.index;
      seek(entry.position);
      do {
        w = nextWord();
      } while (i++ < index && w != null);
      return w != null ? w.word : null;
    }
  }
#vulnerable code 
                              protected String readWord(final int index)
    throws IOException
  {
    int i = 0;
    if (!cache.isEmpty() && cache.firstKey() <= index) {
      i = cache.floorKey(index);
    }
    FileWord w;
    synchronized (cache) {
      position = i > 0 ? cache.get(i) : 0L;
      seek(position);
      do {
        w = nextWord();
      } while (i++ < index && w != null);
      return w != null ? w.word : null;
    }
  } 
                            #location 15 
                            #vulnerability type THREAD_SAFETY_VIOLATION