Program: 76061
Project: 76061
Buggy source:
/** 
 * Initialize/Reinitialize audio resources. First stop playback, and close any open sound files, if necessary. Then reread all parameters, create a new SoundPlayback object, and start playback of audio. <p> This method is synchronized since it is not safe to call SoundCapture methods while this method is executing.
 * @exception IllegalActionException If there is a problem initializingaudio playback.
 */
private synchronized void _initializeCapture() throws IllegalActionException {
  String modeStr=((StringToken)pathName.getToken()).stringValue();
  if (_debugging)   _debug("String_Node_Str" + modeStr);
  if (modeStr.equals("String_Node_Str")) {
    int sampleRateInt=((IntToken)sampleRate.getToken()).intValue();
    int sampleSizeInBitsInt=((IntToken)sampleSizeInBits.getToken()).intValue();
    int channelsInt=((IntToken)channels.getToken()).intValue();
    int bufferSizeInt=((IntToken)bufferSize.getToken()).intValue();
    _soundCapture=new SoundCapture((float)sampleRateInt,sampleSizeInBitsInt,channelsInt,bufferSizeInt,_getSampleSize);
    try {
      _soundCapture.startCapture();
    }
 catch (    IOException ex) {
      throw new IllegalActionException("String_Node_Str" + ex.getMessage());
    }
  }
 else {
    String theURL=((StringToken)pathName.getToken()).stringValue();
    _soundCapture=new SoundCapture(theURL,_getSampleSize);
    try {
      _soundCapture.startCapture();
    }
 catch (    IOException ex) {
      throw new IllegalActionException("String_Node_Str" + ex.getMessage());
    }
    _channels=_soundCapture.getChannels();
    channels.setToken(new IntToken(_channels));
  }
}

Fixed version (ground truth):
/** 
 * Initialize/Reinitialize audio resources. First stop playback, and close any open sound files, if necessary. Then reread all parameters, create a new SoundPlayback object, and start playback of audio. <p> This method is synchronized since it is not safe to call SoundCapture methods while this method is executing.
 * @exception IllegalActionException If there is a problem initializingaudio playback.
 */
private synchronized void _initializeCapture() throws IllegalActionException {
  if (_soundCapture != null) {
    try {
      _soundCapture.stopCapture();
    }
 catch (    IOException ex) {
      throw new IllegalActionException("String_Node_Str" + ex.getMessage());
    }
  }
  String modeStr=((StringToken)pathName.getToken()).stringValue();
  if (modeStr.equals("String_Node_Str")) {
    int sampleRateInt=((IntToken)sampleRate.getToken()).intValue();
    int sampleSizeInBitsInt=((IntToken)sampleSizeInBits.getToken()).intValue();
    int channelsInt=((IntToken)channels.getToken()).intValue();
    int bufferSizeInt=((IntToken)bufferSize.getToken()).intValue();
    _soundCapture=new SoundCapture((float)sampleRateInt,sampleSizeInBitsInt,channelsInt,bufferSizeInt,_getSampleSize);
    try {
      _soundCapture.startCapture();
    }
 catch (    IOException ex) {
      throw new IllegalActionException("String_Node_Str" + ex.getMessage());
    }
  }
 else {
    String theURL=((StringToken)pathName.getToken()).stringValue();
    _soundCapture=new SoundCapture(theURL,_getSampleSize);
    try {
      _soundCapture.startCapture();
    }
 catch (    IOException ex) {
      throw new IllegalActionException("String_Node_Str" + ex.getMessage());
    }
    _channels=_soundCapture.getChannels();
    channels.setToken(new IntToken(_channels));
  }
}