Program: 19737
Project: 19737
Buggy source:
public Data getData() throws DataProcessingException {
  Data data=getPredecessor().getData();
  if (data instanceof DataStartSignal) {
    baos=new ByteArrayOutputStream();
    dos=new DataOutputStream(baos);
    sampleRate=((DataStartSignal)data).getSampleRate();
  }
  if ((data instanceof DataEndSignal && !captureUtts) || (data instanceof SpeechEndSignal && captureUtts)) {
    AudioFormat wavFormat=new AudioFormat(sampleRate,bitsPerSample,1,isSigned,true);
    AudioFileFormat.Type outputType=getTargetType("String_Node_Str");
    String wavName=outPattern + getNextFreeIndex(outPattern) + "String_Node_Str";
    byte[] abAudioData=baos.toByteArray();
    ByteArrayInputStream bais=new ByteArrayInputStream(abAudioData);
    AudioInputStream ais=new AudioInputStream(bais,wavFormat,abAudioData.length / wavFormat.getFrameSize());
    File outWavFile=new File(wavName);
    if (AudioSystem.isFileTypeSupported(outputType,ais)) {
      try {
        AudioSystem.write(ais,outputType,outWavFile);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    isInSpeech=false;
  }
  if (data instanceof SpeechStartSignal)   isInSpeech=true;
  if (isInSpeech || !captureUtts) {
    DoubleData dd=data instanceof DoubleData ? (DoubleData)data : DataUtil.FloatData2DoubleData((FloatData)data);
    double[] values=dd.getValues();
    for (    double value : values) {
      try {
        dos.writeShort(new Short((short)value));
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    if (data instanceof FloatData) {
      throw new RuntimeException("String_Node_Str");
    }
  }
  return data;
}

Fixed version (ground truth):
public Data getData() throws DataProcessingException {
  Data data=getPredecessor().getData();
  if (data instanceof DataStartSignal)   sampleRate=((DataStartSignal)data).getSampleRate();
  if (data instanceof DataStartSignal || (data instanceof SpeechStartSignal && captureUtts)) {
    baos=new ByteArrayOutputStream();
    dos=new DataOutputStream(baos);
  }
  if ((data instanceof DataEndSignal && !captureUtts) || (data instanceof SpeechEndSignal && captureUtts)) {
    AudioFormat wavFormat=new AudioFormat(sampleRate,bitsPerSample,1,isSigned,true);
    AudioFileFormat.Type outputType=getTargetType("String_Node_Str");
    String wavName=outPattern + getNextFreeIndex(outPattern) + "String_Node_Str";
    byte[] abAudioData=baos.toByteArray();
    ByteArrayInputStream bais=new ByteArrayInputStream(abAudioData);
    AudioInputStream ais=new AudioInputStream(bais,wavFormat,abAudioData.length / wavFormat.getFrameSize());
    File outWavFile=new File(wavName);
    if (AudioSystem.isFileTypeSupported(outputType,ais)) {
      try {
        AudioSystem.write(ais,outputType,outWavFile);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    isInSpeech=false;
  }
  if (data instanceof SpeechStartSignal)   isInSpeech=true;
  if ((data instanceof DoubleData || data instanceof FloatData) && (isInSpeech || !captureUtts)) {
    DoubleData dd=data instanceof DoubleData ? (DoubleData)data : DataUtil.FloatData2DoubleData((FloatData)data);
    double[] values=dd.getValues();
    for (    double value : values) {
      try {
        dos.writeShort(new Short((short)value));
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return data;
}