#vulnerable code 
                             @Override
	public int write(ByteBuffer buffer, long offset) throws IOException {
		int requested = buffer.remaining();

		if (offset + requested > this.size) {
			throw new IllegalArgumentException("Invalid storage write request!");
		}

		return this.channel.write(buffer, offset);
	} 
                            #location 9 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                             @Override
	public int write(ByteBuffer buffer, long offset) throws IOException {
      try {
        myLock.writeLock().lock();
		int requested = buffer.remaining();

		if (offset + requested > this.size) {
			throw new IllegalArgumentException("Invalid storage write request!");
		}

		return this.channel.write(buffer, offset);
      } finally {
        myLock.writeLock().unlock();
      }
    }