nus-yam/ex-repair huggingface dataset:
Program: 19811
Project: 19811
Buggy source:
/** 
 * Constructs a FeatureFileDumper.
 * @param cm the Sphinx configuration manager
 * @param inputAudioFile the name of the input file 
 * @param inputAudioFile the input audio file
 */
public FeatureFileDumper(ConfigurationManager cm,String frontEndName,String inputAudioFile) throws FileNotFoundException, IOException {
  try {
    frontEnd=(FrontEnd)cm.lookup(frontEndName);
    StreamDataSource audioSource=(StreamDataSource)cm.lookup("String_Node_Str");
    audioSource.setInputStream(new FileInputStream(inputAudioFile),"String_Node_Str");
    allFeatures=new LinkedList();
    getAllFeatures();
    logger.info("String_Node_Str" + allFeatures.size());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Constructs a FeatureFileDumper.
 * @param cm the Sphinx configuration manager
 * @param inputAudioFile the input audio file
 */
public FeatureFileDumper(ConfigurationManager cm,String frontEndName,String inputAudioFile) throws FileNotFoundException, IOException {
  try {
    frontEnd=(FrontEnd)cm.lookup(frontEndName);
    StreamDataSource audioSource=(StreamDataSource)cm.lookup("String_Node_Str");
    audioSource.setInputStream(new FileInputStream(inputAudioFile),"String_Node_Str");
    allFeatures=new LinkedList();
    getAllFeatures();
    logger.info("String_Node_Str" + allFeatures.size());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 19812
Project: 19812
Buggy source:
/** 
 * Scores the given set of Tokens. All Tokens in the given list are assumed to belong to the same acoustic model.
 * @param scoreableList a list containing StateToken objects tobe scored
 * @return true if there are more features available
 */
public boolean calculateScores(List scoreableList){
}

Fixed version (ground truth):
/** 
 * Scores the given set of Tokens. All Tokens in the given list are assumed to belong to the same acoustic model.
 * @param scoreableList a list containing StateToken objects tobe scored
 * @return the best scoring scorable, or null if there areno more frames to score
 */
public Scoreable calculateScores(List scoreableList){
}
Program: 19813
Project: 19813
Buggy source:
/** 
 * Initializes this SimpleAcousticScorer with the given context and FrontEnd.
 * @param context the context to use
 * @param frontend the FrontEnd to use
 */
public void initialize(String context,FrontEnd frontend){
  this.frontEnd=frontend;
  this.props=SphinxProperties.getSphinxProperties(context);
}

Fixed version (ground truth):
/** 
 * Initializes this SimpleAcousticScorer with the given context and FrontEnd.
 * @param context the context to use
 * @param frontend the FrontEnd to use
 */
public void initialize(String context,FrontEnd frontend){
  this.props=SphinxProperties.getSphinxProperties(context);
}
Program: 19814
Project: 19814
Buggy source:
/** 
 * Creates the ActiveLists used for decoding. There is one ActiveList created for each feature stream (or acoustic model), and also an ActiveList to do the overall pruning.
 */
private void createInitialLists(){
  String activeListName=props.getString(PROP_ACTIVE_LIST_TYPE,PROP_ACTIVE_LIST_TYPE_DEFAULT);
  try {
    Class activeListClass=Class.forName(activeListName);
    combinedActiveList=getActiveList(activeListClass,props);
    delayedExpansionList=getActiveList(activeListClass,props);
    SentenceHMMState firstState=(SentenceHMMState)linguist.getInitialSearchState();
    CombineToken firstToken=new CombineToken(null,firstState,currentFrameNumber);
    setBestToken(firstState,firstToken);
    for (Iterator i=FeatureStream.iterator(); i.hasNext(); ) {
      FeatureStream stream=(FeatureStream)i.next();
      stream.setActiveList(getActiveList(activeListClass,props));
      ParallelToken token=new ParallelToken(firstState,stream,currentFrameNumber);
      token.setLastCombineTime(currentFrameNumber);
      firstToken.addParallelToken(stream,token);
    }
    resultList=new LinkedList();
    calculateCombinedScore(firstToken);
    growCombineToken(firstToken);
    printActiveLists();
  }
 catch (  ClassNotFoundException cnfe) {
    throw new Error("String_Node_Str" + activeListName + "String_Node_Str");
  }
catch (  IllegalAccessException iae) {
    throw new Error("String_Node_Str" + activeListName);
  }
catch (  InstantiationException ise) {
    throw new Error("String_Node_Str" + activeListName);
  }
}

Fixed version (ground truth):
/** 
 * Creates the ActiveLists used for decoding. There is one ActiveList created for each feature stream (or acoustic model), and also an ActiveList to do the overall pruning.
 */
private void createInitialLists(){
  String activeListName=props.getString(PROP_ACTIVE_LIST_TYPE,PROP_ACTIVE_LIST_TYPE_DEFAULT);
  try {
    Class activeListClass=Class.forName(activeListName);
    combinedActiveList=getActiveList(activeListClass,props);
    delayedExpansionList=getActiveList(activeListClass,props);
    SentenceHMMState firstState=(SentenceHMMState)linguist.getSearchGraph().getInitialState();
    CombineToken firstToken=new CombineToken(null,firstState,currentFrameNumber);
    setBestToken(firstState,firstToken);
    for (Iterator i=FeatureStream.iterator(); i.hasNext(); ) {
      FeatureStream stream=(FeatureStream)i.next();
      stream.setActiveList(getActiveList(activeListClass,props));
      ParallelToken token=new ParallelToken(firstState,stream,currentFrameNumber);
      token.setLastCombineTime(currentFrameNumber);
      firstToken.addParallelToken(stream,token);
    }
    resultList=new LinkedList();
    calculateCombinedScore(firstToken);
    growCombineToken(firstToken);
    printActiveLists();
  }
 catch (  ClassNotFoundException cnfe) {
    throw new Error("String_Node_Str" + activeListName + "String_Node_Str");
  }
catch (  IllegalAccessException iae) {
    throw new Error("String_Node_Str" + activeListName);
  }
catch (  InstantiationException ise) {
    throw new Error("String_Node_Str" + activeListName);
  }
}
Program: 19815
Project: 19815
Buggy source:
/** 
 * Calculate the acoustic scores for the active lists for the acoustic models, which should contain only emitting tokens.
 * @return true if there are more tokens, otherwise false
 */
private boolean score(){
  scoreTimer.start();
  debugPrint("String_Node_Str");
  boolean moreFeatures=false;
  for (Iterator i=FeatureStream.iterator(); i.hasNext(); ) {
    FeatureStream stream=(FeatureStream)i.next();
    moreFeatures=scorer.calculateScores(stream.getActiveList().getTokens());
  }
  debugPrint("String_Node_Str");
  scoreTimer.stop();
  return moreFeatures;
}

Fixed version (ground truth):
/** 
 * Calculate the acoustic scores for the active lists for the acoustic models, which should contain only emitting tokens.
 * @return true if there are more tokens, otherwise false
 */
private boolean score(){
  scoreTimer.start();
  debugPrint("String_Node_Str");
  boolean moreFeatures=false;
  for (Iterator i=FeatureStream.iterator(); i.hasNext(); ) {
    FeatureStream stream=(FeatureStream)i.next();
    Scoreable scoreable=scorer.calculateScores(stream.getActiveList().getTokens());
    moreFeatures=(scoreable != null);
  }
  debugPrint("String_Node_Str");
  scoreTimer.stop();
  return moreFeatures;
}
Program: 19817
Project: 19817
Buggy source:
/** 
 * Creates a tree linguist associated with the given context
 * @param context the context to associate this linguist with
 * @param languageModel the language model
 * @param grammar the grammar for this linguist
 * @param models the acoustic model used by this linguist
 */
public void initialize(String context,LanguageModel languageModel,Grammar grammar,AcousticModel[] models){
  SphinxProperties props=SphinxProperties.getSphinxProperties(context);
  this.tokenStackCapacity=props.getInt(PROP_STACK_CAPACITY,PROP_STACK_CAPACITY_DEFAULT);
  this.tieLevel=props.getString(PROP_TIE_LEVEL,PROP_TIE_LEVEL_DEFAULT);
  super.initialize(context,languageModel,grammar,models);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a tree linguist associated with the given context
 * @param context        the context to associate this linguist with
 * @param languageModel  the language model
 * @param dictionary     the dictionary used
 * @param grammar        the grammar used
 * @param models         the acoustic models used
 */
public void initialize(String context,LanguageModel languageModel,Dictionary dictionary,Grammar grammar,AcousticModel[] models){
  SphinxProperties props=SphinxProperties.getSphinxProperties(context);
  this.tokenStackCapacity=props.getInt(PROP_STACK_CAPACITY,PROP_STACK_CAPACITY_DEFAULT);
  this.tieLevel=props.getString(PROP_TIE_LEVEL,PROP_TIE_LEVEL_DEFAULT);
  super.initialize(context,languageModel,dictionary,grammar,models);
  this.acousticModels=models;
  System.out.println("String_Node_Str");
}
Program: 19818
Project: 19818
Buggy source:
/** 
 * Returns true if the given binary cepstra file is in big-endian format. It assumes that the first 4 bytes of the file tells you how many 4-byte floating point cepstra values are in the file.
 * @param filename the cepstra file name
 * @return true if the given binary cepstra file is big-endian
 */
public static boolean isCepstraFileBigEndian(String filename) throws IOException {
  File cepstraFile=new File(filename);
  int fileSize=(int)cepstraFile.length();
  DataInputStream stream=new DataInputStream(new FileInputStream(filename));
  int numberBytes=stream.readInt() * 4 + 4;
  return (fileSize == numberBytes);
}

Fixed version (ground truth):
/** 
 * Returns true if the given binary cepstra file is in big-endian format. It assumes that the first 4 bytes of the file tells you how many 4-byte floating point cepstra values are in the file.
 * @param filename the cepstra file name
 * @return true if the given binary cepstra file is big-endian
 */
public static boolean isCepstraFileBigEndian(String filename) throws IOException {
  File cepstraFile=new File(filename);
  int fileSize=(int)cepstraFile.length();
  DataInputStream stream=new DataInputStream(new FileInputStream(filename));
  int numberBytes=stream.readInt() * 4 + 4;
  stream.close();
  return (fileSize == numberBytes);
}
Program: 19820
Project: 19820
Buggy source:
/** 
 * Constructs a FeatureFileDumper.
 * @param propsFile the Sphinx properties file
 * @param inputAudioFile the input audio file
 */
public FeatureFileDumper(String propsFile,String inputAudioFile) throws FileNotFoundException, IOException {
  try {
    String context="String_Node_Str";
    URL url=new File(propsFile).toURI().toURL();
    SphinxProperties.initContext(context,url);
    SphinxProperties props=SphinxProperties.getSphinxProperties(context);
    StreamDataSource audioSource=new StreamDataSource();
    audioSource.initialize("String_Node_Str",context,props,null);
    audioSource.setInputStream(new FileInputStream(inputAudioFile),"String_Node_Str");
    Collection names=FrontEndFactory.getNames(props);
    assert(names.size() == 1);
    String feName=(String)names.iterator().next();
    frontEnd=FrontEndFactory.getFrontEnd(feName,props);
    frontEnd.setDataSource(audioSource);
    allFeatures=new LinkedList();
    getAllFeatures();
    logger.info("String_Node_Str" + allFeatures.size());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Constructs a FeatureFileDumper.
 * @param propsFile the Sphinx properties file
 * @param inputAudioFile the input audio file
 */
public FeatureFileDumper(String propsFile,String inputAudioFile) throws FileNotFoundException, IOException {
  try {
    String context="String_Node_Str";
    URL url=new File(propsFile).toURI().toURL();
    SphinxProperties.initContext(context,url);
    SphinxProperties props=SphinxProperties.getSphinxProperties(context);
    StreamDataSource audioSource=new StreamDataSource();
    audioSource.initialize("String_Node_Str",context,props,null);
    audioSource.setInputStream(new FileInputStream(inputAudioFile),"String_Node_Str");
    Collection names=FrontEndFactory.getNames(props);
    assert(names.size() == 1);
    String feName=(String)names.iterator().next();
    frontEnd=FrontEndFactory.getFrontEnd(props,feName);
    frontEnd.setDataSource(audioSource);
    allFeatures=new LinkedList();
    getAllFeatures();
    logger.info("String_Node_Str" + allFeatures.size());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 19823
Project: 19823
Buggy source:
/** 
 * Initialize and return the frontend based on the given sphinx properties.
 */
protected FrontEnd getFrontEnd(){
  String path=null;
  try {
    path=props.getString(PROP_FRONT_END,PROP_FRONT_END_DEFAULT);
    FrontEnd fe=(FrontEnd)Class.forName(path).newInstance();
    fe.initialize("String_Node_Str",context,dataSource);
    return fe;
  }
 catch (  ClassNotFoundException fe) {
    throw new Error("String_Node_Str" + path,fe);
  }
catch (  InstantiationException ie) {
    throw new Error("String_Node_Str" + path,ie);
  }
catch (  IllegalAccessException iea) {
    throw new Error("String_Node_Str" + path,iea);
  }
catch (  IOException ioe) {
    throw new Error("String_Node_Str" + path + "String_Node_Str"+ ioe,ioe);
  }
}

Fixed version (ground truth):
/** 
 * Initialize and return the frontend based on the given sphinx properties.
 */
protected FrontEnd getFrontEnd(){
}
Program: 19824
Project: 19824
Buggy source:
/** 
 * Returns a single frame of speech.
 * @return a feature frame
 * @throws IOException
 */
private boolean getFeature(){
  FeatureFrame ff;
  try {
    ff=frontEnd.getFeatureFrame(1,null);
    if (!hasFeatures(ff)) {
      return false;
    }
    curFeature=ff.getFeatures()[0];
    if (curFeature.getSignal() == Signal.UTTERANCE_START) {
      ff=frontEnd.getFeatureFrame(1,null);
      if (!hasFeatures(ff)) {
        return false;
      }
      curFeature=ff.getFeatures()[0];
    }
    if (curFeature.getSignal() == Signal.UTTERANCE_END) {
      return false;
    }
    if (!curFeature.hasContent()) {
      throw new Error("String_Node_Str");
    }
  }
 catch (  IOException ioe) {
    System.out.println("String_Node_Str" + ioe);
    ioe.printStackTrace();
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns a single frame of speech.
 * @return a feature frame
 * @throws IOException
 */
private boolean getFeature(){
  try {
    curFeature=frontEnd.getData();
    if (curFeature == null) {
      return false;
    }
    if (curFeature instanceof DataStartSignal) {
      curFeature=frontEnd.getData();
      if (curFeature == null) {
        return false;
      }
    }
    if (curFeature instanceof DataEndSignal) {
      return false;
    }
    if (curFeature instanceof Signal) {
      throw new Error("String_Node_Str");
    }
  }
 catch (  DataProcessingException dpe) {
    System.out.println("String_Node_Str" + dpe);
    dpe.printStackTrace();
    return false;
  }
  return true;
}
Program: 19825
Project: 19825
Buggy source:
/** 
 * Initializes the Learner with the proper context and frontend.
 * @throws IOException
 */
private void initialize() throws IOException {
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamAudioSource("String_Node_Str",context,null,null);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamCepstrumSource("String_Node_Str",context);
  }
 else {
    throw new Error("String_Node_Str" + inputDataType + "String_Node_Str"+ "String_Node_Str");
  }
  frontEnd=getFrontEnd();
}

Fixed version (ground truth):
/** 
 * Initializes the Learner with the proper context and frontend.
 * @throws IOException
 */
private void initialize() throws IOException {
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamDataSource();
    dataSource.initialize("String_Node_Str",null,props,null);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamCepstrumSource();
    dataSource.initialize("String_Node_Str",null,props,null);
  }
 else {
    throw new Error("String_Node_Str" + inputDataType + "String_Node_Str"+ "String_Node_Str");
  }
  frontEnd=getFrontEnd();
}
Program: 19826
Project: 19826
Buggy source:
/** 
 * Sets the learner to use a utterance.
 * @param utterance the utterance
 * @throws IOException
 */
public void setUtterance(Utterance utterance) throws IOException {
  String file=utterance.toString();
  InputStream is=new FileInputStream(file);
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    ((StreamAudioSource)dataSource).setInputStream(is,file);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    boolean bigEndian=Utilities.isCepstraFileBigEndian(file);
    ((StreamCepstrumSource)dataSource).setInputStream(is,bigEndian);
  }
}

Fixed version (ground truth):
/** 
 * Sets the learner to use a utterance.
 * @param utterance the utterance
 * @throws IOException
 */
public void setUtterance(Utterance utterance) throws IOException {
  String file=utterance.toString();
  InputStream is=new FileInputStream(file);
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    ((StreamDataSource)dataSource).setInputStream(is,file);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    boolean bigEndian=Utilities.isCepstraFileBigEndian(file);
    ((StreamCepstrumSource)dataSource).setInputStream(is,bigEndian);
  }
}
Program: 19827
Project: 19827
Buggy source:
/** 
 * Initializes the Learner with the proper context and frontend.
 * @throws IOException
 */
private void initialize() throws IOException {
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamAudioSource("String_Node_Str",context,null,null);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamCepstrumSource("String_Node_Str",context);
  }
 else {
    throw new Error("String_Node_Str" + inputDataType + "String_Node_Str"+ "String_Node_Str");
  }
  frontEnd=getFrontEnd();
}

Fixed version (ground truth):
/** 
 * Initializes the Learner with the proper context and frontend.
 * @throws IOException
 */
private void initialize() throws IOException {
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamDataSource();
    dataSource.initialize("String_Node_Str",null,props,null);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    dataSource=new StreamCepstrumSource();
    dataSource.initialize("String_Node_Str",null,props,null);
  }
 else {
    throw new Error("String_Node_Str" + inputDataType + "String_Node_Str"+ "String_Node_Str");
  }
  frontEnd=getFrontEnd();
}
Program: 19828
Project: 19828
Buggy source:
/** 
 * Initialize and return the frontend based on the given sphinx properties.
 */
protected FrontEnd getFrontEnd(){
  String path=null;
  try {
    path=props.getString(PROP_FRONT_END,PROP_FRONT_END_DEFAULT);
    FrontEnd fe=(FrontEnd)Class.forName(path).newInstance();
    fe.initialize("String_Node_Str",context,dataSource);
    return fe;
  }
 catch (  ClassNotFoundException fe) {
    throw new Error("String_Node_Str" + path,fe);
  }
catch (  InstantiationException ie) {
    throw new Error("String_Node_Str" + path,ie);
  }
catch (  IllegalAccessException iea) {
    throw new Error("String_Node_Str" + path,iea);
  }
catch (  IOException ioe) {
    throw new Error("String_Node_Str" + path + "String_Node_Str"+ ioe,ioe);
  }
}

Fixed version (ground truth):
/** 
 * Initialize and return the frontend based on the given sphinx properties.
 */
protected FrontEnd getFrontEnd(){
}
Program: 19829
Project: 19829
Buggy source:
/** 
 * Sets the learner to use a utterance.
 * @param utterance the utterance
 * @throws IOException
 */
public void setUtterance(Utterance utterance) throws IOException {
  String file=utterance.toString();
  InputStream is=new FileInputStream(file);
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    ((StreamAudioSource)dataSource).setInputStream(is,file);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    boolean bigEndian=Utilities.isCepstraFileBigEndian(file);
    ((StreamCepstrumSource)dataSource).setInputStream(is,bigEndian);
  }
}

Fixed version (ground truth):
/** 
 * Sets the learner to use a utterance.
 * @param utterance the utterance
 * @throws IOException
 */
public void setUtterance(Utterance utterance) throws IOException {
  String file=utterance.toString();
  InputStream is=new FileInputStream(file);
  inputDataType=props.getString(PROP_INPUT_TYPE,PROP_INPUT_TYPE_DEFAULT);
  if (inputDataType.equals("String_Node_Str")) {
    ((StreamDataSource)dataSource).setInputStream(is,file);
  }
 else   if (inputDataType.equals("String_Node_Str")) {
    boolean bigEndian=Utilities.isCepstraFileBigEndian(file);
    ((StreamCepstrumSource)dataSource).setInputStream(is,bigEndian);
  }
}
Program: 19830
Project: 19830
Buggy source:
/** 
 * Returns a single frame of speech.
 * @return a feature frame
 * @throws IOException
 */
private boolean getFeature(){
  FeatureFrame ff;
  try {
    ff=frontEnd.getFeatureFrame(1,null);
    if (!hasFeatures(ff)) {
      return false;
    }
    curFeature=ff.getFeatures()[0];
    if (curFeature.getSignal() == Signal.UTTERANCE_START) {
      ff=frontEnd.getFeatureFrame(1,null);
      if (!hasFeatures(ff)) {
        return false;
      }
      curFeature=ff.getFeatures()[0];
    }
    if (curFeature.getSignal() == Signal.UTTERANCE_END) {
      return false;
    }
    if (!curFeature.hasContent()) {
      throw new Error("String_Node_Str");
    }
  }
 catch (  IOException ioe) {
    System.out.println("String_Node_Str" + ioe);
    ioe.printStackTrace();
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns a single frame of speech.
 * @return a feature frame
 * @throws IOException
 */
private boolean getFeature(){
  try {
    curFeature=frontEnd.getData();
    if (curFeature == null) {
      return false;
    }
    if (curFeature instanceof DataStartSignal) {
      curFeature=frontEnd.getData();
      if (curFeature == null) {
        return false;
      }
    }
    if (curFeature instanceof DataEndSignal) {
      return false;
    }
    if (curFeature instanceof Signal) {
      throw new Error("String_Node_Str");
    }
  }
 catch (  DataProcessingException dpe) {
    System.out.println("String_Node_Str" + dpe);
    dpe.printStackTrace();
    return false;
  }
  return true;
}
Program: 19831
Project: 19831
Buggy source:
/** 
 * Gets the signature for this state
 * @return the signature
 */
public String getSignature(){
  return getFullName();
}

Fixed version (ground truth):
/** 
 * Gets the signature for this state
 * @return the signature
 */
public String getSignature(){
  return toString();
}
Program: 19832
Project: 19832
Buggy source:
/** 
 * Returns the processed Data output.
 * @return an Data object that has been processed by this DataProcessor 
 */
public abstract Data getData() throws DataProcessingException ;

Fixed version (ground truth):
/** 
 * Returns the processed Data output.
 * @return an Data object that has been processed by this DataProcessor 
 * @throws DataProcessingException if a data processor error occurs
 */
public abstract Data getData() throws DataProcessingException ;
Program: 19833
Project: 19833
Buggy source:
/** 
 * Constructs a DataProcessingException with the specified detailed message.
 */
public DataProcessingException(String message){
  super(message);
}

Fixed version (ground truth):
/** 
 * Constructs a DataProcessingException with the specified detailed message.
 * @param message the detailed message
 */
public DataProcessingException(String message){
  super(message);
}
Program: 19834
Project: 19834
Buggy source:
/** 
 * Returns the processed Data output.
 * @return an Data object that has been processed by this DataProcessor 
 */
public abstract Data getData() throws DataProcessingException ;

Fixed version (ground truth):
/** 
 * Returns the processed Data output.
 * @return an Data object that has been processed by this DataProcessor 
 * @throws DataProcessingException if a data processor error occurs
 */
public abstract Data getData() throws DataProcessingException ;
Program: 19835
Project: 19835
Buggy source:
/** 
 * Constructs a DataStartSignal with the given data name and transcript.
 * @param name   the name of the data stream, can be the name of the file from which the data stream is created
 * @param transcript   the transcript text of the data stream
 */
public DataStartSignal(String name,String transcript){
  this();
  this.name=name;
  this.transcript=transcript;
}

Fixed version (ground truth):
/** 
 * Constructs a DataStartSignal at the given time.
 * @param time the time this DataStartSignal is created
 */
public DataStartSignal(long time){
  super(time);
}
Program: 19836
Project: 19836
Buggy source:
/** 
 * Returns the processed Data output, basically calls <code>getData()</code> on the last processor.
 * @return an Data object that has been processed by this front end
 */
public Data getData() throws DataProcessingException {
  Data data=last.getData();
  if (data instanceof Signal) {
    fireSignalListeners((Signal)data);
  }
  return data;
}

Fixed version (ground truth):
/** 
 * Returns the processed Data output, basically calls <code>getData()</code> on the last processor.
 * @return an Data object that has been processed by this front end
 * @throws DataProcessingException if a data processor error occurs
 */
public Data getData() throws DataProcessingException {
  Data data=last.getData();
  if (data instanceof Signal) {
    fireSignalListeners((Signal)data);
  }
  return data;
}
Program: 19837
Project: 19837
Buggy source:
/** 
 * Finds the DataProcessor with the given name.
 * @param name the name of the DataProcessor to find
 */
public DataProcessor findDataProcessor(String processorName){
  DataProcessor current=last;
  while (current != null) {
    if (current.getName().equals(processorName)) {
      return current;
    }
 else {
      current=current.getPredecessor();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the DataProcessor with the given name.
 * @param name the name of the DataProcessor to find
 * @return the DataProcessor with the given name, or null if noDataProcessor with the given name was found
 */
public DataProcessor findDataProcessor(String processorName){
  DataProcessor current=last;
  while (current != null) {
    if (current.getName().equals(processorName)) {
      return current;
    }
 else {
      current=current.getPredecessor();
    }
  }
  return null;
}
Program: 19838
Project: 19838
Buggy source:
/** 
 * Returns as a string array the name(s) of the front end(s), as specified in the SphinxProperties by the following: <code> edu.cmu.sphinx.frontend.pipelines = ... ... (e.g., "mfc plp"); </code>
 * @param props the SphinxProperty to use
 */
private static String[] getFrontEndNames(SphinxProperties props){
  String pipelines=props.getString(PROP_PREFIX + "String_Node_Str","String_Node_Str");
  return pipelines.split("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns as a string array the name(s) of the front end(s), as specified in the SphinxProperties by the following: <code> edu.cmu.sphinx.frontend.pipelines = ... ... (e.g., "mfc plp"); </code>
 * @param props the SphinxProperty to use
 * @return the name of all available front ends
 */
private static String[] getFrontEndNames(SphinxProperties props){
  String pipelines=props.getString(PROP_PREFIX + "String_Node_Str","String_Node_Str");
  return pipelines.split("String_Node_Str");
}
Program: 19840
Project: 19840
Buggy source:
/** 
 * Returns the class name from a fully-qualified class name.
 */
private static String getClassName(String fullName){
  int periodIndex=fullName.lastIndexOf("String_Node_Str");
  if (periodIndex > -1) {
    return fullName.substring(periodIndex + 1);
  }
 else {
    return fullName;
  }
}

Fixed version (ground truth):
/** 
 * Returns the class name from a fully-qualified class name. For example, given "edu.cmu.sphinx.frontend.FrontEndFactory", will return "FrontEndFactory".
 * @param the fully-qualified class name
 * @return just the class name
 */
private static String getClassName(String fullName){
  int periodIndex=fullName.lastIndexOf("String_Node_Str");
  if (periodIndex > -1) {
    return fullName.substring(periodIndex + 1);
  }
 else {
    return fullName;
  }
}
Program: 19841
Project: 19841
Buggy source:
/** 
 * Sets the properties for this LevelTracker.
 */
private void setProperties(SphinxProperties props){
  frameLength=props.getInt(getFullPropertyName(PROP_FRAME_LENGTH),PROP_FRAME_LENGTH_DEFAULT);
  adjustment=props.getDouble(getFullPropertyName(PROP_ADJUSTMENT),PROP_ADJUSTMENT_DEFAULT);
  threshold=props.getDouble(getFullPropertyName(PROP_THRESHOLD),PROP_THRESHOLD_DEFAULT);
  minSignal=props.getDouble(getFullPropertyName(PROP_MIN_SIGNAL),PROP_MIN_SIGNAL_DEFAULT);
  debug=props.getBoolean(getFullPropertyName(PROP_DEBUG),PROP_DEBUG_DEFAULT);
}

Fixed version (ground truth):
/** 
 * Sets the properties for this LevelTracker.
 * @param props the SphinxProperties to use
 */
private void setProperties(SphinxProperties props){
  frameLength=props.getInt(getFullPropertyName(PROP_FRAME_LENGTH),PROP_FRAME_LENGTH_DEFAULT);
  adjustment=props.getDouble(getFullPropertyName(PROP_ADJUSTMENT),PROP_ADJUSTMENT_DEFAULT);
  threshold=props.getDouble(getFullPropertyName(PROP_THRESHOLD),PROP_THRESHOLD_DEFAULT);
  minSignal=props.getDouble(getFullPropertyName(PROP_MIN_SIGNAL),PROP_MIN_SIGNAL_DEFAULT);
  debug=props.getBoolean(getFullPropertyName(PROP_DEBUG),PROP_DEBUG_DEFAULT);
}
Program: 19842
Project: 19842
Buggy source:
/** 
 * Returns the next Data, either from the inputBuffer or the predecessor.
 * @return the next available Data
 */
private Data readData() throws DataProcessingException {
  Data audio=null;
  if (inputBuffer.size() > 0) {
    audio=(Data)inputBuffer.remove(0);
  }
 else {
    audio=getPredecessor().getData();
  }
  return audio;
}

Fixed version (ground truth):
/** 
 * Returns the next Data, either from the inputBuffer or the predecessor.
 * @return the next available Data
 * @throws DataProcessingException if a data processor error occurs
 */
private Data readData() throws DataProcessingException {
  Data audio=null;
  if (inputBuffer.size() > 0) {
    audio=(Data)inputBuffer.remove(0);
  }
 else {
    audio=getPredecessor().getData();
  }
  return audio;
}
Program: 19843
Project: 19843
Buggy source:
/** 
 * Handles the given Data in the case when mergeSpeechSegment is true.
 */
private Data handleMergingData(Data audio) throws DataProcessingException {
  Data next=audio;
  if (audio instanceof DataStartSignal) {
    List audioList=readUntilSpeechStartOrDataEnd();
    Data last=(Data)audioList.get(audioList.size() - 1);
    if (last != null) {
      if (last instanceof DataEndSignal) {
        outputQueue.add(audio);
        next=last;
      }
    }
  }
 else   if (audio instanceof SpeechEndSignal) {
    List audioList=readUntilSpeechStartOrDataEnd();
    Data last=(Data)audioList.get(audioList.size() - 1);
    if (last != null) {
      if (last instanceof SpeechStartSignal) {
        audioList.remove(last);
        inputBuffer.addAll(audioList);
        next=readData();
      }
 else       if (last instanceof DataEndSignal) {
        next=last;
      }
    }
  }
  return next;
}

Fixed version (ground truth):
/** 
 * Handles the given Data in the case when mergeSpeechSegment is true.
 * @param audio the Data object to handle
 * @throws DataProcessingException if a data processor error occurs
 */
private Data handleMergingData(Data audio) throws DataProcessingException {
  Data next=audio;
  if (audio instanceof DataStartSignal) {
    List audioList=readUntilSpeechStartOrDataEnd();
    Data last=(Data)audioList.get(audioList.size() - 1);
    if (last != null) {
      if (last instanceof DataEndSignal) {
        outputQueue.add(audio);
        next=last;
      }
    }
  }
 else   if (audio instanceof SpeechEndSignal) {
    List audioList=readUntilSpeechStartOrDataEnd();
    Data last=(Data)audioList.get(audioList.size() - 1);
    if (last != null) {
      if (last instanceof SpeechStartSignal) {
        audioList.remove(last);
        inputBuffer.addAll(audioList);
        next=readData();
      }
 else       if (last instanceof DataEndSignal) {
        next=last;
      }
    }
  }
  return next;
}
Program: 19844
Project: 19844
Buggy source:
/** 
 * Handles the given Data in the case when mergeSpeechSegment is false.
 */
private Data handleNonMergingData(Data audio) throws DataProcessingException {
  Data next=audio;
  if (audio != null) {
    if (audio instanceof SpeechStartSignal) {
      if (inSpeech) {
        message("String_Node_Str" + "String_Node_Str");
        do {
          next=readData();
        }
 while (next != null && next instanceof SpeechStartSignal);
        if (next != null) {
          next=handleNonMergingData(next);
        }
      }
 else {
        inSpeech=true;
        discardMode=false;
        next=new DataStartSignal(((Signal)audio).getTime());
      }
    }
 else     if (audio instanceof SpeechEndSignal) {
      if (!inSpeech) {
        message("String_Node_Str" + "String_Node_Str");
        do {
          next=readData();
        }
 while (next != null && next instanceof SpeechEndSignal);
        if (next != null) {
          next=handleNonMergingData(next);
        }
      }
 else {
        inSpeech=false;
        discardMode=true;
        next=new DataEndSignal(((Signal)audio).getTime());
      }
    }
 else     if (discardMode) {
      while (next != null && !(next instanceof SpeechStartSignal) && !(next instanceof SpeechEndSignal)) {
        next=readData();
      }
      next=handleNonMergingData(next);
    }
  }
  return next;
}

Fixed version (ground truth):
/** 
 * Handles the given Data in the case when mergeSpeechSegment is false.
 * @param audio the Data object to handle
 * @throws DataProcessingException if a data processor error occurs
 */
private Data handleNonMergingData(Data audio) throws DataProcessingException {
  Data next=audio;
  if (audio != null) {
    if (audio instanceof SpeechStartSignal) {
      if (inSpeech) {
        message("String_Node_Str" + "String_Node_Str");
        do {
          next=readData();
        }
 while (next != null && next instanceof SpeechStartSignal);
        if (next != null) {
          next=handleNonMergingData(next);
        }
      }
 else {
        inSpeech=true;
        discardMode=false;
        next=new DataStartSignal(((Signal)audio).getTime());
      }
    }
 else     if (audio instanceof SpeechEndSignal) {
      if (!inSpeech) {
        message("String_Node_Str" + "String_Node_Str");
        do {
          next=readData();
        }
 while (next != null && next instanceof SpeechEndSignal);
        if (next != null) {
          next=handleNonMergingData(next);
        }
      }
 else {
        inSpeech=false;
        discardMode=true;
        next=new DataEndSignal(((Signal)audio).getTime());
      }
    }
 else     if (discardMode) {
      while (next != null && !(next instanceof SpeechStartSignal) && !(next instanceof SpeechEndSignal)) {
        next=readData();
      }
      next=handleNonMergingData(next);
    }
  }
  return next;
}
Program: 19845
Project: 19845
Buggy source:
/** 
 * Read until we hit a Data of the two given Signal types.
 * @param signal1 the first Signal type
 * @param signal2 the second Signal type
 * @return a list of all the Data read,including the last Data with the Signal
 */
private List readUntilSpeechStartOrDataEnd() throws DataProcessingException {
  List audioList=new LinkedList();
  Data audio=null;
  do {
    audio=readData();
    if (audio != null) {
      audioList.add(audio);
    }
  }
 while (audio != null && !(audio instanceof SpeechStartSignal) && !(audio instanceof DataEndSignal));
  return audioList;
}

Fixed version (ground truth):
/** 
 * Read until we hit a SpeechStartSignal or DataEndSignal.
 * @return a list of all the Data read,including the SpeechStartSignal or DataEndSignal
 */
private List readUntilSpeechStartOrDataEnd() throws DataProcessingException {
  List audioList=new LinkedList();
  Data audio=null;
  do {
    audio=readData();
    if (audio != null) {
      audioList.add(audio);
    }
  }
 while (audio != null && !(audio instanceof SpeechStartSignal) && !(audio instanceof DataEndSignal));
  return audioList;
}
Program: 19846
Project: 19846
Buggy source:
/** 
 * Returns the amount of audio data in milliseconds in the  given Audio object.
 * @param audio the Audio object
 * @return the amount of audio data in milliseconds
 */
public int getAudioTime(SpeechClassifiedData audio){
  return (int)(audio.getValues().length * 1000.0f / sampleRate);
}

Fixed version (ground truth):
/** 
 * Returns the amount of audio data in milliseconds in the  given SpeechClassifiedData object.
 * @param audio the SpeechClassifiedData object
 * @return the amount of audio data in milliseconds
 */
public int getAudioTime(SpeechClassifiedData audio){
  return (int)(audio.getValues().length * 1000.0f / sampleRate);
}
Program: 19847
Project: 19847
Buggy source:
/** 
 * Handles an Audio object that can possibly be the first in an utterance. 
 * @param audio the Audio to handle
 * @return true if utterance/speech has started for real, false otherwise
 */
private boolean handleFirstSpeech(SpeechClassifiedData audio) throws DataProcessingException {
  int speechTime=getAudioTime(audio);
  while (speechTime < startSpeechTime) {
    Data next=readData();
    sendToQueue(next);
    if (next instanceof SpeechClassifiedData) {
      if (!((SpeechClassifiedData)next).isSpeech()) {
        return false;
      }
 else {
        speechTime+=getAudioTime(audio);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Handles an SpeechClassifiedData object that can possibly be the first in an utterance. 
 * @param audio the SpeechClassifiedData to handle
 * @return true if utterance/speech has started for real, false otherwise
 */
private boolean handleFirstSpeech(SpeechClassifiedData audio) throws DataProcessingException {
  int speechTime=getAudioTime(audio);
  while (speechTime < startSpeechTime) {
    Data next=readData();
    sendToQueue(next);
    if (next instanceof SpeechClassifiedData) {
      if (!((SpeechClassifiedData)next).isSpeech()) {
        return false;
      }
 else {
        speechTime+=getAudioTime(audio);
      }
    }
  }
  return true;
}
Program: 19848
Project: 19848
Buggy source:
/** 
 * Read the starting frames until the utterance has started.
 */
private void readInitialFrames() throws DataProcessingException {
  int nonSpeechTime=0;
  int minSpeechTime=(startSpeechTime > speechLeader) ? startSpeechTime : speechLeader;
  while (!inSpeech) {
    Data audio=readData();
    if (audio == null) {
      return;
    }
 else {
      sendToQueue(audio);
      if (audio instanceof SpeechClassifiedData) {
        nonSpeechTime+=getAudioTime((SpeechClassifiedData)audio);
        SpeechClassifiedData data=(SpeechClassifiedData)audio;
        if (data.isSpeech()) {
          boolean speechStarted=handleFirstSpeech(data);
          if (speechStarted) {
            addSpeechStart();
            inSpeech=true;
            break;
          }
        }
      }
    }
    int i=0;
    while (nonSpeechTime > minSpeechTime) {
      Data next=(Data)outputQueue.get(i);
      if (next instanceof SpeechClassifiedData) {
        int thisAudioTime=getAudioTime((SpeechClassifiedData)next);
        if (nonSpeechTime - thisAudioTime >= minSpeechTime) {
          outputQueue.remove(i);
          nonSpeechTime-=thisAudioTime;
        }
      }
      i++;
    }
  }
}

Fixed version (ground truth):
/** 
 * Read the starting frames until the utterance has started.
 * @throws DataProcessingException if a data processing error occurs
 */
private void readInitialFrames() throws DataProcessingException {
  int nonSpeechTime=0;
  int minSpeechTime=(startSpeechTime > speechLeader) ? startSpeechTime : speechLeader;
  while (!inSpeech) {
    Data audio=readData();
    if (audio == null) {
      return;
    }
 else {
      sendToQueue(audio);
      if (audio instanceof SpeechClassifiedData) {
        nonSpeechTime+=getAudioTime((SpeechClassifiedData)audio);
        SpeechClassifiedData data=(SpeechClassifiedData)audio;
        if (data.isSpeech()) {
          boolean speechStarted=handleFirstSpeech(data);
          if (speechStarted) {
            addSpeechStart();
            inSpeech=true;
            break;
          }
        }
      }
    }
    int i=0;
    while (nonSpeechTime > minSpeechTime) {
      Data next=(Data)outputQueue.get(i);
      if (next instanceof SpeechClassifiedData) {
        int thisAudioTime=getAudioTime((SpeechClassifiedData)next);
        if (nonSpeechTime - thisAudioTime >= minSpeechTime) {
          outputQueue.remove(i);
          nonSpeechTime-=thisAudioTime;
        }
      }
      i++;
    }
  }
}
Program: 19849
Project: 19849
Buggy source:
/** 
 * Reads the cepstra of the entire Utterance into the cepstraList.
 * @return the number cepstra (with Data) read
 * @throws IOException if an error occurred reading the Data
 */
private int readUtterance() throws DataProcessingException {
  Data input=null;
  do {
    input=getPredecessor().getData();
    if (input != null) {
      if (input instanceof DoubleData) {
        numberDataCepstra++;
        double[] cepstrumData=((DoubleData)input).getValues();
        if (sums == null) {
          sums=new double[cepstrumData.length];
        }
 else {
          if (sums.length != cepstrumData.length) {
            throw new Error("String_Node_Str" + sums.length + "String_Node_Str"+ cepstrumData.length);
          }
        }
        for (int j=0; j < cepstrumData.length; j++) {
          sums[j]+=cepstrumData[j];
        }
        cepstraList.add(input);
      }
 else       if (input instanceof DataEndSignal) {
        cepstraList.add(input);
        break;
      }
 else {
        cepstraList.add(input);
      }
    }
  }
 while (input != null);
  return numberDataCepstra;
}

Fixed version (ground truth):
/** 
 * Reads the cepstra of the entire Utterance into the cepstraList.
 * @return the number cepstra (with Data) read
 * @throws DataProcessingException if an error occurred reading the Data
 */
private int readUtterance() throws DataProcessingException {
  Data input=null;
  do {
    input=getPredecessor().getData();
    if (input != null) {
      if (input instanceof DoubleData) {
        numberDataCepstra++;
        double[] cepstrumData=((DoubleData)input).getValues();
        if (sums == null) {
          sums=new double[cepstrumData.length];
        }
 else {
          if (sums.length != cepstrumData.length) {
            throw new Error("String_Node_Str" + sums.length + "String_Node_Str"+ cepstrumData.length);
          }
        }
        for (int j=0; j < cepstrumData.length; j++) {
          sums[j]+=cepstrumData[j];
        }
        cepstraList.add(input);
      }
 else       if (input instanceof DataEndSignal) {
        cepstraList.add(input);
        break;
      }
 else {
        cepstraList.add(input);
      }
    }
  }
 while (input != null);
  return numberDataCepstra;
}
Program: 19850
Project: 19850
Buggy source:
private Data readData() throws DataProcessingException {
  Data frame=getPredecessor().getData();
  if (frame != null) {
    id++;
  }
  return frame;
}

Fixed version (ground truth):
/** 
 * Read a Data object from the predecessor DataProcessor, and increment the ID count appropriately.
 * @return the read Data object
 */
private Data readData() throws DataProcessingException {
  Data frame=getPredecessor().getData();
  if (frame != null) {
    id++;
  }
  return frame;
}
Program: 19851
Project: 19851
Buggy source:
/** 
 * loads the class map. The class map is map that relates acoustic model names to classnames
 * @param props the sphinx properties
 */
private static void loadClassMap(SphinxProperties props){
  if (classMap == null) {
    classMap=new HashMap();
    String modelNames=props.getString(PROP_MODELS,"String_Node_Str");
    StringTokenizer st=new StringTokenizer(modelNames);
    while (st.hasMoreTokens()) {
      String name=st.nextToken();
      String className=props.getString(name,PROP_CLASS,null);
      if (className != null) {
        if (defaultModelName == null) {
          defaultModelName=name;
        }
        classMap.put(name,className);
      }
 else {
        System.err.println("String_Node_Str" + name);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * loads the class map. The class map is map that relates acoustic model names to classnames
 * @param props the sphinx properties
 */
private static void loadClassMap(SphinxProperties props){
  String modelNames=props.getString(PROP_MODELS,"String_Node_Str");
  StringTokenizer st=new StringTokenizer(modelNames);
  while (st.hasMoreTokens()) {
    String name=st.nextToken();
    String className=props.getString(name,PROP_CLASS,null);
    if (className != null) {
      if (defaultModelName == null) {
        defaultModelName=name;
      }
      classMap.put(name,className);
    }
 else {
      System.err.println("String_Node_Str" + name);
    }
  }
}
Program: 19852
Project: 19852
Buggy source:
/** 
 * Returns the next N number of Features produced by this BaseFrontEnd as a single FeatureFrame. The number of Features return maybe less than N, in which case the last Feature will contain a Signal.UTTERANCE_END signal. Consequently, the size of the FeatureFrame will be less than N.
 * @param numberFeatures the number of Features to return
 * @return the next N number of Features in a FeatureFrame, or nullif no more FeatureFrames available
 * @see FeatureFrame
 */
public FeatureFrame getFeatureFrame(int numberFeatures,String acousticModelName) throws IOException {
  getTimer().start();
  FeatureFrame featureFrame=null;
  Feature[] features=new Feature[numberFeatures];
  Feature feature=null;
  int i=0;
  do {
    feature=featureSource.getFeature();
    if (feature != null) {
      if (getAcousticModelName() != null) {
        feature.setType(getAcousticModelName());
      }
      features[i++]=feature;
      signalCheck(feature);
    }
 else {
      break;
    }
  }
 while (i < numberFeatures);
  if (i > 0) {
    if (i < numberFeatures) {
      Feature[] lessFeatures=new Feature[i];
      for (i=0; i < lessFeatures.length; i++) {
        lessFeatures[i]=features[i];
      }
      features=lessFeatures;
    }
    featureFrame=new FeatureFrame(features);
  }
  getTimer().stop();
  return featureFrame;
}

Fixed version (ground truth):
/** 
 * Returns the next N number of Features produced by this BaseFrontEnd as a single FeatureFrame. The number of Features return maybe less than N, in which case the last Feature will contain a Signal.UTTERANCE_END signal. Consequently, the size of the FeatureFrame will be less than N.
 * @param numberFeatures the number of Features to return
 * @param acousticModelName the name of the acoustic model for eachthe returned features are for
 * @return the next N number of Features in a FeatureFrame, or nullif no more FeatureFrames available
 * @throws IOException if an I/O error occurs
 * @see FeatureFrame
 */
public FeatureFrame getFeatureFrame(int numberFeatures,String acousticModelName) throws IOException {
  getTimer().start();
  FeatureFrame featureFrame=null;
  Feature[] features=new Feature[numberFeatures];
  Feature feature=null;
  int i=0;
  do {
    feature=featureSource.getFeature();
    if (feature != null) {
      if (getAcousticModelName() != null) {
        feature.setType(getAcousticModelName());
      }
      features[i++]=feature;
      signalCheck(feature);
    }
 else {
      break;
    }
  }
 while (i < numberFeatures);
  if (i > 0) {
    if (i < numberFeatures) {
      Feature[] lessFeatures=new Feature[i];
      for (i=0; i < lessFeatures.length; i++) {
        lessFeatures[i]=features[i];
      }
      features=lessFeatures;
    }
    featureFrame=new FeatureFrame(features);
  }
  getTimer().stop();
  return featureFrame;
}