output: #fixed code
                               public BitSet getAvailablePieces() {
  		if (!this.isInitialized()) {
  			throw new IllegalStateException("Torrent not yet initialized!");
  		}
  
  		BitSet availablePieces = new BitSet(this.pieces.length);
  
  		synchronized (this.pieces) {
  			for (Piece piece : this.pieces) {
  				if (piece.available()) {
  					availablePieces.set(piece.getIndex());
  				}
  			}
  		}
  
  		return availablePieces;
  	}
input: #vulnerable code 
                               public BitSet getAvailablePieces() {
  		BitSet availablePieces = new BitSet(this.pieces.length);
  
  		synchronized (this.pieces) {
  			for (Piece piece : this.pieces) {
  				if (piece.available()) {
  					availablePieces.set(piece.getIndex());
  				}
  			}
  		}
  
  		return availablePieces;
  	} 
                              #location 4 
                              #vulnerability type THREAD_SAFETY_VIOLATION