nus-yam/ex-repair huggingface dataset:
Program: 151137
Project: 151137
Buggy source:
@Override protected double computeWeightedOrientation(int c_x,int c_y){
  double windowRadius=windowSize / 2.0;
  int w=rect.x1 - rect.x0;
  double bestScore=-1;
  double bestAngle=0;
  double stepAngle=Math.PI * 2.0 / numAngles;
  int N=w * (rect.y1 - rect.y0);
  for (double angle=-Math.PI; angle < Math.PI; angle+=stepAngle) {
    double dx=0;
    double dy=0;
    for (int i=0; i < N; i++) {
      double diff=UtilAngle.dist(angle,angles[i]);
      if (diff <= windowRadius) {
        int localX=i % w;
        int localY=i / w;
        double ww=weights.get(localX,localY);
        int x=rect.x0 + i % w;
        int y=rect.y0 + i / w;
        dx+=ww * derivX.get(x,y);
        dy+=ww * derivY.get(x,y);
      }
    }
    double n=dx * dx + dy * dy;
    if (n > bestScore) {
      bestAngle=Math.atan2(dy,dx);
      bestScore=n;
    }
  }
  return bestAngle;
}

Fixed version (ground truth):
@Override protected double computeWeightedOrientation(int c_x,int c_y){
  computeAngles();
  double windowRadius=windowSize / 2.0;
  int w=rect.x1 - rect.x0;
  double bestScore=-1;
  double bestAngle=0;
  double stepAngle=Math.PI * 2.0 / numAngles;
  int N=w * (rect.y1 - rect.y0);
  for (double angle=-Math.PI; angle < Math.PI; angle+=stepAngle) {
    double dx=0;
    double dy=0;
    for (int i=0; i < N; i++) {
      double diff=UtilAngle.dist(angle,angles[i]);
      if (diff <= windowRadius) {
        int localX=i % w;
        int localY=i / w;
        double ww=weights.get(localX,localY);
        int x=rect.x0 + i % w;
        int y=rect.y0 + i / w;
        dx+=ww * derivX.get(x,y);
        dy+=ww * derivY.get(x,y);
      }
    }
    double n=dx * dx + dy * dy;
    if (n > bestScore) {
      bestAngle=Math.atan2(dy,dx);
      bestScore=n;
    }
  }
  return bestAngle;
}
Program: 151138
Project: 151138
Buggy source:
@Override protected double computeWeightedOrientation(int c_x,int c_y){
  double windowRadius=windowSize / 2.0;
  int w=rect.x1 - rect.x0;
  double bestScore=-1;
  double bestAngle=0;
  double stepAngle=Math.PI * 2.0 / numAngles;
  int N=w * (rect.y1 - rect.y0);
  for (double angle=-Math.PI; angle < Math.PI; angle+=stepAngle) {
    double dx=0;
    double dy=0;
    for (int i=0; i < N; i++) {
      double diff=UtilAngle.dist(angle,angles[i]);
      if (diff <= windowRadius) {
        int localX=i % w;
        int localY=i / w;
        double ww=weights.get(localX,localY);
        int x=rect.x0 + i % w;
        int y=rect.y0 + i / w;
        dx+=ww * derivX.get(x,y);
        dy+=ww * derivY.get(x,y);
      }
    }
    double n=dx * dx + dy * dy;
    if (n > bestScore) {
      bestAngle=Math.atan2(dy,dx);
      bestScore=n;
    }
  }
  return bestAngle;
}

Fixed version (ground truth):
@Override protected double computeWeightedOrientation(int c_x,int c_y){
  computeAngles();
  double windowRadius=windowSize / 2.0;
  int w=rect.x1 - rect.x0;
  double bestScore=-1;
  double bestAngle=0;
  double stepAngle=Math.PI * 2.0 / numAngles;
  int N=w * (rect.y1 - rect.y0);
  for (double angle=-Math.PI; angle < Math.PI; angle+=stepAngle) {
    double dx=0;
    double dy=0;
    for (int i=0; i < N; i++) {
      double diff=UtilAngle.dist(angle,angles[i]);
      if (diff <= windowRadius) {
        int localX=i % w;
        int localY=i / w;
        double ww=weights.get(localX,localY);
        int x=rect.x0 + i % w;
        int y=rect.y0 + i / w;
        dx+=ww * derivX.get(x,y);
        dy+=ww * derivY.get(x,y);
      }
    }
    double n=dx * dx + dy * dy;
    if (n > bestScore) {
      bestAngle=Math.atan2(dy,dx);
      bestScore=n;
    }
  }
  return bestAngle;
}
Program: 151139
Project: 151139
Buggy source:
@Override public void init(){
  showStatus("String_Node_Str");
  String directory=getParameter("String_Node_Str");
  final BufferedImage image=loadImage(directory + "String_Node_Str");
  final String panelPath=getParameter("String_Node_Str");
  Class inputType=ImageFloat32.class;
  showStatus("String_Node_Str");
  final JComponent comp=FactoryVisualPanel.create(panelPath,inputType);
  if (comp == null) {
    showStatus("String_Node_Str");
  }
 else   if (!(comp instanceof ProcessImage)) {
    showStatus("String_Node_Str");
    return;
  }
  SelectInputImageToolBar toolbar=new SelectInputImageToolBar(comp);
  toolbar.addImage("String_Node_Str",directory + "String_Node_Str");
  toolbar.addImage("String_Node_Str",directory + "String_Node_Str");
  toolbar.addImage("String_Node_Str",directory + "String_Node_Str");
  UtilVisualize.manageSelectInput(toolbar,(ProcessImage)comp,getCodeBase(),true);
  getContentPane().add(toolbar,BorderLayout.CENTER);
}

Fixed version (ground truth):
@Override public void init(){
  showStatus("String_Node_Str");
  String directory=getParameter("String_Node_Str");
  final String panelPath=getParameter("String_Node_Str");
  Class inputType=ImageFloat32.class;
  showStatus("String_Node_Str");
  final JComponent comp=FactoryVisualPanel.create(panelPath,inputType);
  if (comp == null) {
    showStatus("String_Node_Str");
  }
 else   if (!(comp instanceof ProcessImage)) {
    showStatus("String_Node_Str");
    return;
  }
  showStatus("String_Node_Str");
  ProcessImage p=(ProcessImage)comp;
  AppletImageListManager manager=new AppletImageListManager(getCodeBase());
  manager.add("String_Node_Str",directory + "String_Node_Str");
  manager.add("String_Node_Str",directory + "String_Node_Str");
  manager.add("String_Node_Str",directory + "String_Node_Str");
  p.setImageManager(manager);
  while (!p.getHasProcessedImage()) {
    Thread.yield();
  }
  showStatus("String_Node_Str");
  getContentPane().add(comp,BorderLayout.CENTER);
}
Program: 151140
Project: 151140
Buggy source:
@Override public void process(BufferedImage input){
  this.input=input;
  final int width=input.getWidth();
  final int height=input.getHeight();
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      setPreferredSize(new Dimension(width,height));
      refreshAlgorithm();
    }
  }
);
}

Fixed version (ground truth):
@Override public void process(BufferedImage input){
  this.input=input;
  final int width=input.getWidth();
  final int height=input.getHeight();
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      setPreferredSize(new Dimension(width,height));
      processedImage=true;
      refreshAlgorithm();
    }
  }
);
}
Program: 151141
Project: 151141
Buggy source:
public void run(){
  setPreferredSize(new Dimension(width,height));
  refreshAlgorithm();
}

Fixed version (ground truth):
public void run(){
  setPreferredSize(new Dimension(width,height));
  processedImage=true;
  refreshAlgorithm();
}
Program: 151142
Project: 151142
Buggy source:
public static void main(String args[]){
  BufferedImage input=UtilImageIO.loadImage(fileName);
  ShowEdgeContourApp<ImageFloat32,ImageFloat32> app=new ShowEdgeContourApp<ImageFloat32,ImageFloat32>(ImageFloat32.class,ImageFloat32.class);
  app.process(input);
  ShowImages.showWindow(app,"String_Node_Str");
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String args[]){
  ShowEdgeContourApp<ImageFloat32,ImageFloat32> app=new ShowEdgeContourApp<ImageFloat32,ImageFloat32>(ImageFloat32.class,ImageFloat32.class);
  ImageListManager manager=new ImageListManager();
  manager.add("String_Node_Str","String_Node_Str");
  manager.add("String_Node_Str","String_Node_Str");
  manager.add("String_Node_Str","String_Node_Str");
  app.setImageManager(manager);
  while (!app.getHasProcessedImage()) {
    Thread.yield();
  }
  ShowImages.showWindow(app,"String_Node_Str");
  System.out.println("String_Node_Str");
}
Program: 151143
Project: 151143
Buggy source:
public ShowEdgeContourApp(Class<T> imageType,Class<D> derivType){
  this.imageType=imageType;
  this.derivType=derivType;
  addAlgorithm("String_Node_Str",null);
  addAlgorithm("String_Node_Str",FactoryDetectEdgeContour.canny(1,40,imageType,derivType));
  addAlgorithm("String_Node_Str",FactoryDetectEdgeContour.<T>binarySimple());
  add(panel,BorderLayout.CENTER);
}

Fixed version (ground truth):
public ShowEdgeContourApp(Class<T> imageType,Class<D> derivType){
  this.imageType=imageType;
  this.derivType=derivType;
  addAlgorithm("String_Node_Str",null);
  addAlgorithm("String_Node_Str",FactoryDetectEdgeContour.canny(1,40,imageType,derivType));
  addAlgorithm("String_Node_Str",FactoryDetectEdgeContour.<T>binarySimple());
  addMainGUI(panel);
}
Program: 151144
Project: 151144
Buggy source:
@Override public synchronized void process(final BufferedImage input){
  this.input=input;
  workImage=ConvertBufferedImage.convertFrom(input,null,imageType);
  ss.setImage(workImage);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      setPreferredSize(new Dimension(input.getWidth(),input.getHeight()));
    }
  }
);
  refreshAlgorithm();
}

Fixed version (ground truth):
@Override public void process(final BufferedImage input){
  setInputImage(input);
  this.input=input;
  workImage=ConvertBufferedImage.convertFrom(input,null,imageType);
  ss.setImage(workImage);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      setPreferredSize(new Dimension(input.getWidth() + 50,input.getHeight()));
      processedImage=true;
    }
  }
);
  refreshAlgorithm();
}
Program: 151145
Project: 151145
Buggy source:
public IntensityFeatureScaleSpaceApp(Class<T> imageType,Class<D> derivType){
  this.imageType=imageType;
  addAlgorithm("String_Node_Str",new WrapperLaplacianBlobIntensity<T,D>(HessianBlobIntensity.Type.DETERMINANT,derivType));
  addAlgorithm("String_Node_Str",new WrapperLaplacianBlobIntensity<T,D>(HessianBlobIntensity.Type.TRACE,derivType));
  addAlgorithm("String_Node_Str",new WrapperGradientCornerIntensity<T,D>(FactoryPointIntensityAlg.createHarris(derivType,2,0.4f)));
  addAlgorithm("String_Node_Str",new WrapperGradientCornerIntensity<T,D>(FactoryPointIntensityAlg.createKlt(derivType,2)));
  addAlgorithm("String_Node_Str",new WrapperFastCornerIntensity<T,D>(FactoryPointIntensityAlg.createFast12(imageType,5,11)));
  addAlgorithm("String_Node_Str",new WrapperKitRosCornerIntensity<T,D>(derivType));
  addAlgorithm("String_Node_Str",new WrapperMedianCornerIntensity<T,D>(FactoryBlurFilter.median(imageType,2),imageType));
  add(gui,BorderLayout.CENTER);
  ss=FactoryGaussianScaleSpace.nocache(imageType);
  double scales[]=new double[25];
  for (int i=0; i < scales.length; i++) {
    scales[i]=Math.exp(i * 0.15);
  }
  ss.setScales(scales);
}

Fixed version (ground truth):
public IntensityFeatureScaleSpaceApp(Class<T> imageType,Class<D> derivType){
  this.imageType=imageType;
  addAlgorithm("String_Node_Str",new WrapperLaplacianBlobIntensity<T,D>(HessianBlobIntensity.Type.DETERMINANT,derivType));
  addAlgorithm("String_Node_Str",new WrapperLaplacianBlobIntensity<T,D>(HessianBlobIntensity.Type.TRACE,derivType));
  addAlgorithm("String_Node_Str",new WrapperGradientCornerIntensity<T,D>(FactoryPointIntensityAlg.createHarris(derivType,2,0.4f)));
  addAlgorithm("String_Node_Str",new WrapperGradientCornerIntensity<T,D>(FactoryPointIntensityAlg.createKlt(derivType,2)));
  addAlgorithm("String_Node_Str",new WrapperFastCornerIntensity<T,D>(FactoryPointIntensityAlg.createFast12(imageType,5,11)));
  addAlgorithm("String_Node_Str",new WrapperKitRosCornerIntensity<T,D>(derivType));
  addAlgorithm("String_Node_Str",new WrapperMedianCornerIntensity<T,D>(FactoryBlurFilter.median(imageType,2),imageType));
  addMainGUI(gui);
  ss=FactoryGaussianScaleSpace.nocache(imageType);
  double scales[]=new double[25];
  for (int i=0; i < scales.length; i++) {
    scales[i]=Math.exp(i * 0.15);
  }
  ss.setScales(scales);
}
Program: 151146
Project: 151146
Buggy source:
@Override public synchronized void setActiveAlgorithm(String name,Object cookie){
  if (input == null) {
    return;
  }
  GeneralFeatureIntensity<T,D> intensity=(GeneralFeatureIntensity<T,D>)cookie;
  gui.reset();
  gui.addImage(input,"String_Node_Str");
  BufferedImage b=VisualizeImageData.grayMagnitude(workImage,null,255);
  gui.addImage(b,"String_Node_Str");
  final ProgressMonitor progressMonitor=new ProgressMonitor(this,"String_Node_Str","String_Node_Str",0,ss.getTotalScales());
  for (int i=0; i < ss.getTotalScales() && !progressMonitor.isCanceled(); i++) {
    ss.setActiveScale(i);
    double scale=ss.getCurrentScale();
    T scaledImage=ss.getScaledImage();
    D derivX=ss.getDerivative(true);
    D derivY=ss.getDerivative(false);
    D derivXX=ss.getDerivative(true,true);
    D derivYY=ss.getDerivative(false,false);
    D derivXY=ss.getDerivative(true,false);
    intensity.process(scaledImage,derivX,derivY,derivXX,derivYY,derivXY);
    ImageFloat32 featureImg=intensity.getIntensity();
    b=VisualizeImageData.colorizeSign(featureImg,null,PixelMath.maxAbs(featureImg));
    gui.addImage(b,String.format("String_Node_Str",scale));
    final int progressStatus=i + 1;
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        progressMonitor.setProgress(progressStatus);
      }
    }
);
  }
  gui.requestFocusInWindow();
}

Fixed version (ground truth):
@Override public void setActiveAlgorithm(String name,Object cookie){
  if (input == null) {
    return;
  }
  GeneralFeatureIntensity<T,D> intensity=(GeneralFeatureIntensity<T,D>)cookie;
  gui.reset();
  BufferedImage b=VisualizeImageData.grayMagnitude(workImage,null,255);
  gui.addImage(b,"String_Node_Str");
  final ProgressMonitor progressMonitor=new ProgressMonitor(this,"String_Node_Str","String_Node_Str",0,ss.getTotalScales());
  for (int i=0; i < ss.getTotalScales() && !progressMonitor.isCanceled(); i++) {
    ss.setActiveScale(i);
    double scale=ss.getCurrentScale();
    T scaledImage=ss.getScaledImage();
    D derivX=ss.getDerivative(true);
    D derivY=ss.getDerivative(false);
    D derivXX=ss.getDerivative(true,true);
    D derivYY=ss.getDerivative(false,false);
    D derivXY=ss.getDerivative(true,false);
    intensity.process(scaledImage,derivX,derivY,derivXX,derivYY,derivXY);
    ImageFloat32 featureImg=intensity.getIntensity();
    b=VisualizeImageData.colorizeSign(featureImg,null,PixelMath.maxAbs(featureImg));
    gui.addImage(b,String.format("String_Node_Str",scale));
    final int progressStatus=i + 1;
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        progressMonitor.setProgress(progressStatus);
      }
    }
);
  }
  gui.requestFocusInWindow();
}
Program: 151147
Project: 151147
Buggy source:
public void run(){
  setPreferredSize(new Dimension(input.getWidth(),input.getHeight()));
}

Fixed version (ground truth):
public void run(){
  setPreferredSize(new Dimension(input.getWidth() + 50,input.getHeight()));
  processedImage=true;
}
Program: 151148
Project: 151148
Buggy source:
public static void main(String args[]){
  BufferedImage input=UtilImageIO.loadImage(fileName);
  IntensityFeatureScaleSpaceApp<ImageFloat32,ImageFloat32> app=new IntensityFeatureScaleSpaceApp<ImageFloat32,ImageFloat32>(ImageFloat32.class,ImageFloat32.class);
  app.process(input);
  ShowImages.showWindow(app,"String_Node_Str");
}

Fixed version (ground truth):
public static void main(String args[]){
  IntensityFeatureScaleSpaceApp<ImageFloat32,ImageFloat32> app=new IntensityFeatureScaleSpaceApp<ImageFloat32,ImageFloat32>(ImageFloat32.class,ImageFloat32.class);
  ImageListManager manager=new ImageListManager();
  manager.add("String_Node_Str","String_Node_Str");
  manager.add("String_Node_Str","String_Node_Str");
  manager.add("String_Node_Str","String_Node_Str");
  app.setImageManager(manager);
  while (!app.getHasProcessedImage()) {
    Thread.yield();
  }
  ShowImages.showWindow(app,"String_Node_Str");
}
Program: 151150
Project: 151150
Buggy source:
public static void main(String args[]){
  BufferedImage input=UtilImageIO.loadImage(fileName);
  doStuff(input,ImageFloat32.class,ImageFloat32.class);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String args[]){
  BufferedImage input=UtilImageIO.loadImage(fileName);
  doStuff(input,ImageUInt8.class,ImageSInt16.class);
  System.out.println("String_Node_Str");
}
Program: 151151
Project: 151151
Buggy source:
public static void main(String args[]){
  BufferedImage input=UtilImageIO.loadImage(fileName);
  doStuff(input,ImageFloat32.class,ImageFloat32.class);
  doStuff(input,ImageUInt8.class,ImageSInt16.class);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String args[]){
  BufferedImage input=UtilImageIO.loadImage(fileName);
  doStuff(input,ImageFloat32.class,ImageFloat32.class);
  input=UtilImageIO.loadImage(fileName);
  doStuff(input,ImageUInt8.class,ImageSInt16.class);
  System.out.println("String_Node_Str");
}
Program: 151152
Project: 151152
Buggy source:
public <T extends ImageBase,D extends ImageBase,K extends Kernel2D>DescribePointSteerable2D<T,D,K> steerableGaussian(int radius,int numAngles,boolean weighted,Class<T> imageType,Class<D> derivType){
  SteerableKernel<K>[] kernels=(SteerableKernel<K>[])new SteerableKernel[14];
  Class<K> kernelType=(Class)FactoryKernel.getKernelType(imageType,2);
  int index=0;
  for (int N=1; N <= 4; N++) {
    for (int i=0; i <= N; i++) {
      int orderX=N - i;
      kernels[index++]=FactorySteerable.gaussian(kernelType,orderX,i,radius);
    }
  }
  RegionOrientation<D> orientation=FactoryRegionOrientation.histogram(numAngles,radius,weighted,derivType);
  return new DescribePointSteerable2D<T,D,K>(orientation,kernels,imageType);
}

Fixed version (ground truth):
public <T extends ImageBase,D extends ImageBase,K extends Kernel2D>DescribePointSteerable2D<T,D,K> steerableGaussian(int radius,int numAngles,boolean weighted,Class<T> imageType,Class<D> derivType){
  SteerableKernel<K>[] kernels=(SteerableKernel<K>[])new SteerableKernel[14];
  Class<K> kernelType=(Class)FactoryKernel.getKernelType(imageType,2);
  int index=0;
  for (int N=1; N <= 4; N++) {
    for (int i=0; i <= N; i++) {
      int orderX=N - i;
      kernels[index++]=FactorySteerable.gaussian(kernelType,orderX,i,radius);
    }
  }
  RegionOrientation<D> orientation=FactoryRegionOrientationAlgs.histogram(numAngles,radius,weighted,derivType);
  return new DescribePointSteerable2D<T,D,K>(orientation,kernels,imageType);
}
Program: 151153
Project: 151153
Buggy source:
@Override public double compute(int c_x,int c_y){
  rect.x0=c_x - radius;
  rect.y0=c_y - radius;
  rect.x1=c_x + radius + 1;
  rect.y1=c_y + radius + 1;
  GecvMiscOps.boundRectangleInside(derivX,rect);
  for (int i=0; i < numAngles; i++) {
    sumDerivX[i]=0;
    sumDerivY[i]=0;
  }
  if (weights == null)   computeUnweightedScore();
 else   computeWeightedScore(c_x,c_y);
  double bestScore=-1;
  int bestIndex=-1;
  for (int i=0; i < numAngles; i++) {
    double x=sumDerivX[i];
    double y=sumDerivY[i];
    double score=x * x + y * y;
    if (score > bestScore) {
      bestScore=score;
      bestIndex=i;
    }
  }
  return angleDiv * bestIndex;
}

Fixed version (ground truth):
@Override public double compute(int c_x,int c_y){
  rect.x0=c_x - radius;
  rect.y0=c_y - radius;
  rect.x1=c_x + radius + 1;
  rect.y1=c_y + radius + 1;
  GecvMiscOps.boundRectangleInside(derivX,rect);
  for (int i=0; i < numAngles; i++) {
    sumDerivX[i]=0;
    sumDerivY[i]=0;
  }
  if (weights == null)   computeUnweightedScore();
 else   computeWeightedScore(c_x,c_y);
  double bestScore=-1;
  int bestIndex=-1;
  for (int i=0; i < numAngles; i++) {
    double x=sumDerivX[i];
    double y=sumDerivY[i];
    double score=x * x + y * y;
    if (score > bestScore) {
      bestScore=score;
      bestIndex=i;
    }
  }
  return angleDiv * bestIndex - Math.PI;
}
Program: 151154
Project: 151154
Buggy source:
@Override public void process(){
  BinaryImageOps.labelBlobs4(input,output,coexist);
}

Fixed version (ground truth):
@Override public void process(){
  BinaryImageOps.labelBlobs4(input,output,work);
}
Program: 151155
Project: 151155
Buggy source:
/** 
 * <p> Connects pixels together using an 8-connect rule.  Each cluster of connected pixels (a blob) is given a unique number >= 1. </p> <p> The coexist table is used internally to store intermediate results.  It is used supplied because pre-allocating the array was shown to improve performance about 5 times. </p>
 * @param input Binary input image.
 * @param output The labeled blob image. Modified.
 * @param coexist An N by N integer[][] array.  N should be several times larger than the expected numberof blobs.  Worst case it will need to be input.width*input.height/4.
 * @return How many blobs were found.
 */
public static int labelBlobs8(ImageUInt8 input,ImageSInt32 output,int coexist[][]){
  InputSanityCheck.checkSameShape(input,output);
  int numBlobs=ImplBinaryBlobLabeling.quickLabelBlobs8(input,output,coexist);
  ImplBinaryBlobLabeling.optimizeCoexistTable(coexist,numBlobs);
  int table[]=new int[numBlobs + 1];
  int newNumBlobs=ImplBinaryBlobLabeling.minimizeBlobID(coexist,numBlobs,table);
  ImplBinaryBlobLabeling.relabelBlobs(output,table);
  return newNumBlobs;
}

Fixed version (ground truth):
/** 
 * <p> Connects pixels together using an 8-connect rule.  Each cluster of connected pixels (a blob) is given a unique number >= 1. </p> <p> The coexist table is used internally to store intermediate results.  It is used supplied because pre-allocating the array was shown to improve performance about 5 times. </p>
 * @param input Binary input image.
 * @param output The labeled blob image. Modified.
 * @param work Used to store intermediate labeling results.  In general it is at most 3 or 4 times larger than theexpected max number of blobs.  Worst case it will be (width*height)/4
 * @return How many blobs were found.
 */
public static int labelBlobs8(ImageUInt8 input,ImageSInt32 output,int work[]){
  InputSanityCheck.checkSameShape(input,output);
  int numBlobs=ImplBinaryBlobLabeling.quickLabelBlobs8(input,output,work);
  ImplBinaryBlobLabeling.optimizeMaxConnect(work,numBlobs);
  int newNumBlobs=ImplBinaryBlobLabeling.minimizeBlobID(work,numBlobs);
  ImplBinaryBlobLabeling.relabelBlobs(output,work);
  return newNumBlobs;
}
Program: 151156
Project: 151156
Buggy source:
/** 
 * Only converts the specified blobs over into the binary image
 * @param labelImage Input image. Not modified.
 * @param binaryImage Output image. Modified.
 * @param selectedBlobs List of blobs that should be copied to the binary image.
 * @return The binary image.
 */
public static ImageUInt8 labelToBinary(ImageSInt32 labelImage,ImageUInt8 binaryImage,int selectedBlobs[]){
  binaryImage=InputSanityCheck.checkDeclare(labelImage,binaryImage,ImageUInt8.class);
  for (int y=0; y < labelImage.height; y++) {
    int indexIn=labelImage.startIndex + y * labelImage.stride;
    int indexOut=binaryImage.startIndex + y * binaryImage.stride;
    int end=indexIn + labelImage.width;
    for (; indexIn < end; indexIn++, indexOut++) {
      int val=labelImage.data[indexIn];
      if (0 == val) {
        binaryImage.data[indexOut]=0;
      }
 else {
        boolean found=false;
        for (int i=0; i < selectedBlobs.length; i++) {
          if (val == selectedBlobs[i]) {
            found=true;
            break;
          }
        }
        if (found) {
          binaryImage.data[indexOut]=1;
        }
 else {
          binaryImage.data[indexOut]=0;
        }
      }
    }
  }
  return binaryImage;
}

Fixed version (ground truth):
/** 
 * Only converts the specified blobs over into the binary image
 * @param labelImage Input image. Not modified.
 * @param binaryImage Output image. Modified.
 * @param selectedBlobs Each index corresponds to a blob and specifies if it is included or not.
 * @return The binary image.
 */
public static ImageUInt8 labelToBinary(ImageSInt32 labelImage,ImageUInt8 binaryImage,boolean selectedBlobs[]){
  binaryImage=InputSanityCheck.checkDeclare(labelImage,binaryImage,ImageUInt8.class);
  for (int y=0; y < labelImage.height; y++) {
    int indexIn=labelImage.startIndex + y * labelImage.stride;
    int indexOut=binaryImage.startIndex + y * binaryImage.stride;
    int end=indexIn + labelImage.width;
    for (; indexIn < end; indexIn++, indexOut++) {
      int val=labelImage.data[indexIn];
      if (0 == val) {
        binaryImage.data[indexOut]=0;
      }
 else {
        if (selectedBlobs[val]) {
          binaryImage.data[indexOut]=1;
        }
 else {
          binaryImage.data[indexOut]=0;
        }
      }
    }
  }
  return binaryImage;
}
Program: 151157
Project: 151157
Buggy source:
/** 
 * <p> Connects pixels together using an 4-connect rule.  Each cluster of connected pixels (a blob) is given a unique number >= 1. </p> <p> The coexist table is used internally to store intermediate results.  It is used supplied because pre-allocating the array was shown to improve performance about 5 times. </p>
 * @param input Binary input image.
 * @param output The labeled blob image. Modified.
 * @param coexist An N by N integer[][] array.  N should be several times larger than the expected numberof blobs.  Worst case it will need to be input.width*input.height/4.
 * @return How many blobs were found.
 */
public static int labelBlobs4(ImageUInt8 input,ImageSInt32 output,int coexist[][]){
  InputSanityCheck.checkSameShape(input,output);
  int numBlobs=ImplBinaryBlobLabeling.quickLabelBlobs4(input,output,coexist);
  ImplBinaryBlobLabeling.optimizeCoexistTable(coexist,numBlobs);
  int table[]=new int[numBlobs + 1];
  int newNumBlobs=ImplBinaryBlobLabeling.minimizeBlobID(coexist,numBlobs,table);
  ImplBinaryBlobLabeling.relabelBlobs(output,table);
  return newNumBlobs;
}

Fixed version (ground truth):
/** 
 * <p> Connects pixels together using an 4-connect rule.  Each cluster of connected pixels (a blob) is given a unique number >= 1. </p> <p> The coexist table is used internally to store intermediate results.  It is used supplied because pre-allocating the array was shown to improve performance about 5 times. </p>
 * @param input Binary input image.
 * @param output The labeled blob image. Modified.
 * @param work Used to store intermediate labeling results.  In general it is at most 3 or 4 times larger than theexpected max number of blobs.  Worst case it will be (width*height)/2
 * @return How many blobs were found.
 */
public static int labelBlobs4(ImageUInt8 input,ImageSInt32 output,int work[]){
  InputSanityCheck.checkSameShape(input,output);
  int numBlobs=ImplBinaryBlobLabeling.quickLabelBlobs4(input,output,work);
  ImplBinaryBlobLabeling.optimizeMaxConnect(work,numBlobs);
  int newNumBlobs=ImplBinaryBlobLabeling.minimizeBlobID(work,numBlobs);
  ImplBinaryBlobLabeling.relabelBlobs(output,work);
  return newNumBlobs;
}
Program: 151158
Project: 151158
Buggy source:
private void useThresholdMorph(ImageUInt8 input,double threshold){
  ImageSInt32 labeled=new ImageSInt32(input.width,input.height);
  ImageUInt8 thresholded=ThresholdImageOps.threshold(input,null,(int)threshold,true);
  ImageUInt8 mod=BinaryImageOps.erode8(thresholded,null);
  mod=BinaryImageOps.dilate8(mod,null);
  int numBlobs=BinaryImageOps.labelBlobs4(mod,labeled,null);
  binaryPanel.addImage(VisualizeBinaryData.renderBinary(mod,null),"String_Node_Str");
  labeledPanel.addItem(new ImageBinaryLabeledPanel(labeled,numBlobs + 1,2342),"String_Node_Str");
}

Fixed version (ground truth):
private void useThresholdMorph(ImageUInt8 input,double threshold){
  ImageSInt32 labeled=new ImageSInt32(input.width,input.height);
  ImageUInt8 thresholded=ThresholdImageOps.threshold(input,null,(int)threshold,true);
  ImageUInt8 mod=BinaryImageOps.erode8(thresholded,null);
  mod=BinaryImageOps.dilate8(mod,null);
  int numBlobs=BinaryImageOps.labelBlobs4(mod,labeled);
  binaryPanel.addImage(VisualizeBinaryData.renderBinary(mod,null),"String_Node_Str");
  labeledPanel.addItem(new ImageBinaryLabeledPanel(labeled,numBlobs + 1,2342),"String_Node_Str");
}
Program: 151159
Project: 151159
Buggy source:
public void process(ImageUInt8 original){
  colors=new int[original.width * original.height / 4];
  for (int i=1; i < colors.length; i++) {
    colors[i]=rand.nextInt(0xFFFFFF);
  }
  double average=PixelMath.sum(original) / (double)(original.width * original.height);
  average*=0.8;
  useThreshold(original,average);
  ShowImages.showWindow(binaryPanel,"String_Node_Str");
  ShowImages.showWindow(labeledPanel,"String_Node_Str");
}

Fixed version (ground truth):
public void process(ImageUInt8 original){
  colors=new int[original.width * original.height / 4];
  for (int i=1; i < colors.length; i++) {
    colors[i]=rand.nextInt(0xFFFFFF);
  }
  double average=PixelMath.sum(original) / (double)(original.width * original.height);
  average*=0.8;
  useThreshold(original,average);
  useHysteresis4(original,average);
  useHysteresis8(original,average);
  useThresholdMorph(original,average);
  ShowImages.showWindow(binaryPanel,"String_Node_Str");
  ShowImages.showWindow(labeledPanel,"String_Node_Str");
}
Program: 151160
Project: 151160
Buggy source:
private void useThreshold(ImageUInt8 input,double threshold){
  ImageSInt32 labeled=new ImageSInt32(input.width,input.height);
  ImageUInt8 thresholded=ThresholdImageOps.threshold(input,null,(int)threshold,true);
  int numBlobs=BinaryImageOps.labelBlobs4(thresholded,labeled,null);
  binaryPanel.addImage(VisualizeBinaryData.renderBinary(thresholded,null),"String_Node_Str");
  labeledPanel.addItem(new ImageBinaryLabeledPanel(labeled,numBlobs + 1,2342),"String_Node_Str");
}

Fixed version (ground truth):
private void useThreshold(ImageUInt8 input,double threshold){
  ImageSInt32 labeled=new ImageSInt32(input.width,input.height);
  ImageUInt8 thresholded=ThresholdImageOps.threshold(input,null,(int)threshold,true);
  int numBlobs=BinaryImageOps.labelBlobs4(thresholded,labeled);
  binaryPanel.addImage(VisualizeBinaryData.renderBinary(thresholded,null),"String_Node_Str");
  labeledPanel.addItem(new ImageBinaryLabeledPanel(labeled,numBlobs + 1,2342),"String_Node_Str");
}
Program: 151161
Project: 151161
Buggy source:
public static void main(String args[]){
  String imageNames[]=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : imageNames) {
    BufferedImage image=UtilImageIO.loadImage("String_Node_Str" + s);
    BenchmarkInterestStability_Noise<ImageFloat32,ImageFloat32> alg=new BenchmarkInterestStability_Noise<ImageFloat32,ImageFloat32>(ImageFloat32.class,ImageFloat32.class);
    System.out.println("String_Node_Str" + s);
    alg.process(image);
  }
}

Fixed version (ground truth):
public static void main(String args[]){
  String imageNames[]=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : imageNames) {
    BufferedImage image=UtilImageIO.loadImage("String_Node_Str" + s);
    BenchmarkInterestStability_Noise<ImageFloat32,ImageFloat32> alg=new BenchmarkInterestStability_Noise<ImageFloat32,ImageFloat32>(ImageFloat32.class,ImageFloat32.class);
    System.out.println("String_Node_Str" + s);
    alg.process(image);
  }
}
Program: 151163
Project: 151163
Buggy source:
@Override public void process(I input,D derivX,D derivY,D derivXX,D derivYY,D derivXY){
  intensity.reshape(input.width,input.height);
  if (medianImage == null) {
    medianImage=(I)input._createNew(input.width,input.height);
  }
  medianFilter.process(input,medianImage);
  try {
    m.invoke(null,input,medianImage);
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public void process(I input,D derivX,D derivY,D derivXX,D derivYY,D derivXY){
  intensity.reshape(input.width,input.height);
  if (medianImage == null) {
    medianImage=(I)input._createNew(input.width,input.height);
  }
  medianFilter.process(input,medianImage);
  try {
    m.invoke(null,intensity,input,medianImage);
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    throw new RuntimeException(e);
  }
}
Program: 151164
Project: 151164
Buggy source:
@Override public void process(){
  BinaryImageOps.labelBlobs4(input,output,work);
}

Fixed version (ground truth):
@Override public void process(){
  BinaryImageOps.labelBlobs4(input,output);
}
Program: 151165
Project: 151165
Buggy source:
public static FilePermissionsExConfiguration fromLoader(ConfigurationLoader<?> loader) throws IOException {
  ConfigurationNode node=loader.load();
  ConfigurationNode fallbackConfig;
  try {
    fallbackConfig=FilePermissionsExConfiguration.loadDefaultConfiguration();
  }
 catch (  IOException e) {
    throw new Error("String_Node_Str",e);
  }
  ConfigTransformations.versions().apply(node);
  node.mergeValuesFrom(fallbackConfig);
  ConfigurationNode defBackendNode=node.getNode("String_Node_Str");
  if (defBackendNode.isVirtual() || defBackendNode.getValue() == null) {
    try {
      Class.forName("String_Node_Str");
      defBackendNode.setValue("String_Node_Str");
    }
 catch (    ClassNotFoundException e) {
      defBackendNode.setValue("String_Node_Str");
    }
  }
  FilePermissionsExConfiguration config=new FilePermissionsExConfiguration(loader,node);
  config.load();
  return config;
}

Fixed version (ground truth):
public static FilePermissionsExConfiguration fromLoader(ConfigurationLoader<?> loader) throws IOException {
  ConfigurationNode node=loader.load();
  ConfigurationNode fallbackConfig;
  try {
    fallbackConfig=FilePermissionsExConfiguration.loadDefaultConfiguration();
  }
 catch (  IOException e) {
    throw new Error("String_Node_Str",e);
  }
  ConfigTransformations.versions().apply(node);
  node.mergeValuesFrom(fallbackConfig);
  ConfigurationNode defBackendNode=node.getNode("String_Node_Str");
  if (defBackendNode.isVirtual() || defBackendNode.getValue() == null) {
    defBackendNode.setValue("String_Node_Str");
  }
  FilePermissionsExConfiguration config=new FilePermissionsExConfiguration(loader,node);
  config.load();
  return config;
}
Program: 151166
Project: 151166
Buggy source:
public DataEntry withoutOption(String key){
  if (!options.containsKey(key)) {
    return this;
  }
  Map<String,String> newOptions=new HashMap<>(options);
  newOptions.remove(key);
  return new DataEntry(permissions,newOptions,parents,defaultValue);
}

Fixed version (ground truth):
public DataEntry withoutOption(String key){
  if (options == null || !options.containsKey(key)) {
    return this;
  }
  Map<String,String> newOptions=new HashMap<>(options);
  newOptions.remove(key);
  return new DataEntry(permissions,newOptions,parents,defaultValue);
}
Program: 151167
Project: 151167
Buggy source:
public DataEntry withOptions(Map<String,String> values){
  return new DataEntry(permissions,ImmutableMap.copyOf(values),parents,defaultValue);
}

Fixed version (ground truth):
public DataEntry withOptions(Map<String,String> values){
  return new DataEntry(permissions,values == null ? null : ImmutableMap.copyOf(values),parents,defaultValue);
}
Program: 151168
Project: 151168
Buggy source:
public DataEntry withoutPermission(String permission){
  if (!permissions.containsKey(permission)) {
    return this;
  }
  Map<String,Integer> newPermissions=new HashMap<>(permissions);
  newPermissions.remove(permission);
  return new DataEntry(newPermissions,options,parents,defaultValue);
}

Fixed version (ground truth):
public DataEntry withoutPermission(String permission){
  if (permissions == null || !permissions.containsKey(permission)) {
    return this;
  }
  Map<String,Integer> newPermissions=new HashMap<>(permissions);
  newPermissions.remove(permission);
  return new DataEntry(newPermissions,options,parents,defaultValue);
}
Program: 151169
Project: 151169
Buggy source:
public DataEntry withRemovedParent(String parent){
  final List<String> newParents=new ArrayList<>(parents);
  newParents.remove(parent);
  return new DataEntry(permissions,options,newParents,defaultValue);
}

Fixed version (ground truth):
public DataEntry withRemovedParent(String parent){
  if (this.parents == null || this.parents.isEmpty()) {
    return this;
  }
  final List<String> newParents=new ArrayList<>(parents);
  newParents.remove(parent);
  return new DataEntry(permissions,options,newParents,defaultValue);
}
Program: 151170
Project: 151170
Buggy source:
public DataEntry withAddedParent(String parent){
  return new DataEntry(permissions,options,ImmutableList.<String>builder().add(parent).addAll(parents).build(),defaultValue);
}

Fixed version (ground truth):
public DataEntry withAddedParent(String parent){
  ImmutableList.Builder<String> parents=ImmutableList.builder();
  parents.add(parent);
  if (this.parents != null) {
    parents.addAll(this.parents);
  }
  return new DataEntry(permissions,options,parents.build(),defaultValue);
}
Program: 151171
Project: 151171
Buggy source:
public DataEntry withParents(List<String> transform){
  return new DataEntry(permissions,options,ImmutableList.copyOf(transform),defaultValue);
}

Fixed version (ground truth):
public DataEntry withParents(List<String> transform){
  return new DataEntry(permissions,options,transform == null ? null : ImmutableList.copyOf(transform),defaultValue);
}
Program: 151172
Project: 151172
Buggy source:
public void cacheAll(){
  for (  Map.Entry<String,ImmutableOptionSubjectData> ident : dataStore.getAll(type)) {
    cache.asMap().putIfAbsent(ident.getKey(),ident.getValue());
  }
}

Fixed version (ground truth):
public void cacheAll(){
  for (  String ident : dataStore.getAllIdentifiers(type)) {
    try {
      cache.get(ident);
    }
 catch (    ExecutionException e) {
    }
  }
}
Program: 151173
Project: 151173
Buggy source:
/** 
 * Returns a git.io shortened version of the input
 * @param longUrl The input url
 * @return The shortened URL, or the input url if an error occurs
 */
public static String shortenURL(String longUrl){
  if (longUrl == null) {
    return longUrl;
  }
  try {
    URL url=new URL("String_Node_Str");
    HttpURLConnection connection=(HttpURLConnection)url.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("String_Node_Str");
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    String urlParameters="String_Node_Str" + longUrl;
    DataOutputStream wr=new DataOutputStream(connection.getOutputStream());
    wr.writeBytes(URLEncoder.encode(urlParameters,UTF8_ENCODING));
    wr.flush();
    wr.close();
    BufferedReader rd=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String line;
    StringBuilder sb=new StringBuilder();
    while ((line=rd.readLine()) != null) {
      sb.append(line);
    }
    return "String_Node_Str" + sb.toString();
  }
 catch (  Exception e) {
    return longUrl;
  }
}

Fixed version (ground truth):
/** 
 * Returns a git.io shortened version of the input
 * @param longUrl The input url
 * @return The shortened URL, or the input url if an error occurs
 */
public static String shortenURL(String longUrl){
  if (longUrl == null) {
    return longUrl;
  }
  try {
    URL url=new URL("String_Node_Str");
    HttpURLConnection connection=(HttpURLConnection)url.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("String_Node_Str");
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    String urlParameters="String_Node_Str" + URLEncoder.encode(longUrl,UTF8_ENCODING);
    DataOutputStream wr=new DataOutputStream(connection.getOutputStream());
    wr.writeBytes(urlParameters);
    wr.flush();
    wr.close();
    BufferedReader rd=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String line;
    StringBuilder sb=new StringBuilder();
    while ((line=rd.readLine()) != null) {
      sb.append(line);
    }
    return "String_Node_Str" + sb.toString();
  }
 catch (  Exception e) {
    return longUrl;
  }
}
Program: 151174
Project: 151174
Buggy source:
public SQLBackend(PermissionManager manager,ConfigurationSection config) throws PermissionBackendException {
  super(manager,config);
  final String dbUri=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbUser=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbPassword=getConfig().getString("String_Node_Str","String_Node_Str");
  if (dbUri == null || dbUri.isEmpty()) {
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
    throw new PermissionBackendException("String_Node_Str");
  }
  dbDriver=dbUri.split("String_Node_Str",2)[0];
  this.ds=new BasicDataSource();
  String driverClass=getDriverClass(dbDriver);
  if (driverClass != null) {
    this.ds.setDriverClassName(driverClass);
  }
  this.ds.setUrl("String_Node_Str" + dbUri);
  this.ds.setUsername(dbUser);
  this.ds.setPassword(dbPassword);
  this.ds.setMaxActive(20);
  this.ds.setMaxWait(200);
  if (this.dbDriver.equals("String_Node_Str")) {
    this.ds.addConnectionProperty("String_Node_Str","String_Node_Str");
  }
  try (SQLConnection conn=getSQL()){
    conn.checkConnection();
  }
 catch (  Exception e) {
    if (e.getCause() != null && e.getCause() instanceof Exception) {
      e=(Exception)e.getCause();
    }
    throw new PermissionBackendException("String_Node_Str",e);
  }
  getManager().getLogger().info("String_Node_Str");
  executor=Executors.newSingleThreadExecutor();
  this.setupAliases();
  this.deployTables();
}

Fixed version (ground truth):
public SQLBackend(PermissionManager manager,ConfigurationSection config) throws PermissionBackendException {
  super(manager,config);
  final String dbUri=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbUser=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbPassword=getConfig().getString("String_Node_Str","String_Node_Str");
  if (dbUri == null || dbUri.isEmpty()) {
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
    throw new PermissionBackendException("String_Node_Str");
  }
  dbDriver=dbUri.split("String_Node_Str",2)[0];
  this.ds=new BasicDataSource();
  String driverClass=getDriverClass(dbDriver);
  if (driverClass != null) {
    this.ds.setDriverClassName(driverClass);
  }
  this.ds.setUrl("String_Node_Str" + dbUri);
  this.ds.setUsername(dbUser);
  this.ds.setPassword(dbPassword);
  this.ds.setMaxActive(20);
  this.ds.setMaxWait(200);
  this.ds.setValidationQuery("String_Node_Str");
  this.ds.setTestOnBorrow(true);
  try (SQLConnection conn=getSQL()){
    conn.checkConnection();
  }
 catch (  Exception e) {
    if (e.getCause() != null && e.getCause() instanceof Exception) {
      e=(Exception)e.getCause();
    }
    throw new PermissionBackendException("String_Node_Str",e);
  }
  getManager().getLogger().info("String_Node_Str");
  executor=Executors.newSingleThreadExecutor();
  this.setupAliases();
  this.deployTables();
}
Program: 151175
Project: 151175
Buggy source:
@Override public Map<String,String> getOptions(String worldName){
  ConfigurationSection optionsSection=this.node.getConfigurationSection(formatPath(worldName,"String_Node_Str"));
  Map<String,String> worldOptions=new LinkedHashMap<>();
  putIfNotNull(worldOptions,"String_Node_Str",this.node.getString(formatPath(worldName,"String_Node_Str")));
  putIfNotNull(worldOptions,"String_Node_Str",this.node.getString(formatPath(worldName,"String_Node_Str")));
  if (optionsSection == null) {
    return Collections.emptyMap();
  }
  return Collections.unmodifiableMap(collectOptions(worldOptions,optionsSection));
}

Fixed version (ground truth):
@Override public Map<String,String> getOptions(String worldName){
  ConfigurationSection optionsSection=this.node.getConfigurationSection(formatPath(worldName,"String_Node_Str"));
  Map<String,String> worldOptions=new LinkedHashMap<>();
  putIfNotNull(worldOptions,"String_Node_Str",this.node.getString(formatPath(worldName,"String_Node_Str")));
  putIfNotNull(worldOptions,"String_Node_Str",this.node.getString(formatPath(worldName,"String_Node_Str")));
  if (optionsSection == null) {
    return Collections.unmodifiableMap(worldOptions);
  }
  return Collections.unmodifiableMap(collectOptions(worldOptions,optionsSection));
}
Program: 151177
Project: 151177
Buggy source:
/** 
 * Set backend to specified backend. This would also cause backend resetting.
 * @param backendName name of backend to set to
 */
public void setBackend(String backendName) throws PermissionBackendException {
synchronized (this) {
    this.clearCache();
    this.backend=PermissionBackend.getBackend(backendName,this,config.getBackendConfig(backendName));
    this.backend.reload();
    this.backend.validate();
  }
  this.callEvent(PermissionSystemEvent.Action.BACKEND_CHANGED);
}

Fixed version (ground truth):
/** 
 * Set backend to specified backend. This would also cause backend resetting.
 * @param backendName name of backend to set to
 */
public void setBackend(String backendName) throws PermissionBackendException {
synchronized (this) {
    this.clearCache();
    this.backend=createBackend(backendName);
  }
  this.callEvent(PermissionSystemEvent.Action.BACKEND_CHANGED);
}
Program: 151178
Project: 151178
Buggy source:
public SQLBackend(PermissionManager manager,Configuration config){
  super(manager,config);
  final String dbUri=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbUser=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbPassword=getConfig().getString("String_Node_Str","String_Node_Str");
  if (dbUri == null || dbUri.isEmpty()) {
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
  }
 else {
    conn=new ThreadLocal<SQLConnection>(){
      @Override public SQLConnection initialValue(){
        return new SQLConnection(dbUri,dbUser,dbPassword,SQLBackend.this);
      }
    }
;
  }
  this.setupAliases();
}

Fixed version (ground truth):
public SQLBackend(PermissionManager manager,ConfigurationSection config){
  super(manager,config);
  final String dbUri=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbUser=getConfig().getString("String_Node_Str","String_Node_Str");
  final String dbPassword=getConfig().getString("String_Node_Str","String_Node_Str");
  if (dbUri == null || dbUri.isEmpty()) {
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
    getConfig().set("String_Node_Str","String_Node_Str");
  }
 else {
    conn=new ThreadLocal<SQLConnection>(){
      @Override public SQLConnection initialValue(){
        return new SQLConnection(dbUri,dbUser,dbPassword,SQLBackend.this);
      }
    }
;
  }
  this.setupAliases();
}
Program: 151179
Project: 151179
Buggy source:
protected void updateInfo(){
  String sql;
  if (this.isVirtual()) {
    sql="String_Node_Str";
  }
 else {
    sql="String_Node_Str";
  }
  try {
    this.backend.getSQL().prepAndBind(sql,this.prefix,this.suffix,this.def,this.getName(),this.type.ordinal()).execute();
  }
 catch (  SQLException e) {
    if (this.isVirtual()) {
      this.virtual=false;
      this.updateInfo();
    }
    throw new RuntimeException(e);
  }
  this.virtual=false;
}

Fixed version (ground truth):
protected void updateInfo(){
  String sql;
  if (this.isVirtual()) {
    sql="String_Node_Str";
  }
 else {
    sql="String_Node_Str";
  }
  try {
    this.backend.getSQL().prepAndBind(sql,this.prefix,this.suffix,this.def ? 1 : 0,this.getName(),this.type.ordinal()).execute();
  }
 catch (  SQLException e) {
    if (this.isVirtual()) {
      this.virtual=false;
      this.updateInfo();
    }
    throw new RuntimeException(e);
  }
  this.virtual=false;
}