Program: 103483
Project: 103483
Buggy source:
/** 
 * Initializes a new <tt>PortAudioAuto</tt> instance which creates PortAudio capture devices by enumerating all host devices with input channels.
 * @throws Exception if anything wrong happens while creating the PortAudiocapture devices
 */
PortAudioAuto() throws Exception {
  if (logger.isDebugEnabled())   Registry.set("String_Node_Str",true);
  int deviceCount=PortAudio.Pa_GetDeviceCount();
  int defaultInputDeviceIx=PortAudio.Pa_GetDefaultInputDevice();
  int defaultOutputDeviceIx=PortAudio.Pa_GetDefaultOutputDevice();
  Vector<CaptureDeviceInfo> playbackDevVector=new Vector<CaptureDeviceInfo>();
  int channels=1;
  int sampleSizeInBits=16;
  long sampleFormat=PortAudio.getPaSampleFormat(sampleSizeInBits);
  for (int deviceIndex=0; deviceIndex < deviceCount; deviceIndex++) {
    long deviceInfo=PortAudio.Pa_GetDeviceInfo(deviceIndex);
    int maxInputChannels=PortAudio.PaDeviceInfo_getMaxInputChannels(deviceInfo);
    int maxOutputChannels=PortAudio.PaDeviceInfo_getMaxOutputChannels(deviceInfo);
    String devName=PortAudio.PaDeviceInfo_getName(deviceInfo);
    if (devName != null)     devName=devName.trim();
    CaptureDeviceInfo jmfInfo=new CaptureDeviceInfo(devName,new MediaLocator(LOCATOR_PROTOCOL + "String_Node_Str" + deviceIndex),new Format[]{new AudioFormat(AudioFormat.LINEAR,(maxInputChannels > 0) ? getSupportedSampleRate(true,deviceIndex,channels,sampleFormat) : PortAudio.DEFAULT_SAMPLE_RATE,sampleSizeInBits,channels,AudioFormat.LITTLE_ENDIAN,AudioFormat.SIGNED,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED,Format.byteArray)});
    if (maxInputChannels > 0)     CaptureDeviceManager.addDevice(jmfInfo);
    if (maxOutputChannels > 0)     playbackDevVector.add(jmfInfo);
    if (deviceIndex == defaultInputDeviceIx)     defaultCaptureDevice=jmfInfo;
    if (deviceIndex == defaultOutputDeviceIx)     defaultPlaybackDevice=jmfInfo;
  }
  playbackDevices=playbackDevVector.toArray(new CaptureDeviceInfo[0]);
  CaptureDeviceManager.commit();
  DeviceConfiguration.addAudioSystem(DeviceConfiguration.AUDIO_SYSTEM_PORTAUDIO);
  supported=true;
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>PortAudioAuto</tt> instance which creates PortAudio capture devices by enumerating all host devices with input channels.
 * @throws Exception if anything wrong happens while creating the PortAudiocapture devices
 */
PortAudioAuto() throws Exception {
  if (logger.isDebugEnabled())   Registry.set("String_Node_Str",true);
  int deviceCount=PortAudio.Pa_GetDeviceCount();
  int defaultInputDeviceIx=PortAudio.Pa_GetDefaultInputDevice();
  int defaultOutputDeviceIx=PortAudio.Pa_GetDefaultOutputDevice();
  Vector<CaptureDeviceInfo> playbackDevVector=new Vector<CaptureDeviceInfo>();
  int channels=1;
  int sampleSizeInBits=16;
  long sampleFormat=PortAudio.getPaSampleFormat(sampleSizeInBits);
  for (int deviceIndex=0; deviceIndex < deviceCount; deviceIndex++) {
    long deviceInfo=PortAudio.Pa_GetDeviceInfo(deviceIndex);
    int maxInputChannels=PortAudio.PaDeviceInfo_getMaxInputChannels(deviceInfo);
    int maxOutputChannels=PortAudio.PaDeviceInfo_getMaxOutputChannels(deviceInfo);
    String devName=PortAudio.PaDeviceInfo_getName(deviceInfo);
    if (devName != null)     devName=devName.trim();
    CaptureDeviceInfo jmfInfo=new CaptureDeviceInfo(devName,new MediaLocator(LOCATOR_PROTOCOL + "String_Node_Str" + deviceIndex),new Format[]{new AudioFormat(AudioFormat.LINEAR,(maxInputChannels > 0) ? getSupportedSampleRate(true,deviceIndex,channels,sampleFormat) : PortAudio.DEFAULT_SAMPLE_RATE,sampleSizeInBits,channels,AudioFormat.LITTLE_ENDIAN,AudioFormat.SIGNED,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED,Format.byteArray)});
    if (maxInputChannels > 0) {
      CaptureDeviceManager.addDevice(jmfInfo);
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str" + devName + "String_Node_Str");
    }
    if (maxOutputChannels > 0) {
      playbackDevVector.add(jmfInfo);
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str" + devName + "String_Node_Str");
    }
    if (deviceIndex == defaultInputDeviceIx) {
      defaultCaptureDevice=jmfInfo;
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str" + devName + "String_Node_Str");
    }
    if (deviceIndex == defaultOutputDeviceIx) {
      defaultPlaybackDevice=jmfInfo;
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str" + devName + "String_Node_Str");
    }
  }
  playbackDevices=playbackDevVector.toArray(new CaptureDeviceInfo[0]);
  CaptureDeviceManager.commit();
  DeviceConfiguration.addAudioSystem(DeviceConfiguration.AUDIO_SYSTEM_PORTAUDIO);
  supported=true;
}