nus-yam/ex-repair huggingface dataset:
Program: 33756
Project: 33756
Buggy source:
/** 
 * Attempts to select a target from the current location using the player input.
 * @param inputWords the array of the individual words of the user input.
 * @return a target Creature.
 */
public Creature selectTarget(String[] inputWords){
  if (inputWords.length == 1) {
    if (Game.RANDOM.nextBoolean()) {
      IO.writeString("String_Node_Str",Color.ORANGE);
    }
 else {
      IO.writeString("String_Node_Str",Color.ORANGE);
    }
    return null;
  }
 else {
    return getLocation().findCreature(Arrays.copyOfRange(inputWords,1,inputWords.length));
  }
}

Fixed version (ground truth):
/** 
 * Attempts to select a target from the current location using the player input.
 * @param inputWords the array of the individual words of the user input.
 * @return a target Creature.
 */
public Creature selectTarget(String[] inputWords){
  if (inputWords.length == 1) {
    if (Game.RANDOM.nextBoolean()) {
      IO.writeString("String_Node_Str",Color.ORANGE);
    }
 else {
      IO.writeString("String_Node_Str",Color.ORANGE);
    }
    return null;
  }
 else {
    return findCreature(Arrays.copyOfRange(inputWords,1,inputWords.length));
  }
}
Program: 33757
Project: 33757
Buggy source:
/** 
 * Returns how many different names the matches have. For instance, if the matches consist of two Entity objects with identical names, this method will return 1. This method will calculate how many different names are in the list of matches or use the last calculated value, if the matches list did not change since the last calculation. Therefore, after adding all matches and calling this method once, subsequent method calls should be substantially faster. Adding more elements to the SelectionResult will make necessary a new iteration through the list before returning the new amount of different names. This is more efficient than updating the counter after every addition as it allows many matches to be added with little overhead, letting the different names calculation to the end.
 * @return how many different names the matches have.
 */
public int getDifferentNames(){
  if (!differentNamesUpToDate) {
    updateDifferentNamesCount();
  }
  return differentNames;
}

Fixed version (ground truth):
/** 
 * Returns how many different names the matches have. For instance, if the matches consist of two Entity objects with identical names, this method will return 1. <p/> This method will calculate how many different names are in the list of matches or use the last calculated value, if the matches list did not change since the last calculation. Therefore, after adding all matches and calling this method once, subsequent method calls should be substantially faster. <p/> Adding more elements to the SelectionResult will make necessary a new iteration through the list before returning the new amount of different names. <p/> This is more efficient than updating the counter after every addition as it allows many matches to be added with little overhead, letting the different names calculation to the end.
 * @return how many different names the matches have.
 */
public int getDifferentNames(){
  if (!differentNamesUpToDate) {
    updateDifferentNamesCount();
  }
  return differentNames;
}
Program: 33758
Project: 33758
Buggy source:
/** 
 * Attempts to find a creature in the location by part of its name. If the given name matches multiple creatures, null is returned.
 */
public Creature findCreature(String[] tokens){
  SelectionResult<Creature> selectionResult=Utils.selectFromList(creatures,tokens);
  if (selectionResult.size() == 0) {
    IO.writeString("String_Node_Str");
  }
 else   if (selectionResult.size() == 1) {
    return selectionResult.getMatch(0);
  }
 else {
    Utils.printAmbiguousSelectionMessage();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Attempts to find a creature in the location by part of its name. If the given name matches multiple creatures, null is returned.
 */
public Creature findCreature(String[] tokens){
  SelectionResult<Creature> selectionResult=Utils.selectFromList(creatures,tokens);
  if (selectionResult.size() == 0) {
    IO.writeString("String_Node_Str");
  }
 else   if (selectionResult.size() == 1 || selectionResult.getDifferentNames() == 1) {
    return selectionResult.getMatch(0);
  }
 else {
    Utils.printAmbiguousSelectionMessage();
  }
  return null;
}
Program: 33759
Project: 33759
Buggy source:
/** 
 * Attempts to find an item by its name.
 * @return an Item object if there is a match. null otherwise.
 */
public Item findItem(String[] tokens){
  SelectionResult<Item> selectionResult=Utils.selectFromList(items,tokens);
  if (selectionResult.size() == 0) {
    IO.writeString("String_Node_Str");
  }
 else   if (selectionResult.size() == 1) {
    return selectionResult.getMatch(0);
  }
 else {
    Utils.printAmbiguousSelectionMessage();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Attempts to find an item by its name.
 * @return an Item object if there is a match. null otherwise.
 */
public Item findItem(String[] tokens){
  SelectionResult<Item> selectionResult=Utils.selectFromList(items,tokens);
  if (selectionResult.size() == 0) {
    IO.writeString("String_Node_Str");
  }
 else   if (selectionResult.size() == 1 || selectionResult.getDifferentNames() == 1) {
    return selectionResult.getMatch(0);
  }
 else {
    Utils.printAmbiguousSelectionMessage();
  }
  return null;
}
Program: 33760
Project: 33760
Buggy source:
public SelectionResult(){
  matches=new ArrayList<T>();
}

Fixed version (ground truth):
public SelectionResult(){
  matches=new ArrayList<T>();
  differentNames=0;
  differentNamesUpToDate=true;
}
Program: 33761
Project: 33761
Buggy source:
public void addMatch(T match){
  matches.add(match);
}

Fixed version (ground truth):
public void addMatch(T match){
  matches.add(match);
  differentNamesUpToDate=false;
}
Program: 33762
Project: 33762
Buggy source:
public int size(){
  return matches.size();
}

Fixed version (ground truth):
/** 
 * Returns the number of matches in this SelectionResult.
 * @return the number of matches in this SelectionResult.
 */
public int size(){
  return matches.size();
}
Program: 33763
Project: 33763
Buggy source:
public double getAverageFrequency(){
  if (changed) {
    int res=0;
    for (    AtomicInteger num : this.words.values()) {
      res=res + num.intValue();
    }
    this.cachedAverage=(double)res / (double)this.words.size();
    this.changed=false;
    return this.cachedAverage;
  }
  return this.cachedAverage;
}

Fixed version (ground truth):
public double getAverageFrequency(){
  if (changed) {
    int res=0;
    this.cachedMax=0;
    for (    AtomicInteger num : this.words.values()) {
      res=res + num.intValue();
      if (this.cachedMax < num.intValue()) {
        this.cachedMax=num.intValue();
      }
    }
    this.cachedAverage=(double)res / (double)this.words.size();
    this.changed=false;
    return this.cachedAverage;
  }
  return this.cachedAverage;
}
Program: 33764
Project: 33764
Buggy source:
/** 
 * Get the maximal observed frequency. Useful for normalized tf.
 * @return
 */
public synchronized int getMaxFrequency(){
  if (changed) {
    this.cachedMax=0;
    for (    AtomicInteger num : this.words.values()) {
      if (this.cachedMax < num.intValue()) {
        this.cachedMax=num.intValue();
      }
    }
    this.changed=false;
    return this.cachedMax;
  }
  return this.cachedMax;
}

Fixed version (ground truth):
/** 
 * Get the maximal observed frequency. Useful for normalized tf.
 * @return
 */
public synchronized int getMaxFrequency(){
  if (changed) {
    this.cachedMax=0;
    int res=0;
    for (    AtomicInteger num : this.words.values()) {
      res=res + num.intValue();
      if (this.cachedMax < num.intValue()) {
        this.cachedMax=num.intValue();
      }
    }
    this.cachedAverage=(double)res / (double)this.words.size();
    this.changed=false;
    return this.cachedMax;
  }
  return this.cachedMax;
}
Program: 33765
Project: 33765
Buggy source:
@Test public void testMerge(){
  WordBag bag2=new WordBag("String_Node_Str");
  for (int i=0; i < TEST_WORDS.length; i++) {
    bag2.addWord(TEST_WORDS[TEST_WORDS.length - 1 - i],i + 1);
  }
  bag2.mergeWith(new WordBag(TEST_BAG_NAME,map));
  for (  Entry<String,AtomicInteger> word : bag2.getInternalWords().entrySet()) {
    assertEquals(6,bag2.getInternalWords().get(word.getKey()).get());
  }
  assertEquals(6.0,bag2.getAverageFrequency(),0.000001);
  WordBag bag3=new WordBag("String_Node_Str");
  bag3.addWord("String_Node_Str",17);
  bag2.mergeWith(bag3);
  assertEquals(17,bag2.getInternalWords().get("String_Node_Str").get());
}

Fixed version (ground truth):
@Test public void testMerge(){
  WordBag bag2=new WordBag("String_Node_Str");
  for (int i=0; i < TEST_WORDS.length; i++) {
    bag2.addWord(TEST_WORDS[TEST_WORDS.length - 1 - i],i + 1);
  }
  bag2.mergeWith(new WordBag(TEST_BAG_NAME,map));
  for (  Entry<String,AtomicInteger> word : bag2.getInternalWords().entrySet()) {
    assertEquals(6,bag2.getInternalWords().get(word.getKey()).get());
  }
  assertEquals(6.0,bag2.getAverageFrequency(),0.000001);
  assertEquals(6.0,bag2.getMaxFrequency(),0.000001);
  assertEquals(6.0,bag2.getAverageFrequency(),0.000001);
  assertEquals(6.0,bag2.getMaxFrequency(),0.000001);
  WordBag bag3=new WordBag("String_Node_Str");
  bag3.addWord("String_Node_Str",17);
  bag2.mergeWith(bag3);
  assertEquals(17,bag2.getInternalWords().get("String_Node_Str").get());
  assertEquals(7.833333333333333,bag2.getAverageFrequency(),0.000001);
  assertEquals(17.0,bag2.getMaxFrequency(),0.000001);
}
Program: 33766
Project: 33766
Buggy source:
/** 
 * Converts time series to a word bag.
 * @param label the wordbag label.
 * @param ts timeseries.
 * @param params parameters for SAX transform.
 * @return word bag.
 * @throws SAXException if error occurs.
 */
public WordBag seriesToWordBag(String label,double[] ts,Params params) throws SAXException {
  WordBag resultBag=new WordBag(label);
  char[] previousString=null;
  for (int i=0; i < ts.length - params.windowSize; i++) {
    double[] subSection=Arrays.copyOfRange(ts,i,i + params.windowSize);
    subSection=tp.znorm(subSection,params.nThreshold);
    double[] paa=tp.paa(subSection,params.paaSize);
    char[] currentString=tp.ts2String(paa,na.getCuts(params.alphabetSize));
    if (null != previousString) {
      if (NumerosityReductionStrategy.EXACT.equals(params.nrStartegy) && Arrays.equals(previousString,currentString)) {
        continue;
      }
 else       if (NumerosityReductionStrategy.MINDIST.equals(params.nrStartegy) && sp.checkMinDistIsZero(previousString,currentString)) {
        continue;
      }
    }
    previousString=currentString;
    resultBag.addWord(String.valueOf(currentString));
  }
  return resultBag;
}

Fixed version (ground truth):
/** 
 * Converts time series to a word bag.
 * @param label the wordbag label.
 * @param ts timeseries.
 * @param params parameters for SAX transform.
 * @return word bag.
 * @throws SAXException if error occurs.
 */
public WordBag seriesToWordBag(String label,double[] ts,Params params) throws SAXException {
  WordBag resultBag=new WordBag(label);
  char[] previousString=null;
  for (int i=0; i <= ts.length - params.windowSize; i++) {
    double[] subSection=Arrays.copyOfRange(ts,i,i + params.windowSize);
    subSection=tp.znorm(subSection,params.nThreshold);
    double[] paa=tp.paa(subSection,params.paaSize);
    char[] currentString=tp.ts2String(paa,na.getCuts(params.alphabetSize));
    if (null != previousString) {
      if (NumerosityReductionStrategy.EXACT.equals(params.nrStartegy) && Arrays.equals(previousString,currentString)) {
        continue;
      }
 else       if (NumerosityReductionStrategy.MINDIST.equals(params.nrStartegy) && sp.checkMinDistIsZero(previousString,currentString)) {
        continue;
      }
    }
    previousString=currentString;
    resultBag.addWord(String.valueOf(currentString));
  }
  return resultBag;
}
Program: 33768
Project: 33768
Buggy source:
public DigramFrequencies(){
  super();
  digramsToEntries=new HashMap<String,DigramFrequencyEntry>();
  bucketsToEntries=new TreeMap<Integer,ArrayList<DigramFrequencyEntry>>();
}

Fixed version (ground truth):
/** 
 * Constructor. Inits data structures.
 */
public DigramFrequencies(){
  super();
  digramsToEntries=new HashMap<String,DigramFrequencyEntry>();
  bucketsToEntries=new TreeMap<Integer,ArrayList<DigramFrequencyEntry>>();
}
Program: 33769
Project: 33769
Buggy source:
public DigramFrequencyEntry get(String string){
  return this.digramsToEntries.get(string);
}

Fixed version (ground truth):
/** 
 * get the frequency entry by the digram string key.
 * @param string the string key.
 * @return the digram frequency entry if exists.
 */
public DigramFrequencyEntry get(String string){
  return this.digramsToEntries.get(string);
}
Program: 33770
Project: 33770
Buggy source:
public DigramFrequencyEntry getTop(){
  if (bucketsToEntries.keySet().isEmpty()) {
    return null;
  }
 else {
    Integer maxBucket=Collections.max(bucketsToEntries.keySet());
    return bucketsToEntries.get(maxBucket).get(0);
  }
}

Fixed version (ground truth):
/** 
 * Gets the most frequent entry.
 * @return the most frequent entry.
 */
public DigramFrequencyEntry getTop(){
  if (bucketsToEntries.keySet().isEmpty()) {
    return null;
  }
 else {
    Integer maxBucket=Collections.max(bucketsToEntries.keySet());
    return bucketsToEntries.get(maxBucket).get(0);
  }
}
Program: 33771
Project: 33771
Buggy source:
public void put(DigramFrequencyEntry digramFrequencyEntry){
  this.digramsToEntries.put(digramFrequencyEntry.getDigram(),digramFrequencyEntry);
  Integer freq=digramFrequencyEntry.getFrequency();
  ArrayList<DigramFrequencyEntry> bucket=this.bucketsToEntries.get(freq);
  if (null == bucket) {
    bucket=new ArrayList<DigramFrequencyEntry>();
    this.bucketsToEntries.put(freq,bucket);
  }
  bucket.add(digramFrequencyEntry);
}

Fixed version (ground truth):
/** 
 * Puts the digram into collection, it overrides the old entry.
 * @param digramFrequencyEntry The digram entry.
 */
public void put(DigramFrequencyEntry digramFrequencyEntry){
  this.digramsToEntries.put(digramFrequencyEntry.getDigram(),digramFrequencyEntry);
  Integer freq=digramFrequencyEntry.getFrequency();
  ArrayList<DigramFrequencyEntry> bucket=this.bucketsToEntries.get(freq);
  if (null == bucket) {
    bucket=new ArrayList<DigramFrequencyEntry>();
    this.bucketsToEntries.put(freq,bucket);
  }
  bucket.add(digramFrequencyEntry);
}
Program: 33772
Project: 33772
Buggy source:
public void incrementFrequency(DigramFrequencyEntry entry,int index){
  ArrayList<DigramFrequencyEntry> oldBucket=this.bucketsToEntries.get(entry.getFrequency());
  oldBucket.remove(entry);
  if (0 == oldBucket.size() || oldBucket.isEmpty()) {
    this.bucketsToEntries.remove(entry.getFrequency());
  }
  int newFreq=entry.getFrequency() + index;
  entry.setFrequency(newFreq);
  ArrayList<DigramFrequencyEntry> bucket=this.bucketsToEntries.get(newFreq);
  if (null == bucket) {
    bucket=new ArrayList<DigramFrequencyEntry>();
    this.bucketsToEntries.put(newFreq,bucket);
  }
  bucket.add(entry);
}

Fixed version (ground truth):
/** 
 * Increments a frequency counter for a digram.
 * @param entry the entry.
 * @param increment the increment value.
 */
public void incrementFrequency(DigramFrequencyEntry entry,int increment){
  ArrayList<DigramFrequencyEntry> oldBucket=this.bucketsToEntries.get(entry.getFrequency());
  oldBucket.remove(entry);
  if (0 == oldBucket.size() || oldBucket.isEmpty()) {
    this.bucketsToEntries.remove(entry.getFrequency());
  }
  int newFreq=entry.getFrequency() + increment;
  entry.setFrequency(newFreq);
  ArrayList<DigramFrequencyEntry> bucket=this.bucketsToEntries.get(newFreq);
  if (null == bucket) {
    bucket=new ArrayList<DigramFrequencyEntry>();
    this.bucketsToEntries.put(newFreq,bucket);
  }
  bucket.add(entry);
}
Program: 33773
Project: 33773
Buggy source:
public void remove(String digram){
  DigramFrequencyEntry entry=this.digramsToEntries.get(digram);
  int freq=entry.getFrequency();
  ArrayList<DigramFrequencyEntry> bucket=this.bucketsToEntries.get(freq);
  if (!bucket.remove(entry)) {
    throw (new RuntimeException("String_Node_Str"));
  }
  if (0 == bucket.size() || bucket.isEmpty()) {
    this.bucketsToEntries.remove(entry.getFrequency());
  }
  this.digramsToEntries.remove(entry);
  entry=null;
}

Fixed version (ground truth):
/** 
 * Removes the digram frequency entry from the collection.
 * @param digramStr the digram string.
 */
public void remove(String digramStr){
  DigramFrequencyEntry entry=this.digramsToEntries.get(digramStr);
  if (null == entry) {
    return;
  }
 else {
    int freq=entry.getFrequency();
    ArrayList<DigramFrequencyEntry> bucket=this.bucketsToEntries.get(freq);
    if (!bucket.remove(entry)) {
      throw (new RuntimeException("String_Node_Str"));
    }
    if (bucket.isEmpty()) {
      this.bucketsToEntries.remove(freq);
    }
    this.digramsToEntries.remove(digramStr);
  }
  entry=null;
}
Program: 33774
Project: 33774
Buggy source:
public DigramFrequencyEntry(String digram,int frequency,int firstOccurrence){
  super();
  this.digram=digram;
  this.frequency=frequency;
  this.firstOccurrence=firstOccurrence;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param digram the digram string.
 * @param frequency the digram frequency.
 * @param firstOccurrence the digram first occurrence.
 */
public DigramFrequencyEntry(String digram,int frequency,int firstOccurrence){
  super();
  this.digram=digram;
  this.frequency=frequency;
  this.firstOccurrence=firstOccurrence;
}
Program: 33775
Project: 33775
Buggy source:
public String getDigram(){
  return digram;
}

Fixed version (ground truth):
/** 
 * Get the payload.
 * @return the digram string.
 */
public String getDigram(){
  return digram;
}
Program: 33776
Project: 33776
Buggy source:
public int getFirstOccurrence(){
  return firstOccurrence;
}

Fixed version (ground truth):
/** 
 * Get the first occurrence.
 * @return the first occurrence.
 */
public int getFirstOccurrence(){
  return firstOccurrence;
}
Program: 33777
Project: 33777
Buggy source:
public int getFrequency(){
  return frequency;
}

Fixed version (ground truth):
/** 
 * Frequency getter.
 * @return the frequency value.
 */
public int getFrequency(){
  return frequency;
}
Program: 33778
Project: 33778
Buggy source:
public void setDigram(String digram){
  this.digram=digram;
}

Fixed version (ground truth):
/** 
 * Set the digram string.
 * @param digram the string.
 */
public void setDigram(String digram){
  this.digram=digram;
}
Program: 33779
Project: 33779
Buggy source:
public void setFrequency(int frequency){
  this.frequency=frequency;
}

Fixed version (ground truth):
/** 
 * Frequency setter.
 * @param frequency the new frequency value.
 */
public void setFrequency(int frequency){
  this.frequency=frequency;
}
Program: 33780
Project: 33780
Buggy source:
public void setFirstOccurrence(int firstOccurrence){
  this.firstOccurrence=firstOccurrence;
}

Fixed version (ground truth):
/** 
 * Set the first occurrence.
 * @param firstOccurrence the new value.
 */
public void setFirstOccurrence(int firstOccurrence){
  this.firstOccurrence=firstOccurrence;
}
Program: 33781
Project: 33781
Buggy source:
/** 
 * Set a string payload.
 * @param str the string payload.
 */
public void setStr(char[] str){
  int i=0;
  while (i < str.length && i < this.payload.length) {
    this.payload[i]=str[i];
    i++;
  }
}

Fixed version (ground truth):
/** 
 * Set a string payload.
 * @param str the string payload.
 */
public void setStr(char[] str){
  this.payload=str.clone();
}
Program: 33782
Project: 33782
Buggy source:
/** 
 * Build the actual trie.
 * @param root The root of the current tree.
 * @param alphabetSize The alphabet size.
 * @param depth2Go The depth of the tree left.
 */
private void buildTrie(TrieAbstractNode root,Integer alphabetSize,Integer depth2Go){
  if (depth2Go > 1) {
    for (int i=0; i < alphabetSize; i++) {
      char curChar=(char)(i + aStart);
      TrieInnerNode node=new TrieInnerNode(String.valueOf(curChar));
      ((TrieInnerNode)root).addNext(node);
      buildTrie(node,alphabetSize,depth2Go - 1);
    }
  }
 else {
    for (int i=0; i < alphabetSize; i++) {
      char curChar=(char)(i + aStart);
      TrieLeafNode node=new TrieLeafNode(String.valueOf(curChar));
      ((TrieInnerNode)root).addNext(node);
    }
  }
}

Fixed version (ground truth):
/** 
 * Build the actual trie.
 * @param root The root of the current tree.
 * @param alphabetSize The alphabet size.
 * @param depth2Go The depth of the tree left.
 */
private void buildTrie(TrieAbstractNode root,Integer alphabetSize,Integer depth2Go){
  if (depth2Go > 1) {
    for (int i=0; i < alphabetSize; i++) {
      char curChar=(char)(i + ALPHABET_CODE_START);
      TrieInnerNode node=new TrieInnerNode(String.valueOf(curChar));
      ((TrieInnerNode)root).addNext(node);
      buildTrie(node,alphabetSize,depth2Go - 1);
    }
  }
 else {
    for (int i=0; i < alphabetSize; i++) {
      char curChar=(char)(i + ALPHABET_CODE_START);
      TrieLeafNode node=new TrieLeafNode(String.valueOf(curChar));
      ((TrieInnerNode)root).addNext(node);
    }
  }
}
Program: 33783
Project: 33783
Buggy source:
/** 
 * The string validator - check if string has only proper letters.
 * @param str The string to check.
 * @return True if string contains only acceptable (valid) symbols.
 */
private boolean containsWrongSymbols(String str){
  int maxSymbol=aStart + alphabetSize;
  for (int i=0; i < str.length(); i++) {
    if (((int)str.charAt(i)) >= maxSymbol) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * The string validator - check if string has only proper letters.
 * @param str The string to check.
 * @return True if string contains only acceptable (valid) symbols.
 */
private boolean containsWrongSymbols(String str){
  int maxSymbol=ALPHABET_CODE_START + alphabetSize;
  for (int i=0; i < str.length(); i++) {
    if (((int)str.charAt(i)) >= maxSymbol) {
      return true;
    }
  }
  return false;
}
Program: 33784
Project: 33784
Buggy source:
/** 
 * Constructor.
 * @param alphabetSize The alphabet size.
 * @throws TrieException If wrong parameters specified.
 */
public SAXTrieTree(Integer alphabetSize) throws TrieException {
  if ((null != alphabetSize) && (alphabetSize > 0) && (alphabetSize < (aEnd - aStart))) {
    this.alphabetSize=alphabetSize;
    root=new TrieInnerNode("String_Node_Str");
    buildTrie(root,alphabetSize,alphabetSize);
  }
 else {
    throw new TrieException("String_Node_Str" + alphabetSize);
  }
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param alphabetSize The alphabet size.
 * @throws TrieException If wrong parameters specified.
 */
public SAXTrieTree(Integer alphabetSize) throws TrieException {
  if ((null != alphabetSize) && (alphabetSize > 0) && (alphabetSize < (ALPHABET_CODE_END - ALPHABET_CODE_START))) {
    this.alphabetSize=alphabetSize;
    root=new TrieInnerNode("String_Node_Str");
    buildTrie(root,alphabetSize,alphabetSize);
  }
 else {
    throw new TrieException("String_Node_Str" + alphabetSize);
  }
}
Program: 33786
Project: 33786
Buggy source:
/** 
 * Test parallel SAX conversion.
 * @throws Exception if error occurs.
 */
@Test public void testParallelSAX() throws Exception {
  double[] ts=TSUtils.readFileColumn(filenameTEK14,0,0);
  SAXFrequencyData sequentialRes=SAXFactory.ts2saxZNorm(new Timeseries(ts),128,7,new NormalAlphabet(),7);
  String sequentialString=sequentialRes.getSAXString("String_Node_Str");
  ParallelSAXImplementation ps1=new ParallelSAXImplementation();
  SAXRecords parallelRes=ps1.process(ts,THREADS_NUM,128,7,7,NumerosityReductionStrategy.EXACT,0.005);
  assertTrue(sequentialString.equalsIgnoreCase(parallelRes.getSAXString("String_Node_Str")));
  SAXFrequencyData sequentialRes2=SAXFactory.data2sax(ts,100,8,4);
  String sequentialString2=sequentialRes2.getSAXString("String_Node_Str");
  ParallelSAXImplementation ps2=new ParallelSAXImplementation();
  SAXRecords parallelRes2=ps2.process(ts,THREADS_NUM,100,8,4,NumerosityReductionStrategy.EXACT,0.005);
  assertTrue(sequentialString2.equalsIgnoreCase(parallelRes2.getSAXString("String_Node_Str")));
}

Fixed version (ground truth):
/** 
 * Test parallel SAX conversion.
 * @throws Exception if error occurs.
 */
@Test public void testParallelSAX() throws Exception {
  double[] ts=TSUtils.readFileColumn(filenameTEK14,0,0);
  SAXFrequencyData sequentialRes=SAXFactory.ts2saxZNorm(new Timeseries(ts),128,7,new NormalAlphabet(),7);
  String sequentialString=sequentialRes.getSAXString("String_Node_Str");
  ParallelSAXImplementation ps1=new ParallelSAXImplementation();
  SAXRecords parallelRes=ps1.process(ts,THREADS_NUM,128,7,7,NumerosityReductionStrategy.EXACT,0.005);
  assertTrue(sequentialString.equalsIgnoreCase(parallelRes.getSAXString("String_Node_Str")));
  for (  int i : parallelRes.getIndexes()) {
    String entrySerial=sequentialRes.getPositionsAndWords().get(i);
    String entryParallel=String.valueOf(parallelRes.getByIndex(i).getPayload());
    assertTrue(entrySerial.equalsIgnoreCase(entryParallel));
  }
  SAXFrequencyData sequentialRes2=SAXFactory.data2sax(ts,100,8,4);
  String sequentialString2=sequentialRes2.getSAXString("String_Node_Str");
  ParallelSAXImplementation ps2=new ParallelSAXImplementation();
  SAXRecords parallelRes2=ps2.process(ts,THREADS_NUM,100,8,4,NumerosityReductionStrategy.EXACT,0.005);
  assertTrue(sequentialString2.equalsIgnoreCase(parallelRes2.getSAXString("String_Node_Str")));
  for (  int i : parallelRes2.getIndexes()) {
    String entrySerial=sequentialRes2.getPositionsAndWords().get(i);
    String entryParallel=String.valueOf(parallelRes2.getByIndex(i).getPayload());
    assertTrue(entrySerial.equalsIgnoreCase(entryParallel));
  }
}
Program: 33787
Project: 33787
Buggy source:
private void gatherProtected(Island island){
  Pair<Integer,Integer> minWholeChunk=new Pair<>(nearest16(island.getMinProtectedX(),true),nearest16(island.getMinProtectedZ(),true));
  Pair<Integer,Integer> maxWholeChunk=new Pair<>(nearest16(island.getMinProtectedX() + Settings.islandProtectionRange,false),nearest16(island.getMinProtectedZ() + Settings.islandProtectionRange,false));
  Pair<Integer,Integer> minChunk=new Pair<>((int)Math.floor((double)island.getMinProtectedX() / 16),(int)Math.floor((double)island.getMinProtectedZ() / 16));
  Pair<Integer,Integer> maxChunk=new Pair<>((int)Math.floor((double)(island.getMinX() + Settings.islandProtectionRange) / 16),(int)Math.floor((double)(island.getMinZ() + Settings.islandProtectionRange) / 16));
  regenerate(island.getCenter().getWorld(),minWholeChunk,maxWholeChunk,minChunk,maxChunk);
}

Fixed version (ground truth):
private void gatherProtected(Island island){
  Pair<Integer,Integer> minWholeChunk=new Pair<>(nearest16(island.getMinProtectedX(),true),nearest16(island.getMinProtectedZ(),true));
  Pair<Integer,Integer> maxWholeChunk=new Pair<>(nearest16(island.getMinProtectedX() + Settings.islandProtectionRange,false),nearest16(island.getMinProtectedZ() + Settings.islandProtectionRange,false));
  Pair<Integer,Integer> minChunk=new Pair<>((int)Math.floor((double)island.getMinProtectedX() / 16),(int)Math.floor((double)island.getMinProtectedZ() / 16));
  Pair<Integer,Integer> maxChunk=new Pair<>((int)Math.floor((double)(island.getMinProtectedX() + Settings.islandProtectionRange) / 16),(int)Math.floor((double)(island.getMinProtectedZ() + Settings.islandProtectionRange) / 16));
  regenerate(island.getCenter().getWorld(),minWholeChunk,maxWholeChunk,minChunk,maxChunk);
}
Program: 33788
Project: 33788
Buggy source:
public static void sendActionBar(final Player player,final String message,int duration){
  sendActionBar(player,message);
  if (duration >= 0) {
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,"String_Node_Str");
      }
    }
.runTaskLater(plugin,duration + 1);
  }
  while (duration > 40) {
    duration-=40;
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,message);
      }
    }
.runTaskLater(plugin,(long)duration);
  }
}

Fixed version (ground truth):
public static void sendActionBar(final Player player,final String message,int duration){
  sendActionBar(player,message);
  if (duration >= 0) {
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,"String_Node_Str");
      }
    }
.runTaskLater(plugin,duration + 1);
  }
  while (duration > 40) {
    duration-=40;
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,message);
      }
    }
.runTaskLater(plugin,duration);
  }
}
Program: 33789
Project: 33789
Buggy source:
public static void sendActionBar(final Player player,final String message,int duration){
  sendActionBar(player,message);
  if (duration >= 0) {
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,"String_Node_Str");
      }
    }
.runTaskLater(plugin,duration + 1);
  }
  while (duration > 40) {
    duration-=40;
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,message);
      }
    }
.runTaskLater(plugin,duration);
  }
}

Fixed version (ground truth):
public static void sendActionBar(final Player player,final String message,int duration){
  sendActionBar(player,message);
  if (duration >= 0) {
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,"String_Node_Str");
      }
    }
.runTaskLater(plugin,duration + 1);
  }
  while (duration > 40) {
    duration-=40;
    new BukkitRunnable(){
      @Override public void run(){
        sendActionBar(player,message);
      }
    }
.runTaskLater(plugin,(long)duration);
  }
}
Program: 33790
Project: 33790
Buggy source:
/** 
 * Loops through the chunks and if a safe spot is found, fires off the teleportation 
 * @param chunkSnapshot
 */
private void checkChunks(final List<ChunkSnapshot> chunkSnapshot){
  plugin.getServer().getScheduler().runTaskAsynchronously(plugin,new Runnable(){
    @Override public void run(){
      for (      ChunkSnapshot chunk : chunkSnapshot) {
        if (scanChunk(chunk)) {
          task.cancel();
          return;
        }
      }
      checking=true;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Loops through the chunks and if a safe spot is found, fires off the teleportation
 * @param chunkSnapshot
 */
private void checkChunks(final List<ChunkSnapshot> chunkSnapshot){
  plugin.getServer().getScheduler().runTaskAsynchronously(plugin,new Runnable(){
    @Override public void run(){
      for (      ChunkSnapshot chunk : chunkSnapshot) {
        if (scanChunk(chunk)) {
          task.cancel();
          return;
        }
      }
      checking=true;
    }
  }
);
}
Program: 33791
Project: 33791
Buggy source:
/** 
 * Teleports entity to the safe spot
 */
private void teleportEntity(final Location loc){
  task.cancel();
  plugin.getServer().getScheduler().runTask(plugin,new Runnable(){
    @Override public void run(){
      if (!portal && entity instanceof Player) {
        plugin.getPlayers().setHomeLocation(entity.getUniqueId(),loc,homeNumber);
      }
      Vector velocity=entity.getVelocity();
      entity.teleport(loc);
      if (entity instanceof Player) {
        Player player=(Player)entity;
        if (player.getGameMode().equals(GameMode.SPECTATOR)) {
          player.setGameMode(GameMode.SURVIVAL);
        }
      }
 else {
        entity.setVelocity(velocity);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Teleports entity to the safe spot
 */
private void teleportEntity(final Location loc){
  task.cancel();
  plugin.getServer().getScheduler().runTask(plugin,new Runnable(){
    @Override public void run(){
      if (!portal && entity instanceof Player) {
        plugin.getPlayers().setHomeLocation(entity.getUniqueId(),loc,homeNumber);
      }
      Vector velocity=entity.getVelocity();
      entity.teleport(loc);
      if (entity instanceof Player) {
        Player player=(Player)entity;
        if (plugin.getServer().getVersion().contains("String_Node_Str")) {
          player.setGameMode(GameMode.SURVIVAL);
        }
 else         if (player.getGameMode().equals(GameMode.SPECTATOR)) {
          player.setGameMode(GameMode.SURVIVAL);
        }
      }
 else {
        entity.setVelocity(velocity);
      }
    }
  }
);
}
Program: 33792
Project: 33792
Buggy source:
@Override public void run(){
  if (!portal && entity instanceof Player) {
    plugin.getPlayers().setHomeLocation(entity.getUniqueId(),loc,homeNumber);
  }
  Vector velocity=entity.getVelocity();
  entity.teleport(loc);
  if (entity instanceof Player) {
    Player player=(Player)entity;
    if (player.getGameMode().equals(GameMode.SPECTATOR)) {
      player.setGameMode(GameMode.SURVIVAL);
    }
  }
 else {
    entity.setVelocity(velocity);
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (!portal && entity instanceof Player) {
    plugin.getPlayers().setHomeLocation(entity.getUniqueId(),loc,homeNumber);
  }
  Vector velocity=entity.getVelocity();
  entity.teleport(loc);
  if (entity instanceof Player) {
    Player player=(Player)entity;
    if (plugin.getServer().getVersion().contains("String_Node_Str")) {
      player.setGameMode(GameMode.SURVIVAL);
    }
 else     if (player.getGameMode().equals(GameMode.SPECTATOR)) {
      player.setGameMode(GameMode.SURVIVAL);
    }
  }
 else {
    entity.setVelocity(velocity);
  }
}
Program: 33793
Project: 33793
Buggy source:
/** 
 * Teleports and entity to a safe spot on island
 * @param plugin - ASkyBlock plugin object
 * @param entity
 * @param location
 * @param failureMessage - already translated failure message
 * @param portal
 * @param homeNumber
 */
protected SafeSpotTeleport(ASkyBlock plugin,final Entity entity,final Location location,final String failureMessage,boolean portal,int homeNumber){
  this.plugin=plugin;
  this.entity=entity;
  this.location=location;
  this.portal=portal;
  this.homeNumber=homeNumber;
  if (entity instanceof Player && ((Player)entity).getGameMode().equals(GameMode.SURVIVAL)) {
    ((Player)entity).setGameMode(GameMode.SPECTATOR);
  }
  chunksToScan=getChunksToScan();
  checking=true;
  task=plugin.getServer().getScheduler().runTaskTimer(plugin,new Runnable(){
    @Override public void run(){
      List<ChunkSnapshot> chunkSnapshot=new ArrayList<>();
      if (checking) {
        Iterator<Pair<Integer,Integer>> it=chunksToScan.iterator();
        if (!it.hasNext()) {
          tidyUp(entity,failureMessage);
          return;
        }
        while (it.hasNext() && chunkSnapshot.size() < MAX_CHUNKS) {
          Pair<Integer,Integer> pair=it.next();
          chunkSnapshot.add(location.getWorld().getChunkAt(pair.x,pair.z).getChunkSnapshot());
          it.remove();
        }
        checking=false;
        checkChunks(chunkSnapshot);
      }
    }
  }
,0L,SPEED);
}

Fixed version (ground truth):
/** 
 * Teleports and entity to a safe spot on island
 * @param plugin - ASkyBlock plugin object
 * @param entity
 * @param location
 * @param failureMessage - already translated failure message
 * @param portal
 * @param homeNumber
 */
protected SafeSpotTeleport(ASkyBlock plugin,final Entity entity,final Location location,final String failureMessage,boolean portal,int homeNumber){
  this.plugin=plugin;
  this.entity=entity;
  this.location=location;
  this.portal=portal;
  this.homeNumber=homeNumber;
  if (!plugin.getServer().getVersion().contains("String_Node_Str") && entity instanceof Player && ((Player)entity).getGameMode().equals(GameMode.SURVIVAL)) {
    ((Player)entity).setGameMode(GameMode.SPECTATOR);
  }
  chunksToScan=getChunksToScan();
  checking=true;
  task=plugin.getServer().getScheduler().runTaskTimer(plugin,new Runnable(){
    @Override public void run(){
      List<ChunkSnapshot> chunkSnapshot=new ArrayList<>();
      if (checking) {
        Iterator<Pair<Integer,Integer>> it=chunksToScan.iterator();
        if (!it.hasNext()) {
          tidyUp(entity,failureMessage);
          return;
        }
        while (it.hasNext() && chunkSnapshot.size() < MAX_CHUNKS) {
          Pair<Integer,Integer> pair=it.next();
          chunkSnapshot.add(location.getWorld().getChunkAt(pair.x,pair.z).getChunkSnapshot());
          it.remove();
        }
        checking=false;
        checkChunks(chunkSnapshot);
      }
    }
  }
,0L,SPEED);
}
Program: 33794
Project: 33794
Buggy source:
private void tidyUp(Entity entity,String failureMessage){
  task.cancel();
  if (portal && bestSpot != null) {
    teleportEntity(bestSpot);
  }
 else   if (entity instanceof Player && !failureMessage.isEmpty()) {
    entity.sendMessage(failureMessage);
  }
  if (entity instanceof Player && ((Player)entity).getGameMode().equals(GameMode.SPECTATOR)) {
    ((Player)entity).setGameMode(GameMode.SURVIVAL);
  }
}

Fixed version (ground truth):
private void tidyUp(Entity entity,String failureMessage){
  task.cancel();
  if (portal && bestSpot != null) {
    teleportEntity(bestSpot);
  }
 else   if (entity instanceof Player && !failureMessage.isEmpty()) {
    entity.sendMessage(failureMessage);
  }
  if (entity instanceof Player && (plugin.getServer().getVersion().contains("String_Node_Str") || ((Player)entity).getGameMode().equals(GameMode.SPECTATOR))) {
    ((Player)entity).setGameMode(GameMode.SURVIVAL);
  }
}
Program: 33795
Project: 33795
Buggy source:
/** 
 * Protect players from damage when teleporting
 * @param e - event
 */
public void onPlayerTeleportDamage(EntityDamageEvent e){
  if (!(e.getEntity() instanceof Player))   return;
  Player p=(Player)e.getEntity();
  if (plugin.getPlayers().isInTeleport(p.getUniqueId())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    p.setFallDistance(0);
    e.setCancelled(true);
  }
}

Fixed version (ground truth):
/** 
 * Protect players from damage when teleporting
 * @param e - event
 */
@EventHandler public void onPlayerTeleportDamage(EntityDamageEvent e){
  if (!(e.getEntity() instanceof Player))   return;
  Player p=(Player)e.getEntity();
  if (plugin.getPlayers().isInTeleport(p.getUniqueId())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    p.setFallDistance(0);
    e.setCancelled(true);
  }
}
Program: 33796
Project: 33796
Buggy source:
/** 
 * Prevents visitors from getting damage if invinciblevisitors option is set to TRUE
 * @param e - event
 */
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onVisitorGetDamage(EntityDamageEvent e){
  Player p=(Player)e.getEntity();
  if (!Settings.invincibleVisitors || !(e.getEntity() instanceof Player) || e.getCause().equals(DamageCause.ENTITY_ATTACK)|| !IslandGuard.inWorld(p)|| plugin.getGrid().playerIsOnIsland(p)) {
    return;
  }
  if (Settings.visitorDamagePrevention.contains(e.getCause()))   e.setCancelled(true);
  if (e.getCause().equals(DamageCause.VOID)) {
    if (plugin.getPlayers().hasIsland(p.getUniqueId()) || plugin.getPlayers().inTeam(p.getUniqueId())) {
      Location safePlace=plugin.getGrid().getSafeHomeLocation(p.getUniqueId(),1);
      if (safePlace != null) {
        unsetFalling(p.getUniqueId());
        p.teleport(safePlace);
        p.setFallDistance(0);
        e.setCancelled(true);
        return;
      }
    }
    if (plugin.getGrid().getSpawn() != null) {
      p.teleport(plugin.getGrid().getSpawnPoint());
      p.setFallDistance(0);
      e.setCancelled(true);
      return;
    }
 else     if (!p.performCommand("String_Node_Str")) {
      return;
    }
 else {
      p.setFallDistance(0);
      e.setCancelled(true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prevents visitors from getting damage if invinciblevisitors option is set to TRUE
 * @param e - event
 */
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onVisitorGetDamage(EntityDamageEvent e){
  if (!Settings.invincibleVisitors || !(e.getEntity() instanceof Player) || !e.getCause().equals(DamageCause.ENTITY_ATTACK)) {
    return;
  }
  Player p=(Player)e.getEntity();
  if (!IslandGuard.inWorld(p) || plugin.getGrid().locationIsOnIsland(p,p.getLocation()))   return;
  if (Settings.visitorDamagePrevention.contains(e.getCause()))   e.setCancelled(true);
  if (e.getCause().equals(DamageCause.VOID)) {
    if (plugin.getPlayers().hasIsland(p.getUniqueId()) || plugin.getPlayers().inTeam(p.getUniqueId())) {
      Location safePlace=plugin.getGrid().getSafeHomeLocation(p.getUniqueId(),1);
      if (safePlace != null) {
        unsetFalling(p.getUniqueId());
        p.teleport(safePlace);
        p.setFallDistance(0);
        e.setCancelled(true);
        return;
      }
    }
    if (plugin.getGrid().getSpawn() != null) {
      p.teleport(plugin.getGrid().getSpawnPoint());
      p.setFallDistance(0);
      e.setCancelled(true);
      return;
    }
 else     if (!p.performCommand("String_Node_Str")) {
      return;
    }
 else {
      p.setFallDistance(0);
      e.setCancelled(true);
    }
  }
}
Program: 33797
Project: 33797
Buggy source:
/** 
 * Copy constructor
 * @param island - island to copy
 */
public Island(Island island){
  this.plugin=island.plugin;
  this.biome=Biome.valueOf(island.biome.name());
  this.center=island.center != null ? island.center.clone() : null;
  this.createdDate=Long.valueOf(island.createdDate);
  island.igs.forEach((k,v) -> this.igs.put(k,v));
  this.islandDistance=Integer.valueOf(island.islandDistance);
  this.isSpawn=Boolean.valueOf(island.isSpawn);
  this.locked=Boolean.valueOf(island.locked);
  this.levelHandicap=Integer.valueOf(island.levelHandicap);
  this.minProtectedX=Integer.valueOf(island.minProtectedX);
  this.minProtectedZ=Integer.valueOf(island.minProtectedZ);
  this.minX=Integer.valueOf(island.minX);
  this.minZ=Integer.valueOf(island.minZ);
  this.owner=UUID.fromString(island.owner.toString());
  this.password=island.password;
  this.protectionRange=Integer.valueOf(island.protectionRange);
  this.purgeProtected=Boolean.valueOf(island.purgeProtected);
  this.spawnPoint=island.spawnPoint == null ? null : island.spawnPoint.clone();
  this.tileEntityCount.addAll(island.tileEntityCount);
  this.updatedDate=Long.valueOf(island.updatedDate);
  this.votes=Integer.valueOf(island.votes);
  this.world=Bukkit.getWorld(island.world.getUID());
  this.y=Integer.valueOf(island.y);
}

Fixed version (ground truth):
/** 
 * Copy constructor
 * @param island - island to copy
 */
public Island(Island island){
  this.plugin=island.plugin;
  this.biome=island.biome == null ? null : Biome.valueOf(island.biome.name());
  this.center=island.center != null ? island.center.clone() : null;
  this.createdDate=Long.valueOf(island.createdDate);
  island.igs.forEach((k,v) -> this.igs.put(k,v));
  this.islandDistance=Integer.valueOf(island.islandDistance);
  this.isSpawn=Boolean.valueOf(island.isSpawn);
  this.locked=Boolean.valueOf(island.locked);
  this.levelHandicap=Integer.valueOf(island.levelHandicap);
  this.minProtectedX=Integer.valueOf(island.minProtectedX);
  this.minProtectedZ=Integer.valueOf(island.minProtectedZ);
  this.minX=Integer.valueOf(island.minX);
  this.minZ=Integer.valueOf(island.minZ);
  this.owner=owner == null ? null : UUID.fromString(island.owner.toString());
  this.password=island.password;
  this.protectionRange=Integer.valueOf(island.protectionRange);
  this.purgeProtected=Boolean.valueOf(island.purgeProtected);
  this.spawnPoint=island.spawnPoint == null ? null : island.spawnPoint.clone();
  this.tileEntityCount.addAll(island.tileEntityCount);
  this.updatedDate=Long.valueOf(island.updatedDate);
  this.votes=Integer.valueOf(island.votes);
  this.world=island.world == null ? null : Bukkit.getWorld(island.world.getUID());
  this.y=Integer.valueOf(island.y);
}
Program: 33798
Project: 33798
Buggy source:
/** 
 * Prevents water from being dispensed in hell biomes
 * @param e - event
 */
@EventHandler(priority=EventPriority.LOW) public void onNetherDispenser(final BlockDispenseEvent e){
  if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
  }
  if (!inWorld(e.getBlock().getLocation()) || !e.getBlock().getBiome().equals(Biome.HELL)) {
    return;
  }
  if (e.getItem().getType().equals(Material.WATER_BUCKET)) {
    e.setCancelled(true);
    if (plugin.getServer().getVersion().contains("String_Node_Str") || plugin.getServer().getVersion().contains("String_Node_Str")) {
      e.getBlock().getWorld().playSound(e.getBlock().getLocation(),Sound.valueOf("String_Node_Str"),1F,2F);
    }
 else {
      e.getBlock().getWorld().playSound(e.getBlock().getLocation(),Sound.ENTITY_CREEPER_PRIMED,1F,2F);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prevents water from being dispensed in hell biomes
 * @param e - event
 */
@EventHandler(priority=EventPriority.LOW) public void onNetherDispenser(final BlockDispenseEvent e){
  if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
  }
  if (e.getBlock().getWorld().getEnvironment().equals(Environment.NETHER) || !inWorld(e.getBlock().getLocation()) || !e.getBlock().getBiome().equals(Biome.HELL)) {
    return;
  }
  if (e.getItem().getType().equals(Material.WATER_BUCKET)) {
    e.setCancelled(true);
    if (plugin.getServer().getVersion().contains("String_Node_Str") || plugin.getServer().getVersion().contains("String_Node_Str")) {
      e.getBlock().getWorld().playSound(e.getBlock().getLocation(),Sound.valueOf("String_Node_Str"),1F,2F);
    }
 else {
      e.getBlock().getWorld().playSound(e.getBlock().getLocation(),Sound.ENTITY_CREEPER_PRIMED,1F,2F);
    }
  }
}
Program: 33801
Project: 33801
Buggy source:
@Override public void run(){
  if (coopInviteList.containsKey(targetPlayerUUID) && inviteList.get(targetPlayerUUID).equals(playerUUID)) {
    inviteList.remove(targetPlayerUUID);
    if (plugin.getServer().getPlayer(playerUUID) != null) {
      Util.sendMessage(plugin.getServer().getPlayer(playerUUID),ChatColor.YELLOW + plugin.myLocale(player.getUniqueId()).inviteremovingInvite);
    }
    if (plugin.getServer().getPlayer(targetPlayerUUID) != null) {
      Util.sendMessage(plugin.getServer().getPlayer(targetPlayerUUID),ChatColor.YELLOW + plugin.myLocale(player.getUniqueId()).inviteremovingInvite);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (coopInviteList.containsKey(targetPlayerUUID) && coopInviteList.get(targetPlayerUUID).equals(playerUUID)) {
    coopInviteList.remove(targetPlayerUUID);
    if (plugin.getServer().getPlayer(playerUUID) != null) {
      Util.sendMessage(plugin.getServer().getPlayer(playerUUID),ChatColor.YELLOW + plugin.myLocale(player.getUniqueId()).inviteremovingInvite);
    }
    if (plugin.getServer().getPlayer(targetPlayerUUID) != null) {
      Util.sendMessage(plugin.getServer().getPlayer(targetPlayerUUID),ChatColor.YELLOW + plugin.myLocale(player.getUniqueId()).inviteremovingInvite);
    }
  }
}
Program: 33804
Project: 33804
Buggy source:
private String getPlayer(int slot){
  String result="String_Node_Str";
  int i=0;
  while (i < 11 && slot != SLOTS[i]) {
    i++;
  }
  if (i < 10) {
    Iterator<UUID> it=topTenList.keySet().iterator();
    while (i > 0 && it.hasNext()) {
      it.next();
      i--;
    }
    result=plugin.getPlayers().getName(it.next());
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Get the name of the player from the slot clicked in the inventory
 * @param slot - slot clicked
 * @return name of player or empty if not found
 */
private String getPlayer(int slot){
  String result="String_Node_Str";
  int i=0;
  while (i < SLOTS.length && slot != SLOTS[i]) {
    i++;
  }
  if (i < SLOTS.length && slot == SLOTS[i]) {
    Iterator<UUID> it=topTenList.keySet().iterator();
    while (i > 0 && it.hasNext()) {
      it.next();
      i--;
    }
    if (it.hasNext()) {
      result=plugin.getPlayers().getName(it.next());
    }
  }
  return result;
}