nus-yam/ex-repair huggingface dataset:
Program: 19529
Project: 19529
Buggy source:
/** 
 * Returns the properties of this acoustic model.
 * @return the properties of this acoustic model
 */
public Properties getProperties(){
  if (properties == null) {
    properties=new Properties();
    try {
      properties.load(getClass().getResource("String_Node_Str").openStream());
    }
 catch (    IOException ioe) {
      ioe.printStackTrace();
    }
  }
  return properties;
}

Fixed version (ground truth):
/** 
 * Returns the properties of this acoustic model.
 * @return the properties of this acoustic model
 */
public Properties getProperties(){
  if (properties == null) {
    properties=new Properties();
    try {
      properties.load(TiedStateAcousticModel.class.getResource("String_Node_Str").openStream());
    }
 catch (    IOException ioe) {
      ioe.printStackTrace();
    }
  }
  return properties;
}
Program: 19530
Project: 19530
Buggy source:
private float convertScore(float val){
  val=logMath.lnToLog(val);
  if (Float.isNaN(val)) {
    System.out.println("String_Node_Str");
    val=LogMath.LOG_ZERO;
  }
  if (val < distFloor) {
    val=distFloor;
  }
  return val;
}

Fixed version (ground truth):
private float convertScore(float val){
  val=LogMath.getLogMath().lnToLog(val);
  if (Float.isNaN(val)) {
    System.out.println("String_Node_Str");
    val=LogMath.LOG_ZERO;
  }
  if (val < distFloor) {
    val=distFloor;
  }
  return val;
}
Program: 19531
Project: 19531
Buggy source:
/** 
 * remove the given arc from the set of succors
 * @param arc the arc to remove
 */
void deleteSuccessor(SentenceHMMStateArc arc){
  arcs.remove(arc);
}

Fixed version (ground truth):
/** 
 * remove the given arc from the set of succors
 * @param arc the arc to remove
 */
void deleteSuccessor(SentenceHMMStateArc arc){
  arcs.values().remove(arc);
}
Program: 19533
Project: 19533
Buggy source:
/** 
 * Check if an edge is in the graph. 
 * @param edge edge to check
 * @return if edge in the graph
 */
public boolean isEdgeInGraph(Node edge){
  return edges.contains(edge);
}

Fixed version (ground truth):
/** 
 * Check if an edge is in the graph. 
 * @param edge edge to check
 * @return if edge in the graph
 */
public boolean isEdgeInGraph(Edge edge){
  return edges.contains(edge);
}
Program: 19534
Project: 19534
Buggy source:
public static void setProperty(ConfigurationManager cm,String componentName,String propName,String propValue){
  PropertySheet ps=cm.getPropertySheet(componentName);
  if (ps == null)   throw new RuntimeException("String_Node_Str" + propName + "String_Node_Str");
  if (propValue.equals("String_Node_Str"))   propValue=null;
switch (ps.getType(propName)) {
case BOOLEAN:
    ps.setBoolean(propName,Boolean.valueOf(propValue));
  break;
case DOUBLE:
ps.setDouble(propName,new Double(propValue));
break;
case INT:
ps.setInt(propName,new Integer(propValue));
break;
case STRING:
ps.setString(propName,propValue);
break;
case COMPONENT:
ps.setComponent(propName,propValue,null);
break;
case COMPONENT_LIST:
List<String> compNames=new ArrayList<String>();
for (String component : propValue.split("String_Node_Str")) {
compNames.add(component.trim());
}
ps.setComponentList(propName,compNames,null);
break;
default :
throw new RuntimeException("String_Node_Str");
}
}

Fixed version (ground truth):
public static void setProperty(ConfigurationManager cm,String componentName,String propName,String propValue){
  PropertySheet ps=cm.getPropertySheet(componentName);
  if (ps == null)   throw new RuntimeException("String_Node_Str" + propName + "String_Node_Str");
  if (propValue.equals("String_Node_Str"))   propValue=null;
switch (ps.getType(propName)) {
case BOOLEAN:
    ps.setBoolean(propName,Boolean.parseBoolean(propValue));
  break;
case DOUBLE:
ps.setDouble(propName,Double.parseDouble(propValue));
break;
case INT:
ps.setInt(propName,Integer.parseInt(propValue));
break;
case STRING:
ps.setString(propName,propValue);
break;
case COMPONENT:
ps.setComponent(propName,propValue,null);
break;
case COMPONENT_LIST:
List<String> compNames=new ArrayList<String>();
for (String component : propValue.split("String_Node_Str")) {
compNames.add(component.trim());
}
ps.setComponentList(propName,compNames,null);
break;
default :
throw new RuntimeException("String_Node_Str");
}
}
Program: 19535
Project: 19535
Buggy source:
/** 
 * Resets this SpeechMarker to a starting state.
 */
private void reset(){
  inSpeech=false;
  speechCount=0;
  silenceCount=0;
  startSpeechFrames=startSpeechTime / 10;
  endSilenceFrames=endSilenceTime / 10;
  speechLeaderFrames=speechLeader / 10;
  this.inputQueue=new ArrayList<Data>();
  this.outputQueue=new ArrayList<Data>();
}

Fixed version (ground truth):
/** 
 * Resets this SpeechMarker to a starting state.
 */
private void reset(){
  inSpeech=false;
  speechCount=0;
  silenceCount=0;
  startSpeechFrames=startSpeechTime / 10;
  endSilenceFrames=endSilenceTime / 10;
  speechLeaderFrames=speechLeader / 10;
  this.inputQueue=new LinkedList<Data>();
  this.outputQueue=new LinkedList<Data>();
}
Program: 19537
Project: 19537
Buggy source:
private void checkedOffer(List<String> transcript,Queue<List<String>> texts,Queue<TimeFrame> timeFrames,Queue<Range<Integer>> ranges,int start,int end,long timeStart,long timeEnd){
  double wordDensity=((double)(timeEnd - timeStart)) / (end - start);
  System.out.println("String_Node_Str" + wordDensity + "String_Node_Str"+ timeEnd+ "String_Node_Str"+ timeStart+ "String_Node_Str"+ end+ "String_Node_Str"+ start+ "String_Node_Str"+ transcript.subList(start,end).toString());
  if (wordDensity < 10.0) {
    logger.info("String_Node_Str" + transcript.subList(start,end).toString());
    return;
  }
  texts.offer(transcript.subList(start,end));
  timeFrames.offer(new TimeFrame(timeStart,timeEnd));
  ranges.offer(Range.closed(start,end - 1));
}

Fixed version (ground truth):
private void checkedOffer(List<String> transcript,Queue<List<String>> texts,Queue<TimeFrame> timeFrames,Queue<Range<Integer>> ranges,int start,int end,long timeStart,long timeEnd){
  double wordDensity=((double)(timeEnd - timeStart)) / (end - start);
  System.out.println("String_Node_Str" + wordDensity + "String_Node_Str"+ timeEnd+ "String_Node_Str"+ timeStart+ "String_Node_Str"+ end+ "String_Node_Str"+ start+ "String_Node_Str"+ transcript.subList(start,end).toString());
  if (wordDensity < 10.0) {
    logger.info("String_Node_Str",transcript.subList(start,end));
    return;
  }
  texts.offer(transcript.subList(start,end));
  timeFrames.offer(new TimeFrame(timeStart,timeEnd));
  ranges.offer(Range.closed(start,end - 1));
}
Program: 19538
Project: 19538
Buggy source:
/** 
 * Returns the WordResult in this ConfusionSet for the given word.
 * @param word the word to look for
 * @return the WordResult for the given word, or null if no WordResult for the given word is found
 */
public WordResult getWordResult(String word){
  for (  Set<WordResult> wordSet : values()) {
    for (    WordResult wordResult : wordSet) {
      String resultSpelling=wordResult.toString();
      if (resultSpelling.equals(word)) {
        return wordResult;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the WordResult in this ConfusionSet for the given word.
 * @param word the word to look for
 * @return the WordResult for the given word, or null if no WordResult for the given word is found
 */
public WordResult getWordResult(String word){
  for (  Set<WordResult> wordSet : values()) {
    for (    WordResult wordResult : wordSet) {
      String resultSpelling=wordResult.getPronunciation().getWord().getSpelling();
      if (resultSpelling.equals(word)) {
        return wordResult;
      }
    }
  }
  return null;
}
Program: 19539
Project: 19539
Buggy source:
@Override public void logInfo(){
  logger.info("String_Node_Str");
  meansPool.logInfo(logger);
  variancePool.logInfo(logger);
  transitionsPool.logInfo(logger);
  senonePool.logInfo(logger);
  if (meanTransformationMatrixPool != null)   meanTransformationMatrixPool.logInfo(logger);
  if (meanTransformationVectorPool != null)   meanTransformationVectorPool.logInfo(logger);
  if (varianceTransformationMatrixPool != null)   varianceTransformationMatrixPool.logInfo(logger);
  if (varianceTransformationVectorPool != null)   varianceTransformationVectorPool.logInfo(logger);
  mixtureWeightsPool.logInfo(logger);
  senonePool.logInfo(logger);
  logger.info("String_Node_Str" + contextIndependentUnits.size());
  hmmManager.logInfo(logger);
}

Fixed version (ground truth):
@Override public void logInfo(){
  logger.info("String_Node_Str" + location);
  meansPool.logInfo(logger);
  variancePool.logInfo(logger);
  transitionsPool.logInfo(logger);
  senonePool.logInfo(logger);
  if (meanTransformationMatrixPool != null)   meanTransformationMatrixPool.logInfo(logger);
  if (meanTransformationVectorPool != null)   meanTransformationVectorPool.logInfo(logger);
  if (varianceTransformationMatrixPool != null)   varianceTransformationMatrixPool.logInfo(logger);
  if (varianceTransformationVectorPool != null)   varianceTransformationVectorPool.logInfo(logger);
  mixtureWeightsPool.logInfo(logger);
  senonePool.logInfo(logger);
  logger.info("String_Node_Str" + contextIndependentUnits.size());
  hmmManager.logInfo(logger);
}
Program: 19540
Project: 19540
Buggy source:
/** 
 * Loads the dictionary with a list of URLs to custom dictionary resources
 * @param addenda the list of custom dictionary URLs to be loaded
 * @throws IOException if there is an error reading the resource URL
 */
private void loadCustomDictionaries(List<URL> addenda) throws IOException {
  if (addenda != null) {
    for (    URL addendumUrl : addenda) {
      loadDictionary(addendumUrl.openStream(),false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads the dictionary with a list of URLs to custom dictionary resources
 * @param addenda the list of custom dictionary URLs to be loaded
 * @throws IOException if there is an error reading the resource URL
 */
private void loadCustomDictionaries(List<URL> addenda) throws IOException {
  if (addenda != null) {
    for (    URL addendumUrl : addenda) {
      logger.info("String_Node_Str" + addendumUrl);
      loadDictionary(addendumUrl.openStream(),false);
    }
  }
}
Program: 19541
Project: 19541
Buggy source:
/** 
 * Loads the dictionary with a list of URLs to custom dictionary resources
 * @param addenda the list of custom dictionary URLs to be loaded
 * @throws IOException if there is an error reading the resource URL
 */
private void loadCustomDictionaries(List<URL> addenda) throws IOException {
  if (addenda != null) {
    for (    URL addendumUrl : addenda) {
      loadDictionary(addendumUrl.openStream(),false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads the dictionary with a list of URLs to custom dictionary resources
 * @param addenda the list of custom dictionary URLs to be loaded
 * @throws IOException if there is an error reading the resource URL
 */
private void loadCustomDictionaries(List<URL> addenda) throws IOException {
  if (addenda != null) {
    for (    URL addendumUrl : addenda) {
      logger.info("String_Node_Str" + addendumUrl);
      loadDictionary(addendumUrl.openStream(),false);
    }
  }
}
Program: 19543
Project: 19543
Buggy source:
/** 
 * Retain only the pronunciations that start with the unit indicated by nextBase
 * @param p        the set of pronunciations to filter
 * @param nextBase the ID of the desired initial unit
 */
Pronunciation[] filter(Pronunciation[] p,int nextBase){
  return p;
}

Fixed version (ground truth):
/** 
 * Retain only the pronunciations that start with the unit indicated by nextBase. This method can be used instead of filter to reduce search space. It's not used by default but could potentially lead to a decoding speedup.
 * @param p the set of pronunciations to filter
 * @param nextBase the ID of the desired initial unit
 */
Pronunciation[] filter(Pronunciation[] pronunciations,int nextBase){
  if (nextBase == ANY) {
    return pronunciations;
  }
  ArrayList<Pronunciation> filteredPronunciation=new ArrayList<Pronunciation>(pronunciations.length);
  for (  Pronunciation pronunciation : pronunciations) {
    if (pronunciation.getUnits()[0].getBaseID() == nextBase) {
      filteredPronunciation.add(pronunciation);
    }
  }
  return filteredPronunciation.toArray(new Pronunciation[filteredPronunciation.size()]);
}
Program: 19544
Project: 19544
Buggy source:
/** 
 * Reads the next line from the LM file. Keeps track of line number.
 * @throws IOException if an error occurs while reading the input or an EOF is encountered.
 */
private String readLine() throws IOException {
  String line;
  lineNumber++;
  line=reader.readLine();
  if (line == null) {
    corrupt("String_Node_Str");
  }
  return line;
}

Fixed version (ground truth):
/** 
 * Reads the next line from the LM file. Keeps track of line number.
 * @throws IOException if an error occurs while reading the input or an EOF is encountered.
 */
private String readLine() throws IOException {
  String line;
  lineNumber++;
  line=reader.readLine();
  if (line == null) {
    corrupt("String_Node_Str");
  }
  return line.trim();
}
Program: 19545
Project: 19545
Buggy source:
/** 
 * Partitions the given array of tokens in place, so that the highest scoring n token will be at the beginning of the array, not in any order.
 * @param tokens the array of tokens to partition
 * @param size   the number of tokens to partition
 * @param n      the number of tokens in the final partition
 * @return the index of the last element in the partition
 */
public int partition(Token[] tokens,int size,int n){
  if (tokens.length > n) {
    return midPointSelect(tokens,0,size - 1,n);
  }
 else {
    int r=-1;
    float lowestScore=Float.MAX_VALUE;
    for (int i=0; i < tokens.length; i++) {
      Token current=tokens[i];
      float currentScore=current.getScore();
      if (currentScore <= lowestScore) {
        lowestScore=currentScore;
        r=i;
      }
    }
    int last=size - 1;
    if (last >= 0) {
      Token lastToken=tokens[last];
      setToken(tokens,last,tokens[r]);
      setToken(tokens,r,lastToken);
    }
    return last;
  }
}

Fixed version (ground truth):
/** 
 * Partitions the given array of tokens in place, so that the highest scoring n token will be at the beginning of the array, not in any order.
 * @param tokens the array of tokens to partition
 * @param size   the number of tokens to partition
 * @param n      the number of tokens in the final partition
 * @return the index of the last element in the partition
 */
public int partition(Token[] tokens,int size,int n){
  if (tokens.length > n) {
    return midPointSelect(tokens,0,size - 1,n,0);
  }
 else {
    return findBest(tokens,size);
  }
}
Program: 19546
Project: 19546
Buggy source:
/** 
 * Partitions sub-array of tokens around the x-th token by selecting the midpoint of the token array as the pivot.
 * @param tokens the token array to partition
 * @param p      the starting index of the subarray
 * @param r      the ending index of the subarray, inclusive
 * @return the index of the element around which the array is partitioned
 */
private int midPointPartition(Token[] tokens,int p,int r){
  int i=(p + r) >>> 1;
  Token temp=tokens[r];
  setToken(tokens,r,tokens[i]);
  setToken(tokens,i,temp);
  return partitions(tokens,p,r);
}

Fixed version (ground truth):
/** 
 * Partitions sub-array of tokens around the x-th token by selecting the midpoint of the token array as the pivot. Partially solves issues with slow performance on already sorted arrays.
 * @param tokens the token array to partition
 * @param start      the starting index of the subarray
 * @param end      the ending index of the subarray, inclusive
 * @return the index of the element around which the array is partitioned
 */
private int midPointPartition(Token[] tokens,int start,int end){
  int middle=(start + end) >>> 1;
  Token temp=tokens[end];
  setToken(tokens,end,tokens[middle]);
  setToken(tokens,middle,temp);
  return endPointPartition(tokens,start,end);
}
Program: 19547
Project: 19547
Buggy source:
/** 
 * Selects the token with the ith largest token score.
 * @param tokens the token array to partition
 * @param p      the starting index of the subarray
 * @param r      the ending index of the subarray, inclusive
 * @param i      the token with the i-th largest score
 * @return the index of the token with the ith largest score
 */
private int midPointSelect(Token[] tokens,int p,int r,int i){
  if (p == r) {
    return p;
  }
  int q=midPointPartition(tokens,p,r);
  int k=q - p + 1;
  if (i == k) {
    return q;
  }
 else   if (i < k) {
    return midPointSelect(tokens,p,q - 1,i);
  }
 else {
    return midPointSelect(tokens,q + 1,r,i - k);
  }
}

Fixed version (ground truth):
/** 
 * Selects the token with the ith largest token score.
 * @param tokens       the token array to partition
 * @param start        the starting index of the subarray
 * @param end          the ending index of the subarray, inclusive
 * @param targetSize   target size of the partition
 * @param depth        recursion depth to avoid stack overflow and fall back to simple partition.
 * @return the index of the token with the ith largest score
 */
private int midPointSelect(Token[] tokens,int start,int end,int targetSize,int depth){
  if (depth > MAX_DEPTH) {
    return simplePointSelect(tokens,start,end,targetSize);
  }
  if (start == end) {
    return start;
  }
  int partitionToken=midPointPartition(tokens,start,end);
  int newSize=partitionToken - start + 1;
  if (targetSize == newSize) {
    return partitionToken;
  }
 else   if (targetSize < newSize) {
    return midPointSelect(tokens,start,partitionToken - 1,targetSize,depth + 1);
  }
 else {
    return midPointSelect(tokens,partitionToken + 1,end,targetSize - newSize,depth + 1);
  }
}
Program: 19548
Project: 19548
Buggy source:
@Override public void deallocate(){
  scorer.deallocate();
  pruner.deallocate();
  linguist.deallocate();
}

Fixed version (ground truth):
@Override public void deallocate(){
  try {
    scorer.deallocate();
    pruner.deallocate();
    linguist.deallocate();
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 19549
Project: 19549
Buggy source:
@Override public void deallocate(){
  scorer.deallocate();
  pruner.deallocate();
  linguist.deallocate();
}

Fixed version (ground truth):
@Override public void deallocate(){
  try {
    scorer.deallocate();
    pruner.deallocate();
    linguist.deallocate();
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 19550
Project: 19550
Buggy source:
/** 
 * Deallocates the linguist. Any resources allocated by this linguist are released. <p/> <p/> Implementor's Note - if the linguist is being shared by multiple searches, the deallocate should only actually deallocate things when the last call to deallocate is made. Two approaches for dealing with this: <p/> (1) Keep an allocation counter that is incremented during allocate and decremented during deallocate. Only when the counter reaches zero should the actually deallocation be performed. <p/> (2) Do nothing in dellocate - just the the GC take care of things
 */
public void deallocate();

Fixed version (ground truth):
/** 
 * Deallocates the linguist. Any resources allocated by this linguist are released. <p/> <p/> Implementor's Note - if the linguist is being shared by multiple searches, the deallocate should only actually deallocate things when the last call to deallocate is made. Two approaches for dealing with this: <p/> (1) Keep an allocation counter that is incremented during allocate and decremented during deallocate. Only when the counter reaches zero should the actually deallocation be performed. <p/> (2) Do nothing in dellocate - just the the GC take care of things
 */
public void deallocate() throws IOException ;
Program: 19551
Project: 19551
Buggy source:
@Override public void deallocate(){
  allocated=false;
  classLM.deallocate();
  classMap.deallocate();
  vocabulary=null;
}

Fixed version (ground truth):
@Override public void deallocate() throws IOException {
  allocated=false;
  classLM.deallocate();
  classMap.deallocate();
  vocabulary=null;
}
Program: 19552
Project: 19552
Buggy source:
@Override public void deallocate(){
  allocated=false;
  for (  LanguageModel model : languageModels) {
    model.deallocate();
  }
}

Fixed version (ground truth):
@Override public void deallocate() throws IOException {
  allocated=false;
  for (  LanguageModel model : languageModels) {
    model.deallocate();
  }
}
Program: 19553
Project: 19553
Buggy source:
@Override public void deallocate(){
  parent.deallocate();
}

Fixed version (ground truth):
@Override public void deallocate() throws IOException {
  parent.deallocate();
}
Program: 19554
Project: 19554
Buggy source:
/** 
 * Retrieves the rule parse for the given result
 * @param the recognition result
 * @return the rule parse for the result
 * @throws GrammarException if there is an error while parsing theresult
 */
RuleParse getRuleParse(Result result) throws GrammarException {
  String resultText=result.getBestFinalResultNoFiller();
  BaseRecognizer jsapiRecognizer=new BaseRecognizer(getGrammar().getGrammarManager());
  RuleGrammar ruleGrammar=new BaseRuleGrammar(jsapiRecognizer,getGrammar().getRuleGrammar());
  RuleParse ruleParse=ruleGrammar.parse(resultText,null);
  return ruleParse;
}

Fixed version (ground truth):
/** 
 * Retrieves the rule parse for the given result
 * @param the recognition result
 * @return the rule parse for the result
 * @throws GrammarException if there is an error while parsing theresult
 */
RuleParse getRuleParse(Result result) throws GrammarException {
  String resultText=result.getBestFinalResultNoFiller();
  BaseRecognizer jsapiRecognizer=new BaseRecognizer(getGrammar().getGrammarManager());
  try {
    jsapiRecognizer.allocate();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  RuleGrammar ruleGrammar=new BaseRuleGrammar(jsapiRecognizer,getGrammar().getRuleGrammar());
  RuleParse ruleParse=ruleGrammar.parse(resultText,null);
  return ruleParse;
}
Program: 19555
Project: 19555
Buggy source:
/** 
 * Convenience method that throws an <code>EngineStateError</code> if any of the bits in the passed state are set in the <code>state</code>.
 * @param state the <code>Engine</code> state to check
 * @throws EngineStateError if any of the bits in the passed state are set in the <code>state</code>
 */
protected void checkEngineState(long state) throws EngineStateError {
  long currentState=getEngineState();
  if ((currentState & state) != 0) {
    throw new EngineStateError("String_Node_Str" + stateToString(state) + "String_Node_Str"+ stateToString(currentState)+ ')');
  }
}

Fixed version (ground truth):
/** 
 * Convenience method that throws an <code>EngineStateError</code> if any of the bits in the passed state are set in the <code>state</code>.
 * @param state the <code>Engine</code> state to check
 * @throws EngineStateError if any of the bits in the passed state are set in the <code>state</code>
 */
protected void checkEngineState(long state) throws EngineStateError {
  long currentState=getEngineState();
  if ((currentState & state) != 0) {
    throw new EngineStateError("String_Node_Str" + stateToString(currentState));
  }
}
Program: 19556
Project: 19556
Buggy source:
/** 
 * Returns the number of unigrams
 * @return the nubmer of unigrams
 */
public int getNumberUnigrams(){
  return getNumberNGrams(1);
}

Fixed version (ground truth):
/** 
 * Returns the number of unigrams
 * @return the number of unigrams
 */
public int getNumberUnigrams(){
  return getNumberNGrams(1);
}
Program: 19558
Project: 19558
Buggy source:
/** 
 * Returns the number of bigrams
 * @return the nubmer of bigrams
 */
public int getNumberBigrams(){
  return getNumberNGrams(2);
}

Fixed version (ground truth):
/** 
 * Returns the number of bigrams
 * @return the number of bigrams
 */
public int getNumberBigrams(){
  return getNumberNGrams(2);
}
Program: 19559
Project: 19559
Buggy source:
/** 
 * Returns the maximum depth of the language model
 * @return the maximum depth of the language mdoel
 */
public int getMaxDepth(){
  return maxNGram;
}

Fixed version (ground truth):
/** 
 * Returns the maximum depth of the language model
 * @return the maximum depth of the language model
 */
public int getMaxDepth(){
  return maxNGram;
}
Program: 19560
Project: 19560
Buggy source:
/** 
 * Skips the NGrams of the LM.
 * @param stream the source of data
 * @throws java.io.IOException
 */
private void skipNGrams(DataInputStream stream) throws IOException {
  NGramOffset[1]=bytesRead;
  int bytesToSkip=(numberNGrams[1] + 1) * LargeNGramModel.BYTES_PER_NGRAM * getBytesPerField();
  stream.skipBytes(bytesToSkip);
  bytesRead+=bytesToSkip;
  for (int i=2; i < maxNGram; i++) {
    if (numberNGrams[i] > 0 && i < maxNGram - 1) {
      NGramOffset[i]=bytesRead;
      long bToSkip=(long)(numberNGrams[i] + 1) * (long)LargeNGramModel.BYTES_PER_NGRAM * (long)getBytesPerField();
      stream.skip(bToSkip);
      bytesRead+=bToSkip;
    }
 else     if (numberNGrams[i] > 0 && i == maxNGram - 1) {
      NGramOffset[i]=bytesRead;
      long bToSkip=(long)(numberNGrams[i]) * (long)LargeNGramModel.BYTES_PER_NMAXGRAM * (long)getBytesPerField();
      stream.skip(bToSkip);
      bytesRead+=bToSkip;
    }
  }
}

Fixed version (ground truth):
/** 
 * Skips the NGrams of the LM.
 * @param stream the source of data
 * @throws java.io.IOException
 */
private void skipNGrams(DataInputStream stream) throws IOException {
  long bytesToSkip;
  NGramOffset[1]=bytesRead;
  bytesToSkip=(numberNGrams[1] + 1) * LargeNGramModel.BYTES_PER_NGRAM * getBytesPerField();
  skipStreamBytes(stream,bytesToSkip);
  for (int i=2; i < maxNGram; i++) {
    if (numberNGrams[i] > 0 && i < maxNGram - 1) {
      NGramOffset[i]=bytesRead;
      bytesToSkip=(long)(numberNGrams[i] + 1) * (long)LargeNGramModel.BYTES_PER_NGRAM * (long)getBytesPerField();
      skipStreamBytes(stream,bytesToSkip);
    }
 else     if (numberNGrams[i] > 0 && i == maxNGram - 1) {
      NGramOffset[i]=bytesRead;
      bytesToSkip=(long)(numberNGrams[i]) * (long)LargeNGramModel.BYTES_PER_NMAXGRAM * (long)getBytesPerField();
      skipStreamBytes(stream,bytesToSkip);
    }
  }
}
Program: 19561
Project: 19561
Buggy source:
/** 
 * Returns the number of trigrams
 * @return the nubmer of trigrams
 */
public int getNumberTrigrams(){
  return getNumberNGrams(3);
}

Fixed version (ground truth):
/** 
 * Returns the number of trigrams
 * @return the number of trigrams
 */
public int getNumberTrigrams(){
  return getNumberNGrams(3);
}
Program: 19562
Project: 19562
Buggy source:
/** 
 * Initializes the binary loader
 * @param format                    the file format
 * @param location                  the location of the model
 * @param applyLanguageWeightAndWip if true apply lw and wip
 * @param logMath                   the logmath to sue
 * @param languageWeight            the language weight
 * @param wip                       the word insertion probability
 * @param unigramWeight             the unigram weight
 * @throws IOException if an I/O error occurs
 */
public BinaryLoader(String format,File location,boolean applyLanguageWeightAndWip,LogMath logMath,float languageWeight,double wip,float unigramWeight) throws IOException {
  startWordID=-1;
  endWordID=-1;
  this.applyLanguageWeightAndWip=applyLanguageWeightAndWip;
  this.logMath=logMath;
  this.languageWeight=languageWeight;
  this.wip=wip;
  this.unigramWeight=unigramWeight;
  loadBinary(location);
}

Fixed version (ground truth):
/** 
 * Initializes the binary loader
 * @param format                    the file format
 * @param location                  the location of the model
 * @param applyLanguageWeightAndWip if true apply language weight and word insertion penalty
 * @param logMath                   the logmath to sue
 * @param languageWeight            the language weight
 * @param wip                       the word insertion probability
 * @param unigramWeight             the unigram weight
 * @throws IOException if an I/O error occurs
 */
public BinaryLoader(String format,File location,boolean applyLanguageWeightAndWip,LogMath logMath,float languageWeight,double wip,float unigramWeight) throws IOException {
  startWordID=-1;
  endWordID=-1;
  this.applyLanguageWeightAndWip=applyLanguageWeightAndWip;
  this.logMath=logMath;
  this.languageWeight=languageWeight;
  this.wip=wip;
  this.unigramWeight=unigramWeight;
  loadBinary(location);
}
Program: 19563
Project: 19563
Buggy source:
/** 
 * Keeps track of and reports all of the active word histories for the given active list
 * @param activeList the active list to track
 */
private void monitorWords(ActiveList activeList){
  WordTracker tracker=new WordTracker(currentFrameNumber);
  for (  Token t : activeList) {
    tracker.add(t);
  }
  tracker.dump();
}

Fixed version (ground truth):
/** 
 * Keeps track of and reports all of the active word histories for the given active list
 * @param activeList the active list to track
 */
@SuppressWarnings("String_Node_Str") private void monitorWords(ActiveList activeList){
  WordTracker tracker=new WordTracker(currentFrameNumber);
  for (  Token t : activeList) {
    tracker.add(t);
  }
  tracker.dump();
}
Program: 19565
Project: 19565
Buggy source:
@Override public void newProperties(PropertySheet ps) throws PropertyException {
  logger=ps.getLogger();
  logBase=ps.getFloat(PROP_LOG_BASE);
  useAddTable=ps.getBoolean(PROP_USE_ADD_TABLE);
  init();
  if (lastInstance != null)   System.err.println("String_Node_Str");
  lastInstance=this;
}

Fixed version (ground truth):
@Override public void newProperties(PropertySheet ps) throws PropertyException {
  logger=ps.getLogger();
  logBase=ps.getFloat(PROP_LOG_BASE);
  useAddTable=ps.getBoolean(PROP_USE_ADD_TABLE);
  init();
}
Program: 19566
Project: 19566
Buggy source:
/** 
 * Self test for Lattices. Test loading, saving, dynamically creating and optimizing Lattices
 * @param args
 */
@Test public void testLattice(){
  Lattice lattice=null;
  System.err.println("String_Node_Str");
  lattice=new Lattice(LogMath.getInstance());
  Node n0=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n1=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n1a=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n2=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n2a=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n3=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n4=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  lattice.addEdge(n0,n1,-1,0);
  lattice.addEdge(n0,n1a,-1,0);
  lattice.addEdge(n1,n4,-1,0);
  lattice.addEdge(n1a,n2a,-1,0);
  lattice.addEdge(n2a,n4,-1,0);
  lattice.addEdge(n0,n2,-1,0);
  lattice.addEdge(n2,n3,-1,0);
  lattice.addEdge(n1,n3,-1,0);
  lattice.addEdge(n3,n4,-1,0);
  lattice.setInitialNode(n0);
  lattice.setTerminalNode(n4);
  System.err.println("String_Node_Str" + lattice.getNodes().size() + "String_Node_Str"+ lattice.getEdges().size()+ "String_Node_Str");
  System.err.println("String_Node_Str");
  lattice.dump("String_Node_Str");
  lattice.dumpAllPaths();
  LatticeOptimizer lo=new LatticeOptimizer(lattice);
  lo.optimize();
  lattice.dumpAllPaths();
}

Fixed version (ground truth):
/** 
 * Self test for Lattices. Test loading, saving, dynamically creating and optimizing Lattices
 * @param args
 */
@Test public void testLattice(){
  Lattice lattice=null;
  System.err.println("String_Node_Str");
  lattice=new Lattice(new LogMath(1.0001f,true));
  Node n0=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n1=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n1a=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n2=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n2a=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n3=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  Node n4=lattice.addNode("String_Node_Str","String_Node_Str",0,0);
  lattice.addEdge(n0,n1,-1,0);
  lattice.addEdge(n0,n1a,-1,0);
  lattice.addEdge(n1,n4,-1,0);
  lattice.addEdge(n1a,n2a,-1,0);
  lattice.addEdge(n2a,n4,-1,0);
  lattice.addEdge(n0,n2,-1,0);
  lattice.addEdge(n2,n3,-1,0);
  lattice.addEdge(n1,n3,-1,0);
  lattice.addEdge(n3,n4,-1,0);
  lattice.setInitialNode(n0);
  lattice.setTerminalNode(n4);
  System.err.println("String_Node_Str" + lattice.getNodes().size() + "String_Node_Str"+ lattice.getEdges().size()+ "String_Node_Str");
  System.err.println("String_Node_Str");
  lattice.dump("String_Node_Str");
  lattice.dumpAllPaths();
  LatticeOptimizer lo=new LatticeOptimizer(lattice);
  lo.optimize();
  lattice.dumpAllPaths();
}
Program: 19567
Project: 19567
Buggy source:
/** 
 * Gets the cached score for this senone based upon the given feature. If the score was not cached, it is calculated using   {@link #calculateScore}, cached, and then returned.  
 */
@Override public float getScore(Data feature){
  Float score=scoreCache.get(feature);
  if (score == null) {
    score=calculateScore(feature);
    scoreCache.putIfAbsent(feature,score);
  }
  return score;
}

Fixed version (ground truth):
/** 
 * Gets the cached score for this senone based upon the given feature. If the score was not cached, it is calculated using   {@link #calculateScore}, cached, and then returned.  
 */
@Override public float getScore(Data feature){
  ScoreCache cached=scoreCache;
  if (feature != cached.feature) {
    cached=new ScoreCache(feature,calculateScore(feature));
    scoreCache=cached;
  }
  return cached.score;
}
Program: 19568
Project: 19568
Buggy source:
@Override public void allocate(){
  super.allocate();
  if (executorService == null) {
    logger.fine(numThreads > 1 ? "String_Node_Str" + numThreads : "String_Node_Str");
    executorService=numThreads > 1 ? Executors.newFixedThreadPool(numThreads) : null;
  }
}

Fixed version (ground truth):
@Override public void allocate(){
  super.allocate();
  if (executorService == null) {
    if (numThreads > 1) {
      logger.fine("String_Node_Str" + numThreads);
      executorService=Executors.newFixedThreadPool(numThreads,new CustomThreadFactory(className,true,Thread.NORM_PRIORITY));
    }
 else {
      logger.fine("String_Node_Str");
    }
  }
}
Program: 19569
Project: 19569
Buggy source:
/** 
 * Compute the utterance-level posterior for every node in the lattice, i.e. the probability that this node occurs on any path through the lattice. Uses a forward-backward algorithm specific to the nature of non-looping left-to-right lattice structures. <p/> Node posteriors can be retrieved by calling getPosterior() on Node objects.
 * @param languageModelWeight   the language model weight that was used in generating the scores in the lattice
 * @param useAcousticScoresOnly use only the acoustic scores to compute the posteriors, ignore the language weightand scores
 */
public void computeNodePosteriors(float languageModelWeight,boolean useAcousticScoresOnly){
}

Fixed version (ground truth):
/** 
 * Compute the utterance-level posterior for every node in the lattice, i.e. the probability that this node occurs on any path through the lattice. Uses a forward-backward algorithm specific to the nature of non-looping left-to-right lattice structures. <p/> Node posteriors can be retrieved by calling getPosterior() on Node objects.
 * @param languageModelWeightAdjustment   the weight multiplier that will be applied to language score already scaled by language weight
 * @param useAcousticScoresOnly use only the acoustic scores to compute the posteriors, ignore the language weightand scores
 */
public void computeNodePosteriors(float languageModelWeightAdjustment,boolean useAcousticScoresOnly){
}
Program: 19570
Project: 19570
Buggy source:
/** 
 * Computes the score of an edge.
 * @param edge                the edge which score we want to compute
 * @param languageModelWeight the language model weight to use
 * @return the score of an edge
 */
private double computeEdgeScore(Edge edge,float languageModelWeight,boolean useAcousticScoresOnly){
  if (useAcousticScoresOnly) {
    return edge.getAcousticScore();
  }
 else {
    return (edge.getAcousticScore() + edge.getLMScore()) / languageModelWeight;
  }
}

Fixed version (ground truth):
/** 
 * Computes the score of an edge. It multiplies on adjustment since language model score is already scaled by language model weight in linguist.
 * @param edge                the edge which score we want to compute
 * @param languageModelWeightAdjustment the weight multiplier that will be applied to language score already scaled by language weight
 * @return the score of an edge
 */
private double computeEdgeScore(Edge edge,float languageModelWeightAdjustment,boolean useAcousticScoresOnly){
  if (useAcousticScoresOnly) {
    return edge.getAcousticScore();
  }
 else {
    return edge.getAcousticScore() + edge.getLMScore() * languageModelWeightAdjustment;
  }
}
Program: 19571
Project: 19571
Buggy source:
/** 
 * Computes confidences for a Result and returns a ConfidenceResult, a compact representation of all the hypothesis contained in the result together with their per-word and per-path confidences.
 * @param result the result to compute confidences for
 * @return a confidence result
 */
@Override public ConfidenceResult score(Result result){
  Lattice lattice=new Lattice(result);
  LatticeOptimizer lop=new LatticeOptimizer(lattice);
  lop.optimize();
  lattice.computeNodePosteriors(languageWeight);
  SausageMaker sm=new SausageMaker(lattice);
  Sausage s=sm.makeSausage();
  if (dumpLattice) {
    lattice.dumpAISee("String_Node_Str","String_Node_Str");
  }
  if (dumpSausage) {
    s.dumpAISee("String_Node_Str","String_Node_Str");
  }
  WordResultPath mapPath=new WordResultPath();
  List<Token> wordTokens=getWordTokens(result.getBestToken());
  int slot=0;
  for (  Token wordToken : wordTokens) {
    String word=wordToken.getWord().getSpelling();
    WordResult wr=null;
    ConfusionSet cs=null;
    while (slot < s.size() && wr == null) {
      cs=s.getConfusionSet(slot);
      wr=cs.getWordResult(word);
      if (wr == null) {
        slot++;
      }
    }
    if (wr != null) {
      mapPath.add(wr);
    }
 else {
      cs.dump("String_Node_Str" + slot);
      throw new Error("String_Node_Str" + slot + "String_Node_Str"+ word);
    }
    slot++;
  }
  return (new MAPConfidenceResult(s,mapPath));
}

Fixed version (ground truth):
/** 
 * Computes confidences for a Result and returns a ConfidenceResult, a compact representation of all the hypothesis contained in the result together with their per-word and per-path confidences.
 * @param result the result to compute confidences for
 * @return a confidence result
 */
@Override public ConfidenceResult score(Result result){
  Lattice lattice=new Lattice(result);
  LatticeOptimizer lop=new LatticeOptimizer(lattice);
  lop.optimize();
  lattice.computeNodePosteriors(languageWeightAdjustment);
  SausageMaker sm=new SausageMaker(lattice);
  Sausage s=sm.makeSausage();
  if (dumpLattice) {
    lattice.dumpAISee("String_Node_Str","String_Node_Str");
  }
  if (dumpSausage) {
    s.dumpAISee("String_Node_Str","String_Node_Str");
  }
  WordResultPath mapPath=new WordResultPath();
  List<Token> wordTokens=getWordTokens(result.getBestToken());
  int slot=0;
  for (  Token wordToken : wordTokens) {
    String word=wordToken.getWord().getSpelling();
    WordResult wr=null;
    ConfusionSet cs=null;
    while (slot < s.size() && wr == null) {
      cs=s.getConfusionSet(slot);
      wr=cs.getWordResult(word);
      if (wr == null) {
        slot++;
      }
    }
    if (wr != null) {
      mapPath.add(wr);
    }
 else {
      cs.dump("String_Node_Str" + slot);
      throw new Error("String_Node_Str" + slot + "String_Node_Str"+ word);
    }
    slot++;
  }
  return (new MAPConfidenceResult(s,mapPath));
}
Program: 19572
Project: 19572
Buggy source:
@Override public void newProperties(PropertySheet ps) throws PropertyException {
  languageWeight=ps.getFloat(PROP_LANGUAGE_WEIGHT);
  dumpLattice=ps.getBoolean(PROP_DUMP_LATTICE);
  dumpSausage=ps.getBoolean(PROP_DUMP_SAUSAGE);
}

Fixed version (ground truth):
@Override public void newProperties(PropertySheet ps) throws PropertyException {
  languageWeightAdjustment=ps.getFloat(PROP_LANGUAGE_WEIGHT_ADJUSTMENT);
  dumpLattice=ps.getBoolean(PROP_DUMP_LATTICE);
  dumpSausage=ps.getBoolean(PROP_DUMP_SAUSAGE);
}
Program: 19573
Project: 19573
Buggy source:
public static URL resourceToURL(String location) throws MalformedURLException, ClassNotFoundException {
  Matcher jarMatcher=jarPattern.matcher(location);
  if (jarMatcher.matches()) {
    String resourceName=jarMatcher.group(1);
    return Object.class.getResource(resourceName);
  }
 else {
    if (location.indexOf(':') == -1) {
      location="String_Node_Str" + location;
    }
    return new URL(location);
  }
}

Fixed version (ground truth):
public static URL resourceToURL(String location) throws MalformedURLException, ClassNotFoundException {
  Matcher jarMatcher=jarPattern.matcher(location);
  if (jarMatcher.matches()) {
    String resourceName=jarMatcher.group(1);
    return ConfigurationManagerUtils.class.getResource(resourceName);
  }
 else {
    if (location.indexOf(':') == -1) {
      location="String_Node_Str" + location;
    }
    return new URL(location);
  }
}
Program: 19574
Project: 19574
Buggy source:
public static void run(String[] args) throws MalformedURLException {
  System.out.println("String_Node_Str");
  if (args.length < 1) {
    throw new Error("String_Node_Str");
  }
  String root=args[0];
  URL audioURL=(args.length > 1) ? new File(args[0]).toURI().toURL() : new URL("String_Node_Str" + root + "String_Node_Str");
  TranscriberConfiguration config=new TranscriberConfiguration(root);
  Recognizer recognizer=config.getRecognizer();
  recognizer.allocate();
  AudioFileDataSource audioSource=config.getAudioFileDataSource();
  audioSource.setAudioFile(audioURL,null);
  Result result;
  while ((result=recognizer.recognize()) != null) {
    String resultText=result.getBestResultNoFiller();
    System.out.println(resultText);
  }
}

Fixed version (ground truth):
public static void run(String[] args) throws MalformedURLException {
  System.out.println("String_Node_Str");
  if (args.length < 1) {
    throw new Error("String_Node_Str");
  }
  String root=args[0];
  URL audioURL=(args.length > 1) ? new File(args[1]).toURI().toURL() : new URL("String_Node_Str" + root + "String_Node_Str");
  TranscriberConfiguration config=new TranscriberConfiguration(root);
  Recognizer recognizer=config.getRecognizer();
  recognizer.allocate();
  AudioFileDataSource audioSource=config.getAudioFileDataSource();
  audioSource.setAudioFile(audioURL,null);
  Result result;
  while ((result=recognizer.recognize()) != null) {
    String resultText=result.getBestResultNoFiller();
    System.out.println(resultText);
  }
}
Program: 19575
Project: 19575
Buggy source:
/** 
 * Returns the next Data object, which is a normalized Data produced by this class. Signals are returned unmodified.
 * @return the next available Data object, returns null if no Data object is available
 * @throws DataProcessingException if there is a data processing error
 */
@Override public Data getData() throws DataProcessingException {
  Data input=getPredecessor().getData();
  if (input instanceof DataStartSignal)   sum=null;
  getTimer().start();
  if (input != null) {
    if (input instanceof DoubleData) {
      DoubleData data=(DoubleData)input;
      if (sum == null) {
        initMeansSums(data.getValues().length);
      }
      normalize(data);
    }
 else     if (input instanceof DataEndSignal) {
      updateMeanSumBuffers();
    }
  }
  getTimer().stop();
  return input;
}

Fixed version (ground truth):
/** 
 * Returns the next Data object, which is a normalized Data produced by this class. Signals are returned unmodified.
 * @return the next available Data object, returns null if no Data object is available
 * @throws DataProcessingException if there is a data processing error
 */
@Override public Data getData() throws DataProcessingException {
  Data input=getPredecessor().getData();
  if (input instanceof DataStartSignal) {
    sum=null;
    numberFrame=0;
  }
  getTimer().start();
  if (input != null) {
    if (input instanceof DoubleData) {
      DoubleData data=(DoubleData)input;
      if (sum == null) {
        initMeansSums(data.getValues().length);
      }
      normalize(data);
    }
 else     if (input instanceof DataEndSignal) {
      updateMeanSumBuffers();
    }
  }
  getTimer().stop();
  return input;
}
Program: 19576
Project: 19576
Buggy source:
/** 
 * Scores a a list of <code>Scoreable</code>s given a <code>Data</code>-object.
 * @param scoreableList The list of Scoreables to be scored
 * @param data          The <code>Data</code>-object to be used for scoring.
 * @return the best scoring <code>Scoreable</code> or <code>null</code> if the list of scoreables was empty.
 */
protected <T extends Scoreable>T doScoring(List<T> scoreableList,Data data){
  Iterator<T> i=scoreableList.iterator();
  T best=i.next();
  while (i.hasNext()) {
    T scoreable=i.next();
    if (scoreable.calculateScore(data) > best.getScore())     best=scoreable;
  }
  return best;
}

Fixed version (ground truth):
/** 
 * Scores a a list of <code>Scoreable</code>s given a <code>Data</code>-object.
 * @param scoreableList The list of Scoreables to be scored
 * @param data          The <code>Data</code>-object to be used for scoring.
 * @return the best scoring <code>Scoreable</code> or <code>null</code> if the list of scoreables was empty.
 */
protected <T extends Scoreable>T doScoring(List<T> scoreableList,Data data){
  Iterator<T> i=scoreableList.iterator();
  T best=i.next();
  best.calculateScore(data);
  while (i.hasNext()) {
    T scoreable=i.next();
    if (scoreable.calculateScore(data) > best.getScore())     best=scoreable;
  }
  return best;
}
Program: 19577
Project: 19577
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 to be scored
 * @return the best scoring scorable, or null if there are no more frames to score
 */
public Data calculateScores(List<? extends Scoreable> scoreableList){
  frontEnd=getFrontEnd((List<ParallelToken>)scoreableList);
  return super.calculateScores(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 to be scored
 * @return the best scoring scorable, or null if there are no more frames to score
 */
public Data calculateScores(List<? extends Scoreable> scoreableList){
  frontEnd=getFrontEnd(scoreableList);
  return super.calculateScores(scoreableList);
}
Program: 19578
Project: 19578
Buggy source:
/** 
 * Returns the acoustic model name of the Tokens in the given list .
 * @return the acoustic model name of the Tokens
 */
private FrontEnd getFrontEnd(List<ParallelToken> activeList){
  return activeList.isEmpty() ? null : activeList.get(0).getFeatureStream().getFrontEnd();
}

Fixed version (ground truth):
/** 
 * Returns the acoustic model name of the Tokens in the given list .
 * @return the acoustic model name of the Tokens
 */
private FrontEnd getFrontEnd(List<? extends Scoreable> activeList){
  Scoreable scoreable=activeList.isEmpty() ? null : activeList.get(0);
  if (scoreable == null || !(scoreable instanceof ParallelToken))   throw new RuntimeException("String_Node_Str");
  return ((ParallelToken)scoreable).getFeatureStream().getFrontEnd();
}