Program: 19536
Project: 19536
Buggy source:
/** 
 * Returns the next Data object.
 * @return the next Data object, or null if none available
 * @throws DataProcessingException if a data processing error occurs
 */
@Override public Data getData() throws DataProcessingException {
  while (outputQueue.isEmpty()) {
    Data data=getPredecessor().getData();
    if (data == null)     break;
    if (data instanceof DataStartSignal) {
      reset();
      outputQueue.add(data);
      break;
    }
    if (data instanceof DataEndSignal) {
      if (inSpeech) {
        outputQueue.add(new SpeechEndSignal());
      }
      outputQueue.add(data);
      break;
    }
    if (data instanceof SpeechClassifiedData) {
      SpeechClassifiedData cdata=(SpeechClassifiedData)data;
      if (cdata.isSpeech()) {
        speechCount++;
        silenceCount=0;
      }
 else {
        speechCount=0;
        silenceCount++;
      }
      if (inSpeech) {
        outputQueue.add(data);
      }
 else {
        inputQueue.add(data);
      }
      if (!inSpeech && speechCount == startSpeechFrames) {
        inSpeech=true;
        outputQueue.add(new SpeechStartSignal(cdata.getCollectTime() - speechLeader - startSpeechFrames));
        outputQueue.addAll(inputQueue.subList(Math.max(0,inputQueue.size() - startSpeechFrames - speechLeaderFrames),inputQueue.size()));
        inputQueue.clear();
      }
      if (inSpeech && silenceCount == endSilenceFrames) {
        inSpeech=false;
        outputQueue.add(new SpeechEndSignal(cdata.getCollectTime()));
      }
    }
  }
  if (!outputQueue.isEmpty()) {
    Data audio=outputQueue.remove(0);
    if (audio instanceof SpeechClassifiedData) {
      SpeechClassifiedData data=(SpeechClassifiedData)audio;
      audio=data.getDoubleData();
    }
    return audio;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the next Data object.
 * @return the next Data object, or null if none available
 * @throws DataProcessingException if a data processing error occurs
 */
@Override public Data getData() throws DataProcessingException {
  while (outputQueue.isEmpty()) {
    Data data=getPredecessor().getData();
    if (data == null)     break;
    if (data instanceof DataStartSignal) {
      reset();
      outputQueue.add(data);
      break;
    }
    if (data instanceof DataEndSignal) {
      if (inSpeech) {
        outputQueue.add(new SpeechEndSignal());
      }
      outputQueue.add(data);
      break;
    }
    if (data instanceof SpeechClassifiedData) {
      SpeechClassifiedData cdata=(SpeechClassifiedData)data;
      if (cdata.isSpeech()) {
        speechCount++;
        silenceCount=0;
      }
 else {
        speechCount=0;
        silenceCount++;
      }
      if (inSpeech) {
        outputQueue.add(data);
      }
 else {
        inputQueue.add(data);
        if (inputQueue.size() > startSpeechFrames + speechLeaderFrames) {
          inputQueue.remove(0);
        }
      }
      if (!inSpeech && speechCount == startSpeechFrames) {
        inSpeech=true;
        outputQueue.add(new SpeechStartSignal(cdata.getCollectTime() - speechLeader - startSpeechFrames));
        outputQueue.addAll(inputQueue.subList(Math.max(0,inputQueue.size() - startSpeechFrames - speechLeaderFrames),inputQueue.size()));
        inputQueue.clear();
      }
      if (inSpeech && silenceCount == endSilenceFrames) {
        inSpeech=false;
        outputQueue.add(new SpeechEndSignal(cdata.getCollectTime()));
      }
    }
  }
  if (!outputQueue.isEmpty()) {
    Data audio=outputQueue.remove(0);
    if (audio instanceof SpeechClassifiedData) {
      SpeechClassifiedData data=(SpeechClassifiedData)audio;
      audio=data.getDoubleData();
    }
    return audio;
  }
 else {
    return null;
  }
}