Program: 75875
Project: 75875
Buggy source:
/** 
 * Return an array of captured audio samples. This method should be repeatedly called to obtain audio data. The returned audio samples will have values in the range [-1, 1], regardless of the audio bit resolution (bits per sample). When capturing from the computer's audio input port (mic or line-in), this method should be called often enough to prevent overflow of the internal audio buffer. If overflow occurs, some audio data will be lost but no exception or other error condition will occur. If the audio data is not yet available, then this method will block until the data is available. When capturing from a sound file, it is not possible for overflow to occur. <p> The array size is set by the <i>getSamplesSize</i> parameter in the constructor. For the case where audio is captured from the computer's audio-in port (mic or line-in), this method should be called often enough to prevent overflow of the internal audio buffer, the size of which is set in the constructor.
 * @return Two dimensional array of captured audio samples.Return null if end of audio file is reached A null return value is only possible when capturing from a sound file. The first index represents the channel number (0 for first channel, 1 for second channel, etc.). The second index represents the sample index within a channel. For example, <i>returned array</i>[n][m] contains the (m+1)th sample of the (n+1)th channel. For each channel, n, the length of <i>returned array</i>[n] is equal to <i>getSamplesSize</i>.
 * @exception IOException If there is a problem capturing audio.
 * @exception IllegalStateException If audio capture is currentlyinactive. That is, If startCapture() has not yet been called or if stopCapture() has already been called.
 */
public double[][] getSamples() throws IOException, IllegalStateException {
  if (_isAudioCaptureActive == true) {
    int numBytesRead;
    if (_isRealTime == true) {
      numBytesRead=_targetLine.read(_data,0,_productionRate * _frameSizeInBytes);
    }
 else {
      numBytesRead=_properFormatAudioInputStream.read(_data);
    }
    if (numBytesRead == _data.length) {
      _audioInDoubleArray=_byteArrayToDoubleArray(_data,_bytesPerSample,_channels);
      return _audioInDoubleArray;
    }
 else     if (numBytesRead != _data.length) {
      return null;
    }
 else     if (numBytesRead == -1) {
      return null;
    }
    return null;
  }
 else {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Return an array of captured audio samples. This method should be repeatedly called to obtain audio data. The returned audio samples will have values in the range [-1, 1], regardless of the audio bit resolution (bits per sample). When capturing from the computer's audio input port (mic or line-in), this method should be called often enough to prevent overflow of the internal audio buffer. If overflow occurs, some audio data will be lost but no exception or other error condition will occur. If the audio data is not yet available, then this method will block until the data is available. When capturing from a sound file, it is not possible for overflow to occur. <p> The array size is set by the <i>getSamplesSize</i> parameter in the constructor. For the case where audio is captured from the computer's audio-in port (mic or line-in), this method should be called often enough to prevent overflow of the internal audio buffer, the size of which is set in the constructor.
 * @return Two dimensional array of captured audio samples.Return null if end of audio file is reached. A null return value is only possible when capturing from a sound file. The first index represents the channel number (0 for first channel, 1 for second channel, etc.). The second index represents the sample index within a channel. For example, <i>returned array</i>[n][m] contains the (m+1)th sample of the (n+1)th channel. For each channel, n, the length of <i>returned array</i>[n] is equal to <i>getSamplesSize</i>.
 * @exception IOException If there is a problem capturing audio.
 * @exception IllegalStateException If audio capture is currentlyinactive. That is, If startCapture() has not yet been called or if stopCapture() has already been called.
 */
public double[][] getSamples() throws IOException, IllegalStateException {
  if (_isAudioCaptureActive == true) {
    int numBytesRead;
    if (_isRealTime == true) {
      numBytesRead=_targetLine.read(_data,0,_productionRate * _frameSizeInBytes);
    }
 else {
      numBytesRead=_properFormatAudioInputStream.read(_data);
    }
    if (numBytesRead == _data.length) {
      _audioInDoubleArray=_byteArrayToDoubleArray(_data,_bytesPerSample,_channels);
      return _audioInDoubleArray;
    }
 else     if (numBytesRead != _data.length) {
      _audioInDoubleArray=_byteArrayToDoubleArray(_data,_bytesPerSample,_channels);
      return _audioInDoubleArray;
    }
 else     if (numBytesRead == -1) {
      return null;
    }
    return null;
  }
 else {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
}