nus-yam/ex-repair huggingface dataset:
Program: 140937
Project: 140937
Buggy source:
/** 
 * Paints the panel and its image at the current zoom level, location, and interpolation method dependent on the image scale.</p>
 * @param g the <code>Graphics</code> context for painting
 */
@Override protected void paintComponent(Graphics g){
  super.paintComponent(g);
  if (image == null) {
    return;
  }
  if (scale <= 0.0) {
    autoZoom();
  }
  if (isHighQualityRendering()) {
    Rectangle rect=getImageClipBounds();
    if (rect == null || rect.width == 0 || rect.height == 0) {
      return;
    }
    BufferedImage subimage=image.getSubimage(rect.x,rect.y,rect.width,rect.height);
    Graphics2D g2=(Graphics2D)g;
    BufferedImage scaledImage=ImageUtils.getScaledInstance(subimage,Math.min((int)(subimage.getWidth() * scale),getWidth()),Math.min((int)(subimage.getHeight() * scale),getHeight()),INTERPOLATION_TYPE,true);
    g2.drawImage(scaledImage,Math.max(0,originX),Math.max(0,originY),null);
  }
 else {
    g.drawImage(image,originX,originY,getScreenImageWidth(),getScreenImageHeight(),null);
  }
  if (isNavigationImageEnabled()) {
    g.drawImage(navigationImage,0,0,getScreenNavImageWidth(),getScreenNavImageHeight(),null);
    drawZoomAreaOutline(g);
  }
}

Fixed version (ground truth):
/** 
 * Paints the panel and its image at the current zoom level, location, and interpolation method dependent on the image scale.</p>
 * @param g the <code>Graphics</code> context for painting
 */
@Override protected void paintComponent(Graphics g){
  super.paintComponent(g);
  if (image == null) {
    return;
  }
  if (scale <= 0.0) {
    autoZoom();
  }
  if (isHighQualityRendering()) {
    Rectangle rect=getImageClipBounds();
    if (rect == null || rect.width == 0 || rect.height == 0) {
      return;
    }
    BufferedImage subimage=image.getSubimage(rect.x,rect.y,rect.width,rect.height);
    Graphics2D g2=(Graphics2D)g;
    try {
      BufferedImage scaledImage=ImageUtils.getScaledInstance(subimage,Math.min((int)(subimage.getWidth() * scale),getWidth()),Math.min((int)(subimage.getHeight() * scale),getHeight()),INTERPOLATION_TYPE,true);
      g2.drawImage(scaledImage,Math.max(0,originX),Math.max(0,originY),null);
    }
 catch (    OutOfMemoryError ignore) {
      System.err.println("String_Node_Str");
      BufferedImage scaledImage=ImageUtils.getScaledInstance(subimage,Math.min((int)(subimage.getWidth() * 0.5),getWidth()),Math.min((int)(subimage.getHeight() * 0.5),getHeight()),INTERPOLATION_TYPE,true);
      g2.drawImage(scaledImage,Math.max(0,originX),Math.max(0,originY),rect.width * 2,rect.height * 2,null);
    }
  }
 else {
    g.drawImage(image,originX,originY,getScreenImageWidth(),getScreenImageHeight(),null);
  }
  if (isNavigationImageEnabled()) {
    g.drawImage(navigationImage,0,0,getScreenNavImageWidth(),getScreenNavImageHeight(),null);
    drawZoomAreaOutline(g);
  }
}
Program: 140938
Project: 140938
Buggy source:
private void equalizerResetButtonActionPerformed(java.awt.event.ActionEvent evt){
  for (  Component comp : equalizerSlidersPanel.getComponents()) {
    setSliderValueWithoutTriggeringEvent((JSlider)comp,100);
  }
  generalizeAndRender();
}

Fixed version (ground truth):
private void equalizerResetButtonActionPerformed(java.awt.event.ActionEvent evt){
  for (  Component comp : equalizerSlidersPanel.getComponents()) {
    setSliderValueWithoutTriggeringEvent((JSlider)comp,100);
  }
  int nbrFrequencyBands=model.getNbrEqualizerBands();
  for (int i=0; i < nbrFrequencyBands; i++) {
    model.setEqualizerWeight(i,1);
  }
  generalizeAndRender();
}
Program: 140939
Project: 140939
Buggy source:
/** 
 * Creates a slider for the equalizer GUI.
 * @param frequencyBand id of the equalizer frequency band
 * @return the new slider
 */
private JSlider createEqualizerSlider(int frequencyBand){
  JSlider jSlider=new javax.swing.JSlider();
  jSlider.setMajorTickSpacing(25);
  jSlider.setMinorTickSpacing(5);
  jSlider.setOrientation(javax.swing.JSlider.VERTICAL);
  Dimension dim=jSlider.getPreferredSize();
  dim.height=160;
  dim.width=29;
  jSlider.setPreferredSize(dim);
  jSlider.setPaintTicks(true);
  jSlider.setValue(100);
  jSlider.setMaximum(100);
  jSlider.setMinimum(0);
  jSlider.setName(Integer.toString(frequencyBand));
  jSlider.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      JSlider slider=(JSlider)e.getSource();
      if (!slider.getValueIsAdjusting()) {
        int frequencyBand=Integer.parseInt(slider.getName());
        float w=slider.getValue() / 100f;
        if (w != model.getGeneralizationEqualizerWeight(frequencyBand)) {
          model.setGeneralizationEqualizerWeight(frequencyBand,w);
          generalizeAndRender();
        }
      }
    }
  }
);
  return jSlider;
}

Fixed version (ground truth):
/** 
 * Creates a slider for the equalizer GUI.
 * @param frequencyBand id of the equalizer frequency band
 * @return the new slider
 */
private JSlider createEqualizerSlider(int frequencyBand){
  JSlider jSlider=new javax.swing.JSlider();
  jSlider.setMajorTickSpacing(25);
  jSlider.setMinorTickSpacing(5);
  jSlider.setOrientation(javax.swing.JSlider.VERTICAL);
  Dimension dim=jSlider.getPreferredSize();
  dim.height=160;
  dim.width=29;
  jSlider.setPreferredSize(dim);
  jSlider.setPaintTicks(true);
  jSlider.setValue(100);
  jSlider.setMaximum(100);
  jSlider.setMinimum(0);
  jSlider.setName(Integer.toString(frequencyBand));
  jSlider.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      JSlider slider=(JSlider)e.getSource();
      if (!slider.getValueIsAdjusting()) {
        int frequencyBand=Integer.parseInt(slider.getName());
        float w=slider.getValue() / 100f;
        if (w != model.getEqualizerWeight(frequencyBand)) {
          model.setEqualizerWeight(frequencyBand,w);
          generalizeAndRender();
        }
      }
    }
  }
);
  return jSlider;
}
Program: 140941
Project: 140941
Buggy source:
/** 
 * Set the grid.
 * @param grid The new grid.
 */
public void setGrid(Grid grid){
  this.grid=grid;
  gridMinMax=grid.getMinMax();
}

Fixed version (ground truth):
/** 
 * Set the grid. This should be followed by a call to filterGrid().
 * @param grid The new grid.
 */
public void setGrid(Grid grid){
  this.grid=grid;
  gridMinMax=grid.getMinMax();
}
Program: 140942
Project: 140942
Buggy source:
/** 
 * Creates a new BufferedImage
 * @param scale Scale factor by which the created image will be larger thanthe generalized grid.
 * @return A new image or null
 */
public BufferedImage createDestinationImage(int scale){
  if (backgroundVisualization == ColorVisualization.BIVARIATE) {
    Grid grid1=bivariateColorRender.getAttribute1Grid();
    if (grid1 != null) {
      return new BufferedImage(grid1.getCols(),grid1.getRows(),BufferedImage.TYPE_INT_ARGB);
    }
  }
  if (generalizedGrid == null) {
    return null;
  }
  int cols=generalizedGrid.getCols() * scale;
  int rows=generalizedGrid.getRows() * scale;
  return new BufferedImage(cols,rows,BufferedImage.TYPE_INT_ARGB);
}

Fixed version (ground truth):
/** 
 * Creates a new BufferedImage
 * @param scale Scale factor by which the created image will be larger thanthe grid.
 * @return A new image or null
 */
public BufferedImage createDestinationImage(int scale){
  assert(scale > 0);
  if (backgroundVisualization == ColorVisualization.BIVARIATE) {
    Grid grid1=bivariateColorRender.getAttribute1Grid();
    if (grid1 != null) {
      return new BufferedImage(grid1.getCols(),grid1.getRows(),BufferedImage.TYPE_INT_ARGB);
    }
  }
  if (grid == null) {
    return null;
  }
  int cols=grid.getCols() * scale;
  int rows=grid.getRows() * scale;
  return new BufferedImage(cols,rows,BufferedImage.TYPE_INT_ARGB);
}
Program: 140943
Project: 140943
Buggy source:
public void initDisplayImage(){
  GraphicsDevice gd=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
  int screenWidth=gd.getDisplayMode().getWidth();
  int screenHeight=gd.getDisplayMode().getHeight();
  int imageScaleFactor=1;
  Dimension dim=model.getGridDimensionForDisplay();
  double heightRatio=(double)screenHeight / dim.getHeight();
  double widthRatio=(double)screenWidth / dim.getWidth();
  double maxRatio=Math.max(heightRatio,widthRatio);
  if (maxRatio > 1) {
    imageScaleFactor=(int)Math.ceil(maxRatio);
  }
  BufferedImage image=model.createDestinationImage(imageScaleFactor);
  navigableImagePanel.setImage(image);
  navigableImagePanel.setPixelScale(1d / imageScaleFactor);
  navigableImagePanel.autoZoom();
}

Fixed version (ground truth):
public void initDisplayImage(){
  GraphicsDevice gd=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
  int screenWidth=gd.getDisplayMode().getWidth();
  int screenHeight=gd.getDisplayMode().getHeight();
  int imageScaleFactor=1;
  Dimension dim=model.getGridDimensionForDisplay();
  double heightRatio=(double)screenHeight / dim.getHeight();
  double widthRatio=(double)screenWidth / dim.getWidth();
  double maxRatio=Math.max(heightRatio,widthRatio);
  if (maxRatio > 1) {
    imageScaleFactor=(int)Math.ceil(maxRatio);
  }
  BufferedImage image=model.createDestinationImage(imageScaleFactor);
  if (image != null) {
    navigableImagePanel.setImage(image);
    navigableImagePanel.setPixelScale(1d / imageScaleFactor);
    navigableImagePanel.autoZoom();
  }
}
Program: 140944
Project: 140944
Buggy source:
public BufferedImage getImage(){
  return navigableImagePanel.getImage();
}

Fixed version (ground truth):
public BufferedImage getImage(){
  BufferedImage displayImage=navigableImagePanel.getImage();
  if (displayImage == null) {
    initDisplayImage();
  }
  return navigableImagePanel.getImage();
}
Program: 140946
Project: 140946
Buggy source:
public GridStandardDeviationOperator(int levels,LaplacianPyramid laplacianPyramid){
  this.levels=levels;
  this.laplacianPyramid=laplacianPyramid;
}

Fixed version (ground truth):
public GridStandardDeviationOperator(int levels,LaplacianPyramid laplacianPyramid){
  this.levels=levels;
  float[] weights=laplacianPyramid.createConstantWeights(0);
  for (int i=0; i < Math.min(levels,weights.length); i++) {
    weights[i]=1;
  }
  highPassGrid=laplacianPyramid.sumLevels(weights,true);
}
Program: 140947
Project: 140947
Buggy source:
private void filterComboBoxItemStateChanged(java.awt.event.ItemEvent evt){
  if (evt.getStateChange() == ItemEvent.SELECTED) {
switch (filterComboBox.getSelectedIndex()) {
case 0:
      model.setGeneralization(Model.Generalization.NONE);
    break;
case 1:
  model.setGeneralization(Model.Generalization.GAUSSIAN_BLUR);
break;
case 2:
model.setGeneralization(Model.Generalization.EQUALIZER);
break;
case 3:
model.setGeneralization(Model.Generalization.LOCAL);
break;
case 4:
model.setGeneralization(Model.Generalization.LIC_HEIGHTS);
GridLICOperator.method=GridLICOperator.GeneralizationLICMethod.GAUSSIAN_CURVED_SAMPLING2_SHARPENING;
break;
case 5:
model.setGeneralization(Model.Generalization.LIC_NORMALS);
GridLICOperator.method=GridLICOperator.GeneralizationLICMethod.LIC_NORMALS;
break;
}
updateFilterPanelsVisibility();
updateGeneralizationGUIEnabledState();
generalizeAndRender();
}
}

Fixed version (ground truth):
private void filterComboBoxItemStateChanged(java.awt.event.ItemEvent evt){
  if (evt.getStateChange() == ItemEvent.SELECTED) {
switch (filterComboBox.getSelectedIndex()) {
case 0:
      model.setGeneralization(Model.Generalization.NONE);
    break;
case 1:
  model.setGeneralization(Model.Generalization.GAUSSIAN_BLUR);
break;
case 2:
model.setGeneralization(Model.Generalization.EQUALIZER);
break;
case 3:
model.setGeneralization(Model.Generalization.LOCAL);
break;
case 4:
model.setGeneralization(Model.Generalization.LIC_HEIGHTS);
GridLICOperator.method=GridLICOperator.GeneralizationLICMethod.GAUSSIAN_CURVED_SAMPLING2_SHARPENING;
break;
case 5:
model.setGeneralization(Model.Generalization.LIC_NORMALS);
GridLICOperator.method=GridLICOperator.GeneralizationLICMethod.LIC_NORMALS;
break;
}
updateFilterPanelsVisibility();
updateGUI();
generalizeAndRender();
}
}
Program: 140948
Project: 140948
Buggy source:
public SettingsPanel(){
  initComponents();
  updateGeneralizationGUIEnabledState();
  planObliquePanel.setVisible(false);
  for (int i=0; i < 8; i++) {
    equalizerSlidersPanel.add(createEqualizerSlider(i));
  }
}

Fixed version (ground truth):
public SettingsPanel(){
  initComponents();
  planObliquePanel.setVisible(false);
  for (int i=0; i < 8; i++) {
    equalizerSlidersPanel.add(createEqualizerSlider(i));
  }
}
Program: 140949
Project: 140949
Buggy source:
private void licNormalsSharpeningSliderStateChanged(javax.swing.event.ChangeEvent evt){
  if (licNormalsSharpeningSlider.getValueIsAdjusting() == false && model.licNormalsSharpening != licNormalsSharpeningSlider.getValue() / 100d) {
    model.licNormalsSharpening=licNormalsSharpeningSlider.getValue() / 100d;
    updateGeneralizationGUIEnabledState();
    generalizeAndRender();
  }
}

Fixed version (ground truth):
private void licNormalsSharpeningSliderStateChanged(javax.swing.event.ChangeEvent evt){
  if (licNormalsSharpeningSlider.getValueIsAdjusting() == false && model.licNormalsSharpening != licNormalsSharpeningSlider.getValue() / 100d) {
    model.licNormalsSharpening=licNormalsSharpeningSlider.getValue() / 100d;
    generalizeAndRender();
  }
}
Program: 140950
Project: 140950
Buggy source:
private void licHeightsSharpeningSliderStateChanged(javax.swing.event.ChangeEvent evt){
  if (licHeightsSharpeningSlider.getValueIsAdjusting() == false && model.licHeightsSharpening != licHeightsSharpeningSlider.getValue() / 100d) {
    model.licHeightsSharpening=licHeightsSharpeningSlider.getValue() / 100d;
    updateGeneralizationGUIEnabledState();
    generalizeAndRender();
  }
}

Fixed version (ground truth):
private void licHeightsSharpeningSliderStateChanged(javax.swing.event.ChangeEvent evt){
  if (licHeightsSharpeningSlider.getValueIsAdjusting() == false && model.licHeightsSharpening != licHeightsSharpeningSlider.getValue() / 100d) {
    model.licHeightsSharpening=licHeightsSharpeningSlider.getValue() / 100d;
    generalizeAndRender();
  }
}
Program: 140952
Project: 140952
Buggy source:
public GridExporterWorker(Grid grid,Frame frame,String filePath,String dialogTitle,String message){
  super(frame,dialogTitle,message);
  this.grid=grid;
  this.filePath=filePath;
}

Fixed version (ground truth):
public GridExporterWorker(Grid grid,Frame frame,String filePath,String dialogTitle,String message){
  super(frame,dialogTitle,message);
  this.grid=grid;
  this.frame=frame;
  this.filePath=filePath;
}
Program: 140953
Project: 140953
Buggy source:
@Override public void done(){
  if (isCancelled()) {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        closeGUI();
      }
    }
);
    return;
  }
 else {
    closeGUI();
  }
  try {
    get();
  }
 catch (  InterruptedException|CancellationException e) {
  }
catch (  Throwable e) {
    String msg="String_Node_Str";
    ErrorDialog.showErrorDialog(msg,"String_Node_Str",e,null);
  }
}

Fixed version (ground truth):
@Override public void done(){
  if (isCancelled()) {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        closeGUI();
      }
    }
);
    return;
  }
 else {
    closeGUI();
  }
  try {
    get();
  }
 catch (  InterruptedException|CancellationException e) {
  }
catch (  Throwable e) {
    String msg="String_Node_Str";
    ErrorDialog.showErrorDialog(msg,"String_Node_Str",e,frame);
  }
}
Program: 140954
Project: 140954
Buggy source:
public ContoursExporterWorker(Model model,String filePath,String imageFileFormat,int scale,Frame frame,String dialogTitle,String message){
  super(frame,dialogTitle,message);
  this.filePath=filePath;
  this.imageFileFormat=imageFileFormat;
  this.model=model;
  this.scale=scale;
}

Fixed version (ground truth):
public ContoursExporterWorker(Model model,String filePath,String imageFileFormat,int scale,Frame frame,String dialogTitle,String message){
  super(frame,dialogTitle,message);
  this.filePath=filePath;
  this.imageFileFormat=imageFileFormat;
  this.model=model;
  this.scale=scale;
  this.frame=frame;
}
Program: 140955
Project: 140955
Buggy source:
@Override public void done(){
  if (isCancelled()) {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        closeGUI();
      }
    }
);
    return;
  }
 else {
    closeGUI();
  }
  try {
    get();
    String worldFilePath=WorldFileExporter.constructPath(filePath);
    Grid grid=model.getFilteredGrid();
    double cellSize=grid.getCellSize() / scale;
    double west=grid.getWest() - cellSize / 2;
    double north=grid.getNorth() + cellSize / 2;
    WorldFileExporter.writeWorldFile(worldFilePath,cellSize,west,north);
    WKTProjectionFile.write(grid.getPrjFileContent(),filePath);
  }
 catch (  ExecutionException e) {
    new File(filePath).delete();
    String msg="String_Node_Str";
    String title="String_Node_Str";
    ErrorDialog.showErrorDialog(msg,title,e,null);
  }
catch (  InterruptedException|CancellationException e) {
  }
catch (  IOException exc) {
    new File(filePath).delete();
  }
 finally {
    closeGUI();
  }
}

Fixed version (ground truth):
@Override public void done(){
  if (isCancelled()) {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        closeGUI();
      }
    }
);
    return;
  }
 else {
    closeGUI();
  }
  try {
    get();
    String worldFilePath=WorldFileExporter.constructPath(filePath);
    Grid grid=model.getFilteredGrid();
    double cellSize=grid.getCellSize() / scale;
    double west=grid.getWest() - cellSize / 2;
    double north=grid.getNorth() + cellSize / 2;
    WorldFileExporter.writeWorldFile(worldFilePath,cellSize,west,north);
    WKTProjectionFile.write(grid.getPrjFileContent(),filePath);
  }
 catch (  ExecutionException e) {
    new File(filePath).delete();
    String msg="String_Node_Str";
    String title="String_Node_Str";
    ErrorDialog.showErrorDialog(msg,title,e,frame);
  }
catch (  InterruptedException|CancellationException e) {
  }
catch (  IOException exc) {
    new File(filePath).delete();
  }
 finally {
    closeGUI();
  }
}
Program: 140956
Project: 140956
Buggy source:
private void bivariate(int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    if (bivariateColorRenderer.hasGrids() == false) {
      for (int col=0; col < nCols; ++col) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
    }
 else {
      for (int col=0; col < nCols; ++col) {
        int argb=bivariateColorRenderer.renderPixel(col,row);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void bivariate(int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    if (bivariateColorRenderer.hasGrids() == false) {
      for (int col=0; col < nCols; ++col) {
        if (col % CANCEL_CHECK == 0 && isCancelled()) {
          return;
        }
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
    }
 else {
      for (int col=0; col < nCols; ++col) {
        if (col % CANCEL_CHECK == 0 && isCancelled()) {
          return;
        }
        int argb=bivariateColorRenderer.renderPixel(col,row);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140957
Project: 140957
Buggy source:
private void hypsometricShading(Grid grid,int startRow,int endRow){
  final int nCols=grid.getCols();
  final int nRows=grid.getRows();
  final float[][] gr=grid.getGrid();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final double gray=shade(gr,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final float v=gr[row][col];
        final int argb=getLinearRGB(v,minElev,maxElev,(float)(gray / 255d));
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void hypsometricShading(Grid grid,int startRow,int endRow){
  final int nCols=grid.getCols();
  final int nRows=grid.getRows();
  final float[][] gr=grid.getGrid();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final double gray=shade(gr,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final float v=gr[row][col];
        final int argb=getLinearRGB(v,minElev,maxElev,(float)(gray / 255d));
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140958
Project: 140958
Buggy source:
private void slope(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final float gradient=(float)grid.get8NeighborGradient(col,row);
      if (Float.isNaN(gradient)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(gradient,0,1,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void slope(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final float gradient=(float)grid.get8NeighborGradient(col,row);
      if (Float.isNaN(gradient)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(gradient,0,1,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140959
Project: 140959
Buggy source:
private void bivariateShading(Grid grid,int startRow,int endRow){
  if (grid == null) {
    return;
  }
  final int nCols=dstImage.getWidth();
  final int nRows=grid.getRows();
  final float[][] gr=grid.getGrid();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    if (bivariateColorRenderer.hasGrids() == false) {
      for (int col=0; col < nCols; ++col) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
    }
 else {
      for (int col=0; col < nCols; ++col) {
        int gray=(int)shade(gr,col,row,nCols,nRows);
        if (Double.isNaN(gray)) {
          imageBuffer[row * nCols + col]=VOID_COLOR;
          continue;
        }
        int rgb=bivariateColorRenderer.renderPixel(col,row);
        if (rgb == VOID_COLOR) {
          imageBuffer[row * nCols + col]=VOID_COLOR;
          continue;
        }
        int r=(rgb & 0xFF0000) >> 16;
        int g=(rgb & 0xFF00) >> 8;
        int b=rgb & 0xFF;
        r=r * gray / 255;
        g=g * gray / 255;
        b=b * gray / 255;
        imageBuffer[row * nCols + col]=b | (g << 8) | (r << 16)| 0xFF000000;
      }
    }
  }
}

Fixed version (ground truth):
private void bivariateShading(Grid grid,int startRow,int endRow){
  if (grid == null) {
    return;
  }
  final int nCols=dstImage.getWidth();
  final int nRows=grid.getRows();
  final float[][] gr=grid.getGrid();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    if (bivariateColorRenderer.hasGrids() == false) {
      for (int col=0; col < nCols; ++col) {
        if (col % CANCEL_CHECK == 0 && isCancelled()) {
          return;
        }
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
    }
 else {
      for (int col=0; col < nCols; ++col) {
        if (col % CANCEL_CHECK == 0 && isCancelled()) {
          return;
        }
        int gray=(int)shade(gr,col,row,nCols,nRows);
        if (Double.isNaN(gray)) {
          imageBuffer[row * nCols + col]=VOID_COLOR;
          continue;
        }
        int rgb=bivariateColorRenderer.renderPixel(col,row);
        if (rgb == VOID_COLOR) {
          imageBuffer[row * nCols + col]=VOID_COLOR;
          continue;
        }
        int r=(rgb & 0xFF0000) >> 16;
        int g=(rgb & 0xFF00) >> 8;
        int b=rgb & 0xFF;
        r=r * gray / 255;
        g=g * gray / 255;
        b=b * gray / 255;
        imageBuffer[row * nCols + col]=b | (g << 8) | (r << 16)| 0xFF000000;
      }
    }
  }
}
Program: 140960
Project: 140960
Buggy source:
private void profileCurvature(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final float profileCurvature=GridProfileCurvatureOperator.getProfileCurvature(grid,col,row,3);
      if (Float.isNaN(profileCurvature)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(profileCurvature,0,1,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void profileCurvature(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final float profileCurvature=GridProfileCurvatureOperator.getProfileCurvature(grid,col,row,3);
      if (Float.isNaN(profileCurvature)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(profileCurvature,0,1,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140961
Project: 140961
Buggy source:
private void grayShading(Grid grid,int startRow,int endRow){
  final float[][] gridArray=grid.getGrid();
  final int nCols=dstImage.getWidth();
  final int nRows=dstImage.getHeight();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final double gray=shade(gridArray,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int g=(int)gray;
        imageBuffer[row * nCols + col]=g | (g << 8) | (g << 16)| 0xFF000000;
      }
    }
  }
}

Fixed version (ground truth):
private void grayShading(Grid grid,int startRow,int endRow){
  final float[][] gridArray=grid.getGrid();
  final int nCols=dstImage.getWidth();
  final int nRows=dstImage.getHeight();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final double gray=shade(gridArray,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int g=(int)gray;
        imageBuffer[row * nCols + col]=g | (g << 8) | (g << 16)| 0xFF000000;
      }
    }
  }
}
Program: 140962
Project: 140962
Buggy source:
private void expositionElevationShading(Grid grid,int startRow,int endRow){
  final float[][] gridArray=grid.getGrid();
  final int nCols=dstImage.getWidth();
  final int nRows=dstImage.getHeight();
  final int[] imageBuffer=imageBuffer(dstImage);
  float[] minMax=grid.getMinMax();
  final double minVal=minMax[0];
  final double maxVal=minMax[1];
  final double range=maxVal - minVal;
  float[] hsb=new float[3];
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final double gray=shade(gridArray,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final double v=grid.getValue(col,row);
        int argb=colorLUT.getColor(gray / 255d,(v - minVal) / range);
        int red=(argb >> 16) & 0xFF;
        int green=(argb >> 8) & 0xFF;
        int blue=argb & 0xFF;
        Color.RGBtoHSB(red,green,blue,hsb);
        argb=Color.HSBtoRGB(hsb[0],hsb[1],(float)(gray / 255d));
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void expositionElevationShading(Grid grid,int startRow,int endRow){
  final float[][] gridArray=grid.getGrid();
  final int nCols=dstImage.getWidth();
  final int nRows=dstImage.getHeight();
  final int[] imageBuffer=imageBuffer(dstImage);
  float[] minMax=grid.getMinMax();
  final double minVal=minMax[0];
  final double maxVal=minMax[1];
  final double range=maxVal - minVal;
  float[] hsb=new float[3];
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final double gray=shade(gridArray,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final double v=grid.getValue(col,row);
        int argb=colorLUT.getColor(gray / 255d,(v - minVal) / range);
        int red=(argb >> 16) & 0xFF;
        int green=(argb >> 8) & 0xFF;
        int blue=argb & 0xFF;
        Color.RGBtoHSB(red,green,blue,hsb);
        argb=Color.HSBtoRGB(hsb[0],hsb[1],(float)(gray / 255d));
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140963
Project: 140963
Buggy source:
private void aspect(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final float aspect=(float)grid.getAspect(col,row);
      if (Float.isNaN(aspect)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(aspect,(float)-Math.PI,(float)Math.PI,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void aspect(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final float aspect=(float)grid.getAspect(col,row);
      if (Float.isNaN(aspect)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(aspect,(float)-Math.PI,(float)Math.PI,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140964
Project: 140964
Buggy source:
private void expositionShading(Grid grid,int startRow,int endRow){
  final float[][] gridArray=grid.getGrid();
  final int nCols=dstImage.getWidth();
  final int nRows=dstImage.getHeight();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      final double gray=shade(gridArray,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB((float)gray,0,255,1f);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void expositionShading(Grid grid,int startRow,int endRow){
  final float[][] gridArray=grid.getGrid();
  final int nCols=dstImage.getWidth();
  final int nRows=dstImage.getHeight();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final double gray=shade(gridArray,col,row,nCols,nRows);
      if (Double.isNaN(gray)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB((float)gray,0,255,1f);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140965
Project: 140965
Buggy source:
private void hypsometric(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    float[] gridRow=grid.getGrid()[row];
    for (int col=0; col < nCols; ++col) {
      final float v=gridRow[col];
      if (Float.isNaN(v)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(v,minElev,maxElev,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}

Fixed version (ground truth):
private void hypsometric(Grid grid,int startRow,int endRow){
  final int nCols=dstImage.getWidth();
  final int[] imageBuffer=imageBuffer(dstImage);
  for (int row=startRow; row < endRow; ++row) {
    if (!reportProgress(startRow,endRow,row)) {
      return;
    }
    float[] gridRow=grid.getGrid()[row];
    for (int col=0; col < nCols; ++col) {
      if (col % CANCEL_CHECK == 0 && isCancelled()) {
        return;
      }
      final float v=gridRow[col];
      if (Float.isNaN(v)) {
        imageBuffer[row * nCols + col]=VOID_COLOR;
      }
 else {
        final int argb=getLinearRGB(v,minElev,maxElev,1);
        imageBuffer[row * nCols + col]=argb;
      }
    }
  }
}
Program: 140966
Project: 140966
Buggy source:
@Override public void done(){
  try {
    get();
    String worldFilePath=WorldFileExporter.constructPath(filePath);
    Grid grid=model.getFilteredGrid();
    double cellSize=grid.getCellSize() / scale;
    double west=grid.getWest() - cellSize / 2;
    double north=grid.getNorth() + cellSize / 2;
    WorldFileExporter.writeWorldFile(worldFilePath,cellSize,west,north);
    WKTProjectionFile.write(grid.getPrjFileContent(),filePath);
  }
 catch (  ExecutionException e) {
    new File(filePath).delete();
    String msg="String_Node_Str";
    String title="String_Node_Str";
    JOptionPane.showMessageDialog(getContentPane(),msg,title,JOptionPane.ERROR_MESSAGE);
  }
catch (  InterruptedException|CancellationException e) {
  }
catch (  IOException exc) {
    new File(filePath).delete();
  }
 finally {
    completeProgress();
  }
}

Fixed version (ground truth):
@Override public void done(){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      completeProgress();
    }
  }
);
  if (isCancelled()) {
    return;
  }
  try {
    get();
    String worldFilePath=WorldFileExporter.constructPath(filePath);
    Grid grid=model.getFilteredGrid();
    double cellSize=grid.getCellSize() / scale;
    double west=grid.getWest() - cellSize / 2;
    double north=grid.getNorth() + cellSize / 2;
    WorldFileExporter.writeWorldFile(worldFilePath,cellSize,west,north);
    WKTProjectionFile.write(grid.getPrjFileContent(),filePath);
  }
 catch (  ExecutionException e) {
    new File(filePath).delete();
    String msg="String_Node_Str";
    String title="String_Node_Str";
    JOptionPane.showMessageDialog(getContentPane(),msg,title,JOptionPane.ERROR_MESSAGE);
  }
catch (  InterruptedException|CancellationException e) {
  }
catch (  IOException exc) {
    new File(filePath).delete();
  }
 finally {
    completeProgress();
  }
}
Program: 140968
Project: 140968
Buggy source:
/** 
 * Computes normal vector at x/y. Uses bilinear interpolation, and samples the grid at cell size distance.
 * @param grid
 * @param x
 * @param y
 * @param normal normal on output, not used on input
 * @return false if the values around x/y are void and a normal cannot becomputed.
 */
private boolean normal(Grid grid,double x,double y,double normal[]){
  double d=grid.getCellSize();
  double w=grid.getBilinearInterpol(x - d,y);
  double e=grid.getBilinearInterpol(x + d,y);
  double s=grid.getBilinearInterpol(x,y - d);
  double n=grid.getBilinearInterpol(x,y + d);
  double nx=w - e;
  double ny=s - n;
  double nz=2 * grid.getProjectedCellSize();
  double nL=Math.sqrt(nx * nx + ny * ny + nz * nz);
  normal[0]=nx / nL;
  normal[1]=ny / nL;
  normal[2]=nz / nL;
  return Double.isNaN(nx) == false;
}

Fixed version (ground truth):
/** 
 * Computes normal vector at x/y. Uses bilinear interpolation, and samples the grid at cell size distance.
 * @param grid
 * @param x
 * @param y
 * @param normal normal on output, not used on input
 * @return false if the values around x/y are void and a normal cannot becomputed.
 */
private boolean normal(Grid grid,double x,double y,double normal[]){
  double d=grid.getCellSize();
  double w=grid.getBilinearInterpol(x - d,y);
  double e=grid.getBilinearInterpol(x + d,y);
  double s=grid.getBilinearInterpol(x,y - d);
  double n=grid.getBilinearInterpol(x,y + d);
  double nx=w - e;
  double ny=s - n;
  double nz=2 * grid.getProjectedCellSize();
  double nL=Math.sqrt(nx * nx + ny * ny + nz * nz);
  normal[0]=nx / nL;
  normal[1]=ny / nL;
  normal[2]=nz / nL;
  return Double.isNaN(nx) == false && Double.isNaN(ny) == false;
}
Program: 140970
Project: 140970
Buggy source:
/** 
 * Reads a .prj file with information about the coordinate reference.
 * @param gridFilePath path to the grid file
 * @return the content of the .prj file or null if the .prj cannot be found
 */
public static String readPrjFile(String gridFilePath){
  String prjFilePath=FileUtils.replaceExtension(gridFilePath,"String_Node_Str",3);
  File prjFile=new File(prjFilePath);
  if (prjFile.exists() && prjFile.length() > 0 && prjFile.length() < 10 * 1024) {
    BufferedReader br=null;
    try {
      br=new BufferedReader(new FileReader(prjFile));
      StringBuilder sb=new StringBuilder();
      String line=br.readLine();
      while (line != null) {
        sb.append(line);
        line=br.readLine();
      }
      return sb.toString();
    }
 catch (    Exception ex) {
      Logger.getLogger(EsriASCIIGridReader.class.getName()).log(Level.WARNING,null,ex);
    }
 finally {
      try {
        if (br != null) {
          br.close();
        }
      }
 catch (      IOException ex) {
        Logger.getLogger(EsriASCIIGridReader.class.getName()).log(Level.WARNING,null,ex);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Reads a .prj file with information about the coordinate reference.
 * @param gridFilePath path to the grid file
 * @return the content of the .prj file or null if the .prj cannot be found
 */
public static String readPrjFile(String gridFilePath){
  String prjFilePath=FileUtils.replaceExtension(gridFilePath,"String_Node_Str",3);
  File prjFile=new File(prjFilePath);
  if (prjFile.exists() && prjFile.length() > 0 && prjFile.length() < 10 * 1024) {
    BufferedReader br=null;
    try {
      br=new BufferedReader(new FileReader(prjFile));
      StringBuilder sb=new StringBuilder();
      String line=br.readLine();
      while (line != null) {
        line=line.trim();
        sb.append(line);
        sb.append(System.lineSeparator());
        line=br.readLine();
      }
      return sb.toString();
    }
 catch (    Exception ex) {
      Logger.getLogger(EsriASCIIGridReader.class.getName()).log(Level.WARNING,null,ex);
    }
 finally {
      try {
        if (br != null) {
          br.close();
        }
      }
 catch (      IOException ex) {
        Logger.getLogger(EsriASCIIGridReader.class.getName()).log(Level.WARNING,null,ex);
      }
    }
  }
  return null;
}
Program: 140971
Project: 140971
Buggy source:
/** 
 * Set the elevation grid.
 * @param grid The new grid.
 */
public void setGrid(Grid grid,ProgressIndicator progressIndicator){
  this.grid=grid;
  gridMinMax=grid.getMinMax();
  GaussianPyramid gaussianPyramid=new GaussianPyramid(grid);
  laplacianPyramid=new LaplacianPyramid();
  laplacianPyramid.createPyramid(gaussianPyramid.getPyramid());
  updateGeneralizedGrid(progressIndicator);
  localGridModel.setGrid(generalizedGrid,gridMinMax,laplacianPyramid);
}

Fixed version (ground truth):
/** 
 * Set the elevation grid.
 * @param grid The new grid.
 */
public void setGrid(Grid grid,ProgressIndicator progressIndicator){
  this.grid=grid;
  gridMinMax=grid.getMinMax();
  GaussianPyramid gaussianPyramid=new GaussianPyramid(grid);
  laplacianPyramid=new LaplacianPyramid();
  laplacianPyramid.createPyramid(gaussianPyramid.getPyramid());
  setGeneralizedGrid(generalizeGrid(progressIndicator));
  localGridModel.setGrid(generalizedGrid,gridMinMax,laplacianPyramid);
}
Program: 140972
Project: 140972
Buggy source:
/** 
 * Returns the generalized grid.
 * @return the generalizedGrid
 */
public Grid getGeneralizedGrid(){
  return generalizedGrid;
}

Fixed version (ground truth):
/** 
 * Returns the generalized grid.
 * @return the genGrid
 */
public Grid getGeneralizedGrid(){
  return generalizedGrid;
}
Program: 140973
Project: 140973
Buggy source:
/** 
 * @param generalizationLICSharpening thegeneralizationLICSharpening to set
 */
public void setGeneralizationLICSharpening(double generalizationLICSharpening){
  this.generalizationLICSharpening=generalizationLICSharpening;
}

Fixed version (ground truth):
/** 
 * @param generalizationLICSharpening the generalizationLICSharpening to set
 */
public void setGeneralizationLICSharpening(double generalizationLICSharpening){
  this.generalizationLICSharpening=generalizationLICSharpening;
}
Program: 140974
Project: 140974
Buggy source:
/** 
 * @param generalizationLICRoundingLimit the generalizationLICRoundingLimit to set
 */
public void setGeneralizationLICRoundingLimit(double generalizationLICRoundingLimit){
  assert(generalizationLICRoundingLimit >= 0 && generalizationLICRoundingLimit <= 1);
  this.generalizationLICRoundingLimit=generalizationLICRoundingLimit;
}

Fixed version (ground truth):
/** 
 * @param generalizationLICRoundingLimit the generalizationLICRoundingLimitto set
 */
public void setGeneralizationLICRoundingLimit(double generalizationLICRoundingLimit){
  assert(generalizationLICRoundingLimit >= 0 && generalizationLICRoundingLimit <= 1);
  this.generalizationLICRoundingLimit=generalizationLICRoundingLimit;
}
Program: 140975
Project: 140975
Buggy source:
private void generalizationCheckBoxActionPerformed(java.awt.event.ActionEvent evt){
  model.setGeneralizing(generalizationCheckBox.isSelected());
  updateGeneralizationGUIEnabledState();
  generalizeAndRender();
}

Fixed version (ground truth):
private void generalizationCheckBoxActionPerformed(java.awt.event.ActionEvent evt){
  readGeneralizationGUI(null);
}
Program: 140976
Project: 140976
Buggy source:
@Override public void run(){
  if (generalizer != null) {
    generalizer.cancel();
  }
  updateGeneralizationGUIEnabledState();
  if (slider.getValueIsAdjusting() == false) {
    model.setGeneralizationLICSize(generalizationLICSizeSlider.getValue() / 10d);
    model.setGeneralizationLICSharpening(generalizationLICSharpeningSlider.getValue() / 100d);
    model.setGeneralizationLICMinSlopeDeg(generalizationLICMinimumSlopeSlider.getValue());
    model.setGeneralizationLICIterations(generalizationLICIterationsSlider.getValue());
    model.setGeneralizationLICSharpeningLimit(generalizationLICSharpeningLimitSlider.getValue() / 100d);
    generalizeAndRender();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (generalizer != null) {
    generalizer.cancel();
  }
  if (slider == null || slider.getValueIsAdjusting() == false) {
    model.setGeneralizing(generalizationCheckBox.isSelected());
    model.setGeneralizationLICSize(generalizationLICSizeSlider.getValue() / 10d);
    model.setGeneralizationLICSharpening(generalizationLICSharpeningSlider.getValue() / 100d);
    model.setGeneralizationLICMinSlopeDeg(generalizationLICMinimumSlopeSlider.getValue());
    model.setGeneralizationLICIterations(generalizationLICIterationsSlider.getValue());
    model.setGeneralizationLICSharpeningLimit(generalizationLICSharpeningLimitSlider.getValue() / 100d);
    generalizeAndRender();
  }
  updateGeneralizationGUIEnabledState();
}
Program: 140977
Project: 140977
Buggy source:
protected Generalizer(ProgressPanel progressPanel){
  super(progressPanel);
  this.setIndeterminate(false);
  this.setCancellable(true);
  this.setMessage("String_Node_Str");
}

Fixed version (ground truth):
protected Generalizer(ProgressPanel progressPanel){
  super(progressPanel);
  this.setIndeterminate(false);
  this.setCancellable(false);
  this.setMessage("String_Node_Str");
}
Program: 140978
Project: 140978
Buggy source:
private void readGeneralizationGUI(final JSlider slider){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      if (generalizer != null) {
        generalizer.cancel();
      }
      updateGeneralizationGUIEnabledState();
      if (slider.getValueIsAdjusting() == false) {
        model.setGeneralizationLICSize(generalizationLICSizeSlider.getValue() / 10d);
        model.setGeneralizationLICSharpening(generalizationLICSharpeningSlider.getValue() / 100d);
        model.setGeneralizationLICMinSlopeDeg(generalizationLICMinimumSlopeSlider.getValue());
        model.setGeneralizationLICIterations(generalizationLICIterationsSlider.getValue());
        model.setGeneralizationLICSharpeningLimit(generalizationLICSharpeningLimitSlider.getValue() / 100d);
        generalizeAndRender();
      }
    }
  }
);
}

Fixed version (ground truth):
private void readGeneralizationGUI(final JSlider slider){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      if (generalizer != null) {
        generalizer.cancel();
      }
      if (slider == null || slider.getValueIsAdjusting() == false) {
        model.setGeneralizing(generalizationCheckBox.isSelected());
        model.setGeneralizationLICSize(generalizationLICSizeSlider.getValue() / 10d);
        model.setGeneralizationLICSharpening(generalizationLICSharpeningSlider.getValue() / 100d);
        model.setGeneralizationLICMinSlopeDeg(generalizationLICMinimumSlopeSlider.getValue());
        model.setGeneralizationLICIterations(generalizationLICIterationsSlider.getValue());
        model.setGeneralizationLICSharpeningLimit(generalizationLICSharpeningLimitSlider.getValue() / 100d);
        generalizeAndRender();
      }
      updateGeneralizationGUIEnabledState();
    }
  }
);
}
Program: 140979
Project: 140979
Buggy source:
private void generalizationCheckBoxActionPerformed(java.awt.event.ActionEvent evt){
  readGeneralizationGUI(null);
}

Fixed version (ground truth):
private void generalizationCheckBoxActionPerformed(java.awt.event.ActionEvent evt){
  updateGeneralizationGUIEnabledState();
  model.setGeneralizing(generalizationCheckBox.isSelected());
  if (generalizationCheckBox.isSelected()) {
    generalizeAndRender();
  }
}