nus-yam/ex-repair huggingface dataset:
Program: 52854
Project: 52854
Buggy source:
private static boolean includeIfPackageExists(String jarEntryName,String[] includeOnPackages){
  if (includeOnPackages == null) {
    return true;
  }
  String packageName=jarEntryName.replace('/','.');
  for (  String includeOnPackage : includeOnPackages) {
    if (packageName.startsWith(includeOnPackage)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean includeIfPackageExists(String jarEntryName,String[] includeOnPackages){
  if (includeOnPackages == null) {
    return true;
  }
  String packageName=pathToClassName(jarEntryName);
  for (  String includeOnPackage : includeOnPackages) {
    if (packageName.startsWith(includeOnPackage)) {
      return true;
    }
  }
  return false;
}
Program: 52855
Project: 52855
Buggy source:
private static boolean excludeIfPackageExists(String jarEntryName,String[] excludeOnPackages){
  if (excludeOnPackages != null) {
    String packageName=jarEntryName.replace('/','.');
    for (    String excludeOnPackage : excludeOnPackages) {
      if (packageName.startsWith(excludeOnPackage)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean excludeIfPackageExists(String jarEntryName,String[] excludeOnPackages){
  if (excludeOnPackages != null) {
    String packageName=pathToClassName(jarEntryName);
    for (    String excludeOnPackage : excludeOnPackages) {
      if (packageName.startsWith(excludeOnPackage)) {
        return true;
      }
    }
  }
  return false;
}
Program: 52856
Project: 52856
Buggy source:
private static JavaArchive addJarArchive(InputStream inputStream,String[] includeIfPackageExists,String[] excludeIfPackageExists) throws IOException {
  JavaArchive ret=null;
  JavaArchive javaArchive=ShrinkWrap.create(JavaArchive.class);
  if (includeIfPackageExists == null) {
    ret=javaArchive;
  }
  JarInputStream jar=new JarInputStream(inputStream);
  try {
    for (ZipEntry jarEntry=jar.getNextEntry(); jarEntry != null; jarEntry=jar.getNextEntry()) {
      String entryName=jarEntry.getName();
      if (jarEntry.isDirectory()) {
        if (excludeIfPackageExists(entryName,excludeIfPackageExists)) {
          return null;
        }
        if (ret == null && includeIfPackageExists(entryName,includeIfPackageExists)) {
          ret=javaArchive;
        }
        continue;
      }
      if (entryName.endsWith("String_Node_Str")) {
        String className=entryName.substring(0,entryName.length() - ("String_Node_Str".length())).replace('/','.');
        javaArchive.addClass(className);
      }
 else {
        javaArchive.addAsResource(entryName);
      }
    }
  }
  finally {
    try {
      jar.close();
    }
 catch (    IOException ignored) {
    }
  }
  return ret;
}

Fixed version (ground truth):
private static JavaArchive addJarArchive(InputStream inputStream,String[] includeIfPackageExists,String[] excludeIfPackageExists) throws IOException {
  JavaArchive ret=null;
  JavaArchive javaArchive=ShrinkWrap.create(JavaArchive.class);
  if (includeIfPackageExists == null) {
    ret=javaArchive;
  }
  JarInputStream jar=new JarInputStream(inputStream);
  try {
    for (ZipEntry jarEntry=jar.getNextEntry(); jarEntry != null; jarEntry=jar.getNextEntry()) {
      String entryName=jarEntry.getName();
      if (jarEntry.isDirectory()) {
        if (excludeIfPackageExists(entryName,excludeIfPackageExists)) {
          return null;
        }
        if (ret == null && includeIfPackageExists(entryName,includeIfPackageExists)) {
          ret=javaArchive;
        }
        continue;
      }
      if (entryName.endsWith("String_Node_Str")) {
        String className=pathToClassName(entryName.substring(0,entryName.length() - ("String_Node_Str".length())));
        javaArchive.addClass(className);
      }
 else {
        javaArchive.addAsResource(entryName);
      }
    }
  }
  finally {
    try {
      jar.close();
    }
 catch (    IOException ignored) {
    }
  }
  return ret;
}
Program: 52857
Project: 52857
Buggy source:
private static JavaArchive addFileArchive(File archiveBasePath,String[] includeIfPackageExists,String[] excludeIfPackageExists) throws IOException {
  if (!archiveBasePath.exists()) {
    return null;
  }
  JavaArchive ret=null;
  JavaArchive javaArchive=ShrinkWrap.create(JavaArchive.class);
  if (includeIfPackageExists == null) {
    ret=javaArchive;
  }
  int basePathLength=archiveBasePath.getAbsolutePath().length() + 1;
  for (  File archiveEntry : collectArchiveEntries(archiveBasePath)) {
    String entryName=archiveEntry.getAbsolutePath().substring(basePathLength);
    if (excludeIfPackageExists(entryName,excludeIfPackageExists)) {
      return null;
    }
    if (ret == null && includeIfPackageExists(entryName,includeIfPackageExists)) {
      ret=javaArchive;
    }
    if (entryName.endsWith("String_Node_Str")) {
      String className=entryName.substring(0,entryName.length() - ("String_Node_Str".length())).replace('/','.');
      javaArchive.addClass(className);
    }
 else {
      javaArchive.addAsResource(entryName);
    }
  }
  return ret;
}

Fixed version (ground truth):
private static JavaArchive addFileArchive(File archiveBasePath,String[] includeIfPackageExists,String[] excludeIfPackageExists) throws IOException {
  if (!archiveBasePath.exists()) {
    return null;
  }
  JavaArchive ret=null;
  JavaArchive javaArchive=ShrinkWrap.create(JavaArchive.class);
  if (includeIfPackageExists == null) {
    ret=javaArchive;
  }
  int basePathLength=archiveBasePath.getAbsolutePath().length() + 1;
  for (  File archiveEntry : collectArchiveEntries(archiveBasePath)) {
    String entryName=archiveEntry.getAbsolutePath().substring(basePathLength);
    if (excludeIfPackageExists(entryName,excludeIfPackageExists)) {
      return null;
    }
    if (ret == null && includeIfPackageExists(entryName,includeIfPackageExists)) {
      ret=javaArchive;
    }
    if (entryName.endsWith("String_Node_Str")) {
      String className=pathToClassName(entryName.substring(0,entryName.length() - ("String_Node_Str".length())));
      javaArchive.addClass(className);
    }
 else {
      javaArchive.addAsResource(entryName.replace('\\','/'));
    }
  }
  return ret;
}
Program: 52858
Project: 52858
Buggy source:
/** 
 * Instantiates a given class via the default constructor
 * @param targetClass class which should be instantiated
 * @param < T > current type
 * @return created instance or null if the instantiation failed
 */
public static <T>T tryToInstantiateClass(Class<T> targetClass){
  try {
    return targetClass.newInstance();
  }
 catch (  Exception e) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Instantiates a given class via the default constructor
 * @param targetClass class which should be instantiated
 * @param < T > current type
 * @return created instance or null if the instantiation failed
 */
public static <T>T tryToInstantiateClass(Class<T> targetClass){
  try {
    return targetClass.newInstance();
  }
 catch (  InstantiationException e) {
  }
catch (  IllegalAccessException e) {
  }
  return null;
}
Program: 52859
Project: 52859
Buggy source:
@Override public void calculateBuffer(){
  if (adderUGen == null) {
    for (int j=0; j < outs; j++) {
      float[] bi=bufIn[j];
      float[] bo=bufOut[j];
      for (int i=0; i < bufferSize; i++) {
        bo[i]=bi[j] + adder;
      }
    }
  }
 else {
    adderUGen.update();
    if (outs == 1) {
      float[] bi=bufIn[0];
      float[] bo=bufOut[0];
      for (int i=0; i < bufferSize; i++) {
        adder=adderUGen.getValue(0,i);
        bo[i]=bi[i] + adder;
      }
    }
 else {
      for (int i=0; i < bufferSize; i++) {
        for (int j=0; j < outs; j++) {
          adder=adderUGen.getValue(0,i);
          bufOut[j][i]=bufIn[j][i] + adder;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void calculateBuffer(){
  if (adderUGen == null) {
    for (int j=0; j < outs; j++) {
      float[] bi=bufIn[j];
      float[] bo=bufOut[j];
      for (int i=0; i < bufferSize; i++) {
        bo[i]=bi[i] + adder;
      }
    }
  }
 else {
    adderUGen.update();
    if (outs == 1) {
      float[] bi=bufIn[0];
      float[] bo=bufOut[0];
      for (int i=0; i < bufferSize; i++) {
        adder=adderUGen.getValue(0,i);
        bo[i]=bi[i] + adder;
      }
    }
 else {
      for (int i=0; i < bufferSize; i++) {
        for (int j=0; j < outs; j++) {
          adder=adderUGen.getValue(0,i);
          bufOut[j][i]=bufIn[j][i] + adder;
        }
      }
    }
  }
}
Program: 52860
Project: 52860
Buggy source:
public static void main(String[] args){
  AudioContext ac;
  ac=new AudioContext();
  WavePlayer wp=new WavePlayer(ac,500,Buffer.SINE);
  Gain g=new Gain(ac,1,new Envelope(ac,0.1f));
  ((Envelope)g.getGainEnvelope()).addSegment(0,5000,new AudioContextStopTrigger(ac));
  g.addInput(wp);
  ac.out.addInput(g);
  Clock c=new Clock(ac,1000);
  c.setClick(true);
  ac.out.addDependent(c);
  ac.start();
}

Fixed version (ground truth):
public static void main(String[] args){
  AudioContext ac;
  ac=new AudioContext();
  WavePlayer wp=new WavePlayer(ac,500,Buffer.SINE);
  Gain g=new Gain(ac,1,new Envelope(ac,0.1f));
  ((Envelope)g.getGainUGen()).addSegment(0,5000,new AudioContextStopTrigger(ac));
  g.addInput(wp);
  ac.out.addInput(g);
  Clock c=new Clock(ac,1000);
  c.setClick(true);
  ac.out.addDependent(c);
  ac.start();
}
Program: 52861
Project: 52861
Buggy source:
public void messageReceived(Bead message){
  Clock c=(Clock)message;
  if (c.isBeat()) {
    WavePlayer wp=new WavePlayer(ac,(float)Math.random() * 3000 + 100,Buffer.SINE);
    Gain g=new Gain(ac,1,new Envelope(ac,0.1f));
    ((Envelope)g.getGainEnvelope()).addSegment(0,1000,new KillTrigger(g));
    g.addInput(wp);
    ac.out.addInput(g);
  }
}

Fixed version (ground truth):
public void messageReceived(Bead message){
  Clock c=(Clock)message;
  if (c.isBeat()) {
    WavePlayer wp=new WavePlayer(ac,(float)Math.random() * 3000 + 100,Buffer.SINE);
    Gain g=new Gain(ac,1,new Envelope(ac,0.1f));
    ((Envelope)g.getGainUGen()).addSegment(0,1000,new KillTrigger(g));
    g.addInput(wp);
    ac.out.addInput(g);
  }
}
Program: 52862
Project: 52862
Buggy source:
public static void main(String[] args){
  final AudioContext ac;
  ac=new AudioContext();
  Clock clock=new Clock(ac,700);
  clock.addMessageListener(new Bead(){
    public void messageReceived(    Bead message){
      Clock c=(Clock)message;
      if (c.isBeat()) {
        WavePlayer wp=new WavePlayer(ac,(float)Math.random() * 3000 + 100,Buffer.SINE);
        Gain g=new Gain(ac,1,new Envelope(ac,0.1f));
        ((Envelope)g.getGainEnvelope()).addSegment(0,1000,new KillTrigger(g));
        g.addInput(wp);
        ac.out.addInput(g);
      }
    }
  }
);
  ac.out.addDependent(clock);
  ac.start();
}

Fixed version (ground truth):
public static void main(String[] args){
  final AudioContext ac;
  ac=new AudioContext();
  Clock clock=new Clock(ac,700);
  clock.addMessageListener(new Bead(){
    public void messageReceived(    Bead message){
      Clock c=(Clock)message;
      if (c.isBeat()) {
        WavePlayer wp=new WavePlayer(ac,(float)Math.random() * 3000 + 100,Buffer.SINE);
        Gain g=new Gain(ac,1,new Envelope(ac,0.1f));
        ((Envelope)g.getGainUGen()).addSegment(0,1000,new KillTrigger(g));
        g.addInput(wp);
        ac.out.addInput(g);
      }
    }
  }
);
  ac.out.addDependent(clock);
  ac.start();
}
Program: 52863
Project: 52863
Buggy source:
/** 
 * Specify an audio file that the Sample reads from. If BufferedRegime is TOTAL, this will block until the sample is loaded.
 * @throws AudioFileUnsupportedException
 */
private void loadAudioFile(String file) throws IOException {
  Class<? extends AudioFileReader> theRealAudioFileReaderClass=audioFileReaderClass == null ? defaultAudioFileReaderClass : audioFileReaderClass;
  AudioFileReader audioFileReader;
  try {
    audioFileReader=theRealAudioFileReaderClass.getConstructor().newInstance();
  }
 catch (  Exception e1) {
    throw new IOException("String_Node_Str");
  }
  try {
    this.theSampleData=audioFileReader.readAudioFile(file);
  }
 catch (  Exception e) {
    throw new IOException("String_Node_Str" + file);
  }
  this.sampleRate=audioFileReader.getSampleAudioFormat().sampleRate;
  this.nChannels=theSampleData.length;
  this.nFrames=theSampleData[0].length;
}

Fixed version (ground truth):
/** 
 * Specify an audio file that the Sample reads from. If BufferedRegime is TOTAL, this will block until the sample is loaded.
 * @throws AudioFileUnsupportedException
 */
private void loadAudioFile(String file) throws IOException {
  Class<? extends AudioFileReader> theRealAudioFileReaderClass=audioFileReaderClass == null ? defaultAudioFileReaderClass : audioFileReaderClass;
  AudioFileReader audioFileReader;
  try {
    audioFileReader=theRealAudioFileReaderClass.getConstructor().newInstance();
  }
 catch (  Exception e1) {
    throw new IOException("String_Node_Str");
  }
  try {
    this.theSampleData=audioFileReader.readAudioFile(file);
  }
 catch (  Exception e) {
    throw new IOException("String_Node_Str" + file + "String_Node_Str"+ e.getMessage());
  }
  this.sampleRate=audioFileReader.getSampleAudioFormat().sampleRate;
  this.nChannels=theSampleData.length;
  this.nFrames=theSampleData[0].length;
  this.current=new float[nChannels];
  this.next=new float[nChannels];
}
Program: 52864
Project: 52864
Buggy source:
public static void main(String[] args){
  AudioContext ac;
  ac=new AudioContext();
  String audioFile="String_Node_Str";
  GranularSamplePlayer player=new GranularSamplePlayer(ac,SampleManager.sample(audioFile));
  player.setLoopType(SamplePlayer.LoopType.LOOP_ALTERNATING);
  player.getLoopStartUGen().setValue(0);
  player.getLoopEndUGen().setValue((float)SampleManager.sample(audioFile).getLength());
  Envelope grainIntervalEnvelope=new Envelope(ac,100);
  grainIntervalEnvelope.addSegment(20,10000);
  player.setGrainIntervalUgen(grainIntervalEnvelope);
  Envelope rateEnvelope=new Envelope(ac,1);
  rateEnvelope.addSegment(1,5000);
  rateEnvelope.addSegment(0,5000);
  rateEnvelope.addSegment(0,2000);
  rateEnvelope.addSegment(-0.1f,2000);
  player.setRate(rateEnvelope);
  player.getRandomnessUGen().setValue(0.01f);
  Gain g=new Gain(ac,2,0.2f);
  g.addInput(player);
  ac.out.addInput(g);
  ac.start();
}

Fixed version (ground truth):
public static void main(String[] args){
  AudioContext ac;
  ac=new AudioContext();
  String audioFile="String_Node_Str";
  GranularSamplePlayer player=new GranularSamplePlayer(ac,SampleManager.sample(audioFile));
  player.setLoopType(SamplePlayer.LoopType.LOOP_ALTERNATING);
  player.getLoopStartUGen().setValue(0);
  player.getLoopEndUGen().setValue((float)SampleManager.sample(audioFile).getLength());
  Envelope grainIntervalEnvelope=new Envelope(ac,100);
  grainIntervalEnvelope.addSegment(20,10000);
  player.setGrainInterval(grainIntervalEnvelope);
  Envelope rateEnvelope=new Envelope(ac,1);
  rateEnvelope.addSegment(1,5000);
  rateEnvelope.addSegment(0,5000);
  rateEnvelope.addSegment(0,2000);
  rateEnvelope.addSegment(-0.1f,2000);
  player.setRate(rateEnvelope);
  player.getRandomnessUGen().setValue(0.01f);
  Gain g=new Gain(ac,2,0.2f);
  g.addInput(player);
  ac.out.addInput(g);
  ac.start();
}
Program: 52866
Project: 52866
Buggy source:
/** 
 * Writes out the configuration file.
 */
private void writeConf(){
  try {
    File file=new File("String_Node_Str");
    BufferedWriter output=new BufferedWriter(new FileWriter(file));
    output.write("String_Node_Str");
    writeHOCONString(output,baseDir.getText());
    if (dataSourceSelection.getSelectedIndex() == 0)     output.write("String_Node_Str");
 else     output.write("String_Node_Str");
    output.write("String_Node_Str");
    writeHOCONString(output,String.format("String_Node_Str",h2Path.getText()));
    output.write("String_Node_Str");
    writeHOCONString(output,String.format("String_Node_Str",postgresHost.getText(),postgresDB.getText()));
    output.write("String_Node_Str");
    writeHOCONString(output,postgresUser.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresPass.getPassword());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresHost.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresPort.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresDB.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresUser.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresPass.getPassword());
    output.write("String_Node_Str");
    output.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Writes out the configuration file.
 */
private void writeConf(){
  try {
    File file=new File("String_Node_Str");
    BufferedWriter output=new BufferedWriter(new FileWriter(file));
    output.write("String_Node_Str");
    writeHOCONString(output,baseDir.getText());
    if (dataSourceSelection.getSelectedIndex() == 0)     output.write("String_Node_Str");
 else     output.write("String_Node_Str");
    output.write("String_Node_Str");
    writeHOCONString(output,String.format("String_Node_Str",h2Path.getText()));
    output.write("String_Node_Str");
    writeHOCONString(output,String.format("String_Node_Str",postgresHost.getText(),postgresDB.getText()));
    output.write("String_Node_Str");
    writeHOCONString(output,postgresUser.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,new String(postgresPass.getPassword()));
    output.write("String_Node_Str");
    writeHOCONString(output,postgresHost.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresPort.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresDB.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,postgresUser.getText());
    output.write("String_Node_Str");
    writeHOCONString(output,new String(postgresPass.getPassword()));
    output.write("String_Node_Str");
    output.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 52867
Project: 52867
Buggy source:
@Override public SRResult similarity(String phrase1,String phrase2,boolean explanations) throws DaoException {
  double sum=0.0;
  for (  SubMetric m : metrics) {
    SRResult r=m.metric.similarity(phrase1,phrase2,false);
    if (r.isValid()) {
      sum+=m.coefficient * r.getScore();
    }
  }
  return new SRResult(sum);
}

Fixed version (ground truth):
@Override public SRResult similarity(String phrase1,String phrase2,boolean explanations) throws DaoException {
  double sum=0.0;
  double divisor=0.0;
  for (  SubMetric m : metrics) {
    SRResult r=m.metric.similarity(phrase1,phrase2,false);
    if (r != null && r.isValid()) {
      sum+=m.coefficient * r.getScore();
      divisor+=m.coefficient;
    }
  }
  return new SRResult((divisor > 0) ? (sum / divisor) : Double.NaN);
}
Program: 52868
Project: 52868
Buggy source:
@Override public Neighborhood query(float[] vector,int k,int maxTraversal,TIntSet validIds){
  if (validIds != null) {
    TIntSet tmp=validIds;
    validIds=new TIntHashSet(tmp.size() * 4);
    tmp.addAll(validIds);
  }
  long vbits[]=new long[2];
  project(vector,vbits);
  long p0=vbits[0];
  long p1=vbits[1];
  int[] numHits=new int[NUM_BITS + 1];
  for (int i=0; i < ids.length; i++) {
    if (validIds != null && !validIds.contains(ids[i]))     continue;
    int nSet=NUM_BITS - Long.bitCount(bits[2 * i] ^ p0) - Long.bitCount(bits[2 * i + 1] ^ p1);
    numHits[nSet]++;
  }
  int threshold;
  int count=0;
  for (threshold=NUM_BITS; threshold > 0; threshold--) {
    count+=numHits[threshold];
    if (count >= maxTraversal) {
      break;
    }
  }
  NeighborhoodAccumulator accum=new NeighborhoodAccumulator(k);
  for (int i=0; i < ids.length; i++) {
    if (validIds != null && !validIds.contains(ids[i]))     continue;
    int nSet=NUM_BITS - Long.bitCount(bits[2 * i] ^ p0) - Long.bitCount(bits[2 * i + 1] ^ p1);
    if (nSet >= threshold) {
      try {
        DenseMatrixRow row=matrix.getRow(ids[i]);
        double sim=KmeansKNNFinder.cosine(vector,row);
        accum.visit(ids[i],sim);
      }
 catch (      IOException e) {
        throw new IllegalStateException(e);
      }
    }
  }
  return accum.get();
}

Fixed version (ground truth):
@Override public Neighborhood query(float[] vector,int k,int maxTraversal,TIntSet validIds){
  if (validIds != null) {
    TIntSet tmp=validIds;
    validIds=new TIntHashSet(tmp.size() * 4);
    validIds.addAll(tmp);
  }
  long vbits[]=new long[2];
  project(vector,vbits);
  long p0=vbits[0];
  long p1=vbits[1];
  int[] numHits=new int[NUM_BITS + 1];
  for (int i=0; i < ids.length; i++) {
    if (validIds != null && !validIds.contains(ids[i]))     continue;
    int nSet=NUM_BITS - Long.bitCount(bits[2 * i] ^ p0) - Long.bitCount(bits[2 * i + 1] ^ p1);
    numHits[nSet]++;
  }
  int threshold;
  int count=0;
  for (threshold=NUM_BITS; threshold > 0; threshold--) {
    count+=numHits[threshold];
    if (count >= maxTraversal) {
      break;
    }
  }
  NeighborhoodAccumulator accum=new NeighborhoodAccumulator(k);
  for (int i=0; i < ids.length; i++) {
    if (validIds != null && !validIds.contains(ids[i]))     continue;
    int nSet=NUM_BITS - Long.bitCount(bits[2 * i] ^ p0) - Long.bitCount(bits[2 * i + 1] ^ p1);
    if (nSet >= threshold) {
      try {
        DenseMatrixRow row=matrix.getRow(ids[i]);
        double sim=KmeansKNNFinder.cosine(vector,row);
        accum.visit(ids[i],sim);
      }
 catch (      IOException e) {
        throw new IllegalStateException(e);
      }
    }
  }
  return accum.get();
}
Program: 52869
Project: 52869
Buggy source:
/** 
 * Counts a bigram.
 * @param word
 */
public void countBigram(String word){
  word=word.trim();
  if (word.isEmpty()) {
    return;
  }
  if (containsMentions) {
    Matcher m=PATTERN_MENTION.matcher(word);
    if (m.matches()) {
      word=m.group(1);
    }
  }
synchronized (bigramCounts) {
    bigramCounts.adjustOrPutValue(getHash(word),1,1);
  }
  if (totalBigrams.incrementAndGet() % PRUNE_INTERVAL == 0) {
    pruneIfNecessary();
  }
}

Fixed version (ground truth):
/** 
 * Counts a bigram.
 * @param word
 */
public void countBigram(String word){
  word=word.trim();
  if (word.isEmpty()) {
    return;
  }
  if (containsMentions) {
    Matcher m=PATTERN_MENTION.matcher(word);
    if (m.matches()) {
      word=m.group(1);
    }
  }
  long h=getHash(word);
synchronized (bigramCounts) {
    bigramCounts.adjustOrPutValue(h,1,1);
  }
  if (totalBigrams.incrementAndGet() % PRUNE_INTERVAL == 0) {
    pruneIfNecessary();
  }
}
Program: 52870
Project: 52870
Buggy source:
/** 
 * Returns a map of UniversalPages of the specified page type by a collection of universal IDs
 * @param univIds a collection of universal IDs
 * @return a map of universal IDs to UniversalPages
 * @throws DaoException if there was an error retrieving the pages
 */
public Map<Integer,T> getByIds(Collection<Integer> univIds) throws DaoException ;

Fixed version (ground truth):
/** 
 * Returns a map of UniversalPages of the specified page type by a collection of universal IDs
 * @param univIds a collection of universal IDs
 * @return a map of universal IDs to UniversalPages
 * @throws DaoException if there was an error retrieving the pages
 */
public Map<Integer,UniversalPage> getByIds(Collection<Integer> univIds) throws DaoException ;
Program: 52871
Project: 52871
Buggy source:
/** 
 * Returns a UniversalPage instance of the specified page type corresponding to the input universal ID
 * @param univId the universal ID to be retrieved
 * @return a UniversalPage
 * @throws DaoException if there was an error retrieving the page
 */
public T getById(int univId) throws DaoException ;

Fixed version (ground truth):
/** 
 * Returns a UniversalPage instance of the specified page type corresponding to the input universal ID
 * @param univId the universal ID to be retrieved
 * @return a UniversalPage
 * @throws DaoException if there was an error retrieving the page
 */
public UniversalPage getById(int univId) throws DaoException ;
Program: 52872
Project: 52872
Buggy source:
@Override public Map<Integer,T> getByIds(Collection<Integer> univIds) throws DaoException {
  if (univIds == null || univIds.isEmpty()) {
    return null;
  }
  Map<Integer,T> map=new HashMap<Integer,T>();
  for (  Integer univId : univIds) {
    map.put(univId,getById(univId));
  }
  return map;
}

Fixed version (ground truth):
@Override public Map<Integer,UniversalPage> getByIds(Collection<Integer> univIds) throws DaoException {
  if (univIds == null || univIds.isEmpty()) {
    return null;
  }
  Map<Integer,UniversalPage> map=new HashMap<Integer,UniversalPage>();
  for (  Integer univId : univIds) {
    map.put(univId,getById(univId));
  }
  return map;
}
Program: 52873
Project: 52873
Buggy source:
@Override public T transform(int[] item) throws DaoException {
  return getById(item[0]);
}

Fixed version (ground truth):
@Override public UniversalPage transform(int[] item) throws DaoException {
  return getById(item[0]);
}
Program: 52874
Project: 52874
Buggy source:
@Override public T getById(int univId) throws DaoException {
  DSLContext context=getJooq();
  try {
    Result<Record> result=context.select().from(Tables.UNIVERSAL_PAGE).where(Tables.UNIVERSAL_PAGE.UNIV_ID.eq(univId)).and(Tables.UNIVERSAL_PAGE.ALGORITHM_ID.eq(algorithmId)).fetch();
    return (T)buildUniversalPage(result);
  }
  finally {
    freeJooq(context);
  }
}

Fixed version (ground truth):
@Override public UniversalPage getById(int univId) throws DaoException {
  DSLContext context=getJooq();
  try {
    Result<Record> result=context.select().from(Tables.UNIVERSAL_PAGE).where(Tables.UNIVERSAL_PAGE.UNIV_ID.eq(univId)).and(Tables.UNIVERSAL_PAGE.ALGORITHM_ID.eq(algorithmId)).fetch();
    return (UniversalPage)buildUniversalPage(result);
  }
  finally {
    freeJooq(context);
  }
}
Program: 52875
Project: 52875
Buggy source:
public static void main(String args[]) throws ConfigurationException, ClassNotFoundException, IOException, InterruptedException, SQLException, DaoException {
  try {
    Loader loader=new Loader(args);
    if (!loader.runDiagnostics()) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    System.err.println("String_Node_Str");
    Thread.sleep(20000);
    loader.run();
  }
 catch (  ParseException e) {
    usage("String_Node_Str",e);
  }
catch (  IllegalArgumentException e) {
    usage("String_Node_Str",e);
  }
catch (  StageFailedException e) {
    System.err.println("String_Node_Str" + e.getStage().getName() + "String_Node_Str"+ e.getExitCode());
    System.exit(1);
  }
}

Fixed version (ground truth):
public static void main(String args[]) throws ConfigurationException, ClassNotFoundException, IOException, InterruptedException, SQLException, DaoException {
  try {
    Loader loader=new Loader(args);
    if (!loader.runDiagnostics()) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    System.err.println("String_Node_Str");
    Thread.sleep(5000);
    System.err.println("String_Node_Str");
    Thread.sleep(5000);
    System.err.println("String_Node_Str");
    Thread.sleep(5000);
    System.err.println("String_Node_Str");
    Thread.sleep(5000);
    loader.run();
  }
 catch (  ParseException e) {
    usage("String_Node_Str",e);
  }
catch (  IllegalArgumentException e) {
    usage("String_Node_Str",e);
  }
catch (  StageFailedException e) {
    System.err.println("String_Node_Str" + e.getStage().getName() + "String_Node_Str"+ e.getExitCode());
    System.exit(1);
  }
}
Program: 52877
Project: 52877
Buggy source:
public static void main(String args[]) throws ConfigurationException, DaoException {
  Env env=EnvBuilder.envFromArgs(args);
  PageViewDao viewDao=env.getConfigurator().get(PageViewDao.class);
  SpatialDataDao spatialDao=env.getConfigurator().get(SpatialDataDao.class);
  UniversalPageDao conceptDao=env.getConfigurator().get(UniversalPageDao.class);
  LocalPageDao pageDao=env.getConfigurator().get(LocalPageDao.class);
  Language lang=env.getDefaultLanguage();
  DateTime start=new DateTime(2014,8,14,21,0,0);
  DateTime end=new DateTime(2014,8,14,23,0,0);
  viewDao.ensureLoaded(start,end,env.getLanguages());
  Map<Integer,Geometry> countries=spatialDao.getAllGeometriesInLayer("String_Node_Str");
  System.out.println("String_Node_Str" + countries.size() + "String_Node_Str");
  for (  int conceptId : countries.keySet()) {
    int pageId=conceptDao.getById(conceptId).getLocalId(lang);
    if (pageId > 0) {
      LocalPage page=pageDao.getById(lang,pageId);
      System.out.println("String_Node_Str" + countries);
    }
  }
}

Fixed version (ground truth):
public static void main(String args[]) throws ConfigurationException, DaoException {
  Env env=EnvBuilder.envFromArgs(args);
  PageViewDao viewDao=env.getConfigurator().get(PageViewDao.class);
  SpatialDataDao spatialDao=env.getConfigurator().get(SpatialDataDao.class);
  UniversalPageDao conceptDao=env.getConfigurator().get(UniversalPageDao.class);
  LocalPageDao pageDao=env.getConfigurator().get(LocalPageDao.class);
  Language lang=env.getDefaultLanguage();
  DateTime start=new DateTime(2014,8,14,21,0,0);
  DateTime end=new DateTime(2014,8,14,23,0,0);
  viewDao.ensureLoaded(start,end,env.getLanguages());
  Map<Integer,Geometry> countries=spatialDao.getAllGeometriesInLayer("String_Node_Str");
  System.out.println("String_Node_Str" + countries.size() + "String_Node_Str");
  Map<LocalPage,Integer> countryViews=new HashMap<LocalPage,Integer>();
  for (  int conceptId : countries.keySet()) {
    int pageId=conceptDao.getById(conceptId).getLocalId(lang);
    if (pageId > 0) {
      LocalPage page=pageDao.getById(lang,pageId);
      int views=viewDao.getNumViews(page.toLocalId(),start,end);
      countryViews.put(page,views);
    }
  }
  for (  LocalPage page : WpCollectionUtils.sortMapKeys(countryViews,true)) {
    System.out.format("String_Node_Str",page.getTitle(),countryViews.get(page));
  }
}
Program: 52878
Project: 52878
Buggy source:
/** 
 * Returns the total number of views for the requested page.
 * @param lang
 * @param ids
 * @param dates
 * @return
 * @throws ConfigurationException
 * @throws DaoException
 * @throws WikiBrainException
 */
public Map<Integer,Integer> getNumViews(Language lang,Iterable<Integer> ids,ArrayList<DateTime[]> dates) throws ConfigurationException, DaoException, WikiBrainException ;

Fixed version (ground truth):
/** 
 * Returns the total number of views for the requested page.
 * @param lang
 * @param ids
 * @param dates
 * @return
 * @throws ConfigurationException
 * @throws DaoException
 * @throws WikiBrainException
 */
public Map<Integer,Integer> getNumViews(Language lang,Iterable<Integer> ids,ArrayList<DateTime[]> dates) throws ConfigurationException, DaoException ;
Program: 52879
Project: 52879
Buggy source:
@Override public Map<Integer,Integer> getNumViews(Language lang,Iterable<Integer> ids,ArrayList<DateTime[]> dates) throws ConfigurationException, DaoException, WikiBrainException {
  Map<Integer,Integer> result=new HashMap<Integer,Integer>();
  DateTime startTime;
  DateTime endTime;
  int count=0;
  for (  DateTime[] date : dates) {
    startTime=date[0];
    endTime=date[1];
    count++;
    for (    Integer id : ids) {
      if (!result.keySet().contains(id)) {
        result.put(id,getNumViews(new LocalId(lang,id),startTime,endTime));
      }
 else {
        int totalViews=result.get(id) + getNumViews(new LocalId(lang,id),startTime,endTime);
        result.put(id,totalViews);
      }
    }
    LOG.info(count + "String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
@Override public Map<Integer,Integer> getNumViews(Language lang,Iterable<Integer> ids,ArrayList<DateTime[]> dates) throws ConfigurationException, DaoException {
  Map<Integer,Integer> result=new HashMap<Integer,Integer>();
  DateTime startTime;
  DateTime endTime;
  int count=0;
  for (  DateTime[] date : dates) {
    startTime=date[0];
    endTime=date[1];
    count++;
    for (    Integer id : ids) {
      if (!result.keySet().contains(id)) {
        result.put(id,getNumViews(new LocalId(lang,id),startTime,endTime));
      }
 else {
        int totalViews=result.get(id) + getNumViews(new LocalId(lang,id),startTime,endTime);
        result.put(id,totalViews);
      }
    }
    LOG.info(count + "String_Node_Str");
  }
  return result;
}
Program: 52880
Project: 52880
Buggy source:
public void downloadMapping(URL mappingUrl,WikiBrainShapeFile shapeFile) throws IOException, InterruptedException {
  File dest=shapeFile.getMappingFile();
  File tmp=File.createTempFile("String_Node_Str","String_Node_Str");
  FileUtils.deleteQuietly(tmp);
  if (!tmp.isFile()) {
    FileDownloader downloader=new FileDownloader();
    downloader.download(mappingUrl,tmp);
  }
  FileUtils.forceDeleteOnExit(tmp);
  File tmpDir;
  try {
    ZipFile zipFile=new ZipFile(tmp.getCanonicalPath());
    tmpDir=File.createTempFile("String_Node_Str","String_Node_Str");
    FileUtils.deleteQuietly(tmpDir);
    FileUtils.forceMkdir(tmpDir);
    LOG.log(Level.INFO,"String_Node_Str" + mappingUrl + "String_Node_Str"+ tmpDir);
    zipFile.extractAll(tmpDir.getAbsolutePath());
    FileUtils.forceDeleteOnExit(tmpDir);
  }
 catch (  ZipException e) {
    throw new IOException(e);
  }
  File src=FileUtils.getFile(tmpDir,dest.getName());
  if (!src.isFile()) {
    throw new IOException("String_Node_Str" + dest.getName() + "String_Node_Str"+ mappingUrl);
  }
  FileUtils.forceDelete(dest);
  FileUtils.moveFile(src,dest);
}

Fixed version (ground truth):
public void downloadMapping(URL mappingUrl,WikiBrainShapeFile shapeFile) throws IOException, InterruptedException {
  File dest=shapeFile.getMappingFile();
  File tmp=File.createTempFile("String_Node_Str","String_Node_Str");
  FileUtils.deleteQuietly(tmp);
  if (!tmp.isFile()) {
    FileDownloader downloader=new FileDownloader();
    downloader.download(mappingUrl,tmp);
  }
  FileUtils.forceDeleteOnExit(tmp);
  File tmpDir;
  try {
    ZipFile zipFile=new ZipFile(tmp.getCanonicalPath());
    tmpDir=File.createTempFile("String_Node_Str","String_Node_Str");
    FileUtils.deleteQuietly(tmpDir);
    FileUtils.forceMkdir(tmpDir);
    LOG.log(Level.INFO,"String_Node_Str" + mappingUrl + "String_Node_Str"+ tmpDir);
    zipFile.extractAll(tmpDir.getAbsolutePath());
    FileUtils.forceDeleteOnExit(tmpDir);
  }
 catch (  ZipException e) {
    throw new IOException(e);
  }
  File src=FileUtils.getFile(tmpDir,dest.getName());
  if (!src.isFile()) {
    throw new IOException("String_Node_Str" + dest.getName() + "String_Node_Str"+ mappingUrl);
  }
  FileUtils.deleteQuietly(dest);
  FileUtils.moveFile(src,dest);
}
Program: 52881
Project: 52881
Buggy source:
public synchronized int incrementNumRecords(int n){
  lastUpdated=new Date();
  numRecords+=n;
  return n;
}

Fixed version (ground truth):
public synchronized int incrementNumRecords(int n){
  lastUpdated=new Date();
  numRecords+=n;
  return numRecords;
}
Program: 52882
Project: 52882
Buggy source:
private void initialize(Map<String,Object> manualParameters) throws DaoException {
  try {
    store=(JDBCDataStore)DataStoreFinder.getDataStore(manualParameters);
    if (needsToBeInitialized()) {
      LOG.log(Level.INFO,"String_Node_Str");
      try {
        SimpleFeatureTypeBuilder builder=new SimpleFeatureTypeBuilder();
        builder.setName(SPATIAL_DB_NAME);
        builder.add(ITEM_ID_FIELD_NAME,Integer.class);
        builder.add(LAYER_FIELD_NAME,String.class);
        builder.add(REF_SYS_FIELD_NAME,String.class);
        builder.add(GEOM_FIELD_NAME,Geometry.class);
        SimpleFeatureType featureType=builder.buildFeatureType();
        store.createSchema(featureType);
        Index regIndex=new Index(SPATIAL_DB_NAME,"String_Node_Str",true,ITEM_ID_FIELD_NAME,LAYER_FIELD_NAME,REF_SYS_FIELD_NAME);
      }
 catch (      Exception e) {
        throw new DaoException(e);
      }
    }
 else {
      LOG.log(Level.INFO,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    throw new DaoException(e);
  }
}

Fixed version (ground truth):
private void initialize(Map<String,Object> manualParameters) throws DaoException {
  try {
    store=(JDBCDataStore)DataStoreFinder.getDataStore(manualParameters);
    if (needsToBeInitialized()) {
      LOG.log(Level.INFO,"String_Node_Str");
      try {
        SimpleFeatureTypeBuilder builder=new SimpleFeatureTypeBuilder();
        builder.setName(SPATIAL_DB_NAME);
        builder.add(ITEM_ID_FIELD_NAME,Integer.class);
        builder.add(LAYER_FIELD_NAME,String.class);
        builder.add(REF_SYS_FIELD_NAME,String.class);
        builder.add(GEOM_FIELD_NAME,Geometry.class);
        SimpleFeatureType featureType=builder.buildFeatureType();
        store.createSchema(featureType);
        Index regIndex=new Index(SPATIAL_DB_NAME,"String_Node_Str",true,ITEM_ID_FIELD_NAME,LAYER_FIELD_NAME,REF_SYS_FIELD_NAME);
        Index itemIdIndex=new Index(SPATIAL_DB_NAME,"String_Node_Str",false,ITEM_ID_FIELD_NAME);
        store.createIndex(itemIdIndex);
      }
 catch (      Exception e) {
        throw new DaoException(e);
      }
    }
 else {
      LOG.log(Level.INFO,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    throw new DaoException(e);
  }
}
Program: 52883
Project: 52883
Buggy source:
@Override public MetaInfo getInfo(Class component,Language lang) throws DaoException {
  Map<Language,MetaInfo> langInfos=counters.get(component);
  if (langInfos == null) {
synchronized (counters) {
      if (!counters.containsKey(component)) {
        langInfos=new ConcurrentHashMap<Language,MetaInfo>();
        counters.put(component,langInfos);
      }
 else {
        langInfos=counters.get(component);
      }
    }
  }
  Object langKey=(lang == null ? NULL_KEY : lang);
  MetaInfo info=langInfos.get(langKey);
  if (info == null) {
synchronized (langInfos) {
      if (langInfos.containsKey(langKey)) {
        info=langInfos.get(langKey);
      }
 else {
        DSLContext context=getJooq();
        try {
          if (!tableExists(context)) {
            return new MetaInfo(component,lang);
          }
          Condition langCondition=(lang == null) ? Tables.META_INFO.LANG_ID.isNull() : Tables.META_INFO.LANG_ID.eq(lang.getId());
          Record3<Integer,Integer,Timestamp> record=context.select(Tables.META_INFO.NUM_RECORDS,Tables.META_INFO.NUM_ERRORS,Tables.META_INFO.LAST_UPDATED).from(Tables.META_INFO).where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())).and(langCondition).fetchOne();
          if (record == null) {
            info=new MetaInfo(component,lang);
          }
 else {
            info=new MetaInfo(component,lang,record.value1(),record.value2(),record.value3());
          }
        }
  finally {
          freeJooq(context);
        }
        ((Map)langInfos).put(langKey,info);
      }
    }
  }
  return info;
}

Fixed version (ground truth):
@Override public MetaInfo getInfo(Class component,Language lang) throws DaoException {
  counters.putIfAbsent(component,new ConcurrentHashMap<Language,MetaInfo>());
  Map<Language,MetaInfo> langInfos=counters.get(component);
  if (langInfos == null) {
    throw new IllegalStateException();
  }
  Object langKey=(lang == null ? NULL_KEY : lang);
  MetaInfo info=langInfos.get(langKey);
  if (info == null) {
synchronized (langInfos) {
      if (langInfos.containsKey(langKey)) {
        info=langInfos.get(langKey);
      }
 else {
        DSLContext context=getJooq();
        try {
          if (!tableExists(context)) {
            info=new MetaInfo(component,lang);
          }
 else {
            Condition langCondition=(lang == null) ? Tables.META_INFO.LANG_ID.isNull() : Tables.META_INFO.LANG_ID.eq(lang.getId());
            Record3<Integer,Integer,Timestamp> record=context.select(Tables.META_INFO.NUM_RECORDS,Tables.META_INFO.NUM_ERRORS,Tables.META_INFO.LAST_UPDATED).from(Tables.META_INFO).where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())).and(langCondition).fetchOne();
            if (record == null) {
              info=new MetaInfo(component,lang);
            }
 else {
              info=new MetaInfo(component,lang,record.value1(),record.value2(),record.value3());
            }
          }
        }
  finally {
          freeJooq(context);
        }
        ((Map)langInfos).put(langKey,info);
      }
    }
  }
  return info;
}
Program: 52884
Project: 52884
Buggy source:
@Override public LanguageSet getLoadedLanguages(Class component) throws DaoException {
  sync(component);
  DSLContext context=getJooq();
  try {
    Set<Language> langs=new HashSet<Language>();
    Result<Record1<Short>> records=context.select(Tables.META_INFO.LANG_ID).from(Tables.META_INFO).where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())).and(Tables.META_INFO.LANG_ID.isNotNull()).fetch();
    for (    Record1<Short> record : records) {
      langs.add(Language.getById(record.value1()));
    }
    return new LanguageSet(langs);
  }
 catch (  Exception e) {
    throw new DaoException("String_Node_Str" + e.toString());
  }
 finally {
    freeJooq(context);
  }
}

Fixed version (ground truth):
@Override public LanguageSet getLoadedLanguages(Class component) throws DaoException {
  sync(component);
  DSLContext context=getJooq();
  try {
    if (!tableExists(context)) {
      return new LanguageSet();
    }
    Set<Language> langs=new HashSet<Language>();
    Result<Record1<Short>> records=context.select(Tables.META_INFO.LANG_ID).from(Tables.META_INFO).where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())).and(Tables.META_INFO.LANG_ID.isNotNull()).fetch();
    for (    Record1<Short> record : records) {
      langs.add(Language.getById(record.value1()));
    }
    return new LanguageSet(langs);
  }
 catch (  Exception e) {
    throw new DaoException("String_Node_Str" + e.toString());
  }
 finally {
    freeJooq(context);
  }
}
Program: 52885
Project: 52885
Buggy source:
@Override public MetaInfo getInfo(Class component,Language lang) throws DaoException {
  Map<Language,MetaInfo> langInfos=counters.get(component);
  if (langInfos == null) {
synchronized (counters) {
      if (!counters.containsKey(component)) {
        langInfos=new ConcurrentHashMap<Language,MetaInfo>();
        counters.put(component,langInfos);
      }
 else {
        langInfos=counters.get(component);
      }
    }
  }
  Object langKey=(lang == null ? NULL_KEY : lang);
  MetaInfo info=langInfos.get(langKey);
  if (info == null) {
synchronized (langInfos) {
      if (langInfos.containsKey(langKey)) {
        info=langInfos.get(langKey);
      }
 else {
        DSLContext context=getJooq();
        try {
          Condition langCondition=(lang == null) ? Tables.META_INFO.LANG_ID.isNull() : Tables.META_INFO.LANG_ID.eq(lang.getId());
          Record3<Integer,Integer,Timestamp> record=context.select(Tables.META_INFO.NUM_RECORDS,Tables.META_INFO.NUM_ERRORS,Tables.META_INFO.LAST_UPDATED).from(Tables.META_INFO).where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())).and(langCondition).fetchOne();
          if (record == null) {
            info=new MetaInfo(component,lang);
          }
 else {
            info=new MetaInfo(component,lang,record.value1(),record.value2(),record.value3());
          }
        }
  finally {
          freeJooq(context);
        }
        ((Map)langInfos).put(langKey,info);
      }
    }
  }
  return info;
}

Fixed version (ground truth):
@Override public MetaInfo getInfo(Class component,Language lang) throws DaoException {
  Map<Language,MetaInfo> langInfos=counters.get(component);
  if (langInfos == null) {
synchronized (counters) {
      if (!counters.containsKey(component)) {
        langInfos=new ConcurrentHashMap<Language,MetaInfo>();
        counters.put(component,langInfos);
      }
 else {
        langInfos=counters.get(component);
      }
    }
  }
  Object langKey=(lang == null ? NULL_KEY : lang);
  MetaInfo info=langInfos.get(langKey);
  if (info == null) {
synchronized (langInfos) {
      if (langInfos.containsKey(langKey)) {
        info=langInfos.get(langKey);
      }
 else {
        DSLContext context=getJooq();
        try {
          if (!tableExists(context)) {
            return new MetaInfo(component,lang);
          }
          Condition langCondition=(lang == null) ? Tables.META_INFO.LANG_ID.isNull() : Tables.META_INFO.LANG_ID.eq(lang.getId());
          Record3<Integer,Integer,Timestamp> record=context.select(Tables.META_INFO.NUM_RECORDS,Tables.META_INFO.NUM_ERRORS,Tables.META_INFO.LAST_UPDATED).from(Tables.META_INFO).where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())).and(langCondition).fetchOne();
          if (record == null) {
            info=new MetaInfo(component,lang);
          }
 else {
            info=new MetaInfo(component,lang,record.value1(),record.value2(),record.value3());
          }
        }
  finally {
          freeJooq(context);
        }
        ((Map)langInfos).put(langKey,info);
      }
    }
  }
  return info;
}
Program: 52886
Project: 52886
Buggy source:
public boolean tableExists() throws DaoException {
  DSLContext context=getJooq();
  try {
    return (context.meta().getTables().contains(Tables.META_INFO));
  }
  finally {
    freeJooq(context);
  }
}

Fixed version (ground truth):
public boolean tableExists(DSLContext context){
  return JooqUtils.tableExists(context,Tables.META_INFO);
}
Program: 52887
Project: 52887
Buggy source:
@Override public Map<String,List<MetaInfo>> getAllInfo() throws DaoException {
  DSLContext context=getJooq();
  try {
    Result<Record> result=context.select().from(Tables.META_INFO).fetch();
    Map<String,List<MetaInfo>> components=new HashMap<String,List<MetaInfo>>();
    for (    Record record : result) {
      String klass=record.getValue(Tables.META_INFO.COMPONENT);
      if (!components.containsKey(klass)) {
        components.put(klass,new ArrayList<MetaInfo>());
      }
      Short langId=record.getValue(Tables.META_INFO.LANG_ID);
      components.get(klass).add(new MetaInfo(null,(langId == null) ? null : Language.getById(langId),record.getValue(Tables.META_INFO.ID),record.getValue(Tables.META_INFO.NUM_RECORDS),record.getValue(Tables.META_INFO.NUM_ERRORS),record.getValue(Tables.META_INFO.LAST_UPDATED)));
    }
    return components;
  }
  finally {
    freeJooq(context);
  }
}

Fixed version (ground truth):
@Override public Map<String,List<MetaInfo>> getAllInfo() throws DaoException {
  DSLContext context=getJooq();
  try {
    Map<String,List<MetaInfo>> components=new HashMap<String,List<MetaInfo>>();
    if (!tableExists(context)) {
      return components;
    }
    Result<Record> result=context.select().from(Tables.META_INFO).fetch();
    for (    Record record : result) {
      String klass=record.getValue(Tables.META_INFO.COMPONENT);
      if (!components.containsKey(klass)) {
        components.put(klass,new ArrayList<MetaInfo>());
      }
      Short langId=record.getValue(Tables.META_INFO.LANG_ID);
      components.get(klass).add(new MetaInfo(null,(langId == null) ? null : Language.getById(langId),record.getValue(Tables.META_INFO.ID),record.getValue(Tables.META_INFO.NUM_RECORDS),record.getValue(Tables.META_INFO.NUM_ERRORS),record.getValue(Tables.META_INFO.LAST_UPDATED)));
    }
    return components;
  }
  finally {
    freeJooq(context);
  }
}