nus-yam/ex-repair huggingface dataset:
Program: 11431
Project: 11431
Buggy source:
public void computeTile(Band targetBand,Tile targetTile,ProgressMonitor pm){
  try {
    final Rectangle targetTileRectangle=targetTile.getRectangle();
    final int x0=targetTileRectangle.x;
    final int y0=targetTileRectangle.y;
    final int w=targetTileRectangle.width;
    final int h=targetTileRectangle.height;
    final int xMax=x0 + w;
    final int yMax=y0 + h;
    System.out.println("String_Node_Str" + x0 + "String_Node_Str"+ y0+ "String_Node_Str"+ w+ "String_Node_Str"+ h);
    final String[] srcBandNames=targetBandNameToSourceBandName.get(targetBand.getName());
    final double[][] filteredTile=performFiltering(x0,y0,w,h,srcBandNames);
    final ProductData tgtData=targetTile.getDataBuffer();
    final TileIndex tgtIndex=new TileIndex(targetTile);
    for (int y=y0; y < yMax; ++y) {
      tgtIndex.calculateStride(y);
      final int yy=y - y0;
      for (int x=x0; x < xMax; ++x) {
        tgtData.setElemDoubleAt(tgtIndex.getIndex(x),filteredTile[yy][x - x0]);
      }
    }
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException("String_Node_Str",e);
  }
 finally {
    pm.done();
  }
}

Fixed version (ground truth):
public void computeTile(Band targetBand,Tile targetTile,ProgressMonitor pm){
  try {
    final Rectangle targetTileRectangle=targetTile.getRectangle();
    final int x0=targetTileRectangle.x;
    final int y0=targetTileRectangle.y;
    final int w=targetTileRectangle.width;
    final int h=targetTileRectangle.height;
    final int xMax=x0 + w;
    final int yMax=y0 + h;
    final String[] srcBandNames=targetBandNameToSourceBandName.get(targetBand.getName());
    final double[][] filteredTile=performFiltering(x0,y0,w,h,srcBandNames);
    final ProductData tgtData=targetTile.getDataBuffer();
    final TileIndex tgtIndex=new TileIndex(targetTile);
    for (int y=y0; y < yMax; ++y) {
      tgtIndex.calculateStride(y);
      final int yy=y - y0;
      for (int x=x0; x < xMax; ++x) {
        tgtData.setElemDoubleAt(tgtIndex.getIndex(x),filteredTile[yy][x - x0]);
      }
    }
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException("String_Node_Str",e);
  }
 finally {
    pm.done();
  }
}
Program: 11433
Project: 11433
Buggy source:
private void getComplexMasterImagette(final ComplexCoregData compleData,final PixelPos gcpPixelPos){
  compleData.mII=new double[compleData.fWindowHeight][compleData.fWindowWidth];
  compleData.mIQ=new double[compleData.fWindowHeight][compleData.fWindowWidth];
  final int x0=(int)gcpPixelPos.x;
  final int y0=(int)gcpPixelPos.y;
  final int xul=x0 - compleData.fHalfWindowWidth + 1;
  final int yul=y0 - compleData.fHalfWindowHeight + 1;
  final Rectangle masterImagetteRectangle=new Rectangle(xul,yul,compleData.fWindowWidth,compleData.fWindowHeight);
  final Tile masterImagetteRaster1=getSourceTile(masterBand1,masterImagetteRectangle);
  final Tile masterImagetteRaster2=getSourceTile(masterBand2,masterImagetteRectangle);
  final ProductData masterData1=masterImagetteRaster1.getDataBuffer();
  final ProductData masterData2=masterImagetteRaster2.getDataBuffer();
  final TileIndex index=new TileIndex(masterImagetteRaster1);
  final double[][] mIIdata=compleData.mII;
  final double[][] mIQdata=compleData.mIQ;
  for (int j=0; j < compleData.fWindowHeight; j++) {
    index.calculateStride(yul + j);
    for (int i=0; i < compleData.fWindowWidth; i++) {
      final int idx=index.getIndex(xul + i);
      mIIdata[j][i]=masterData1.getElemDoubleAt(idx);
      mIQdata[j][i]=masterData2.getElemDoubleAt(idx);
    }
  }
  masterData1.dispose();
  masterData2.dispose();
}

Fixed version (ground truth):
private void getComplexMasterImagette(final ComplexCoregData complexData,final PixelPos gcpPixelPos){
  complexData.mII=new double[complexData.fWindowHeight][complexData.fWindowWidth];
  complexData.mIQ=new double[complexData.fWindowHeight][complexData.fWindowWidth];
  final int x0=(int)gcpPixelPos.x;
  final int y0=(int)gcpPixelPos.y;
  final int xul=x0 - complexData.fHalfWindowWidth + 1;
  final int yul=y0 - complexData.fHalfWindowHeight + 1;
  final Rectangle masterImagetteRectangle=new Rectangle(xul,yul,complexData.fWindowWidth,complexData.fWindowHeight);
  final Tile masterImagetteRaster1=getSourceTile(masterBand1,masterImagetteRectangle);
  final Tile masterImagetteRaster2=getSourceTile(masterBand2,masterImagetteRectangle);
  final ProductData masterData1=masterImagetteRaster1.getDataBuffer();
  final ProductData masterData2=masterImagetteRaster2.getDataBuffer();
  final TileIndex index=new TileIndex(masterImagetteRaster1);
  final double[][] mIIdata=complexData.mII;
  final double[][] mIQdata=complexData.mIQ;
  for (int j=0; j < complexData.fWindowHeight; j++) {
    index.calculateStride(yul + j);
    for (int i=0; i < complexData.fWindowWidth; i++) {
      final int idx=index.getIndex(xul + i);
      mIIdata[j][i]=masterData1.getElemDoubleAt(idx);
      mIQdata[j][i]=masterData2.getElemDoubleAt(idx);
    }
  }
  masterData1.dispose();
  masterData2.dispose();
}
Program: 11434
Project: 11434
Buggy source:
private static double computeCoherence(final ComplexCoregData compleData,final double a,final double[] p,final double[] d){
  final double[] point={p[0] + a * d[0],p[1] + a * d[1]};
  return computeCoherence(compleData,point);
}

Fixed version (ground truth):
private static double computeCoherence(final ComplexCoregData complexData,final double a,final double[] p,final double[] d){
  final double[] point={p[0] + a * d[0],p[1] + a * d[1]};
  return computeCoherence(complexData,point);
}
Program: 11435
Project: 11435
Buggy source:
private static double getCoherence(final ComplexCoregData compleData,final int row,final int col,final int coherenceWindowWidth,final int coherenceWindowHeight){
  double sum1=0.0;
  double sum2=0.0;
  double sum3=0.0;
  double sum4=0.0;
  double mr, mi, sr, si;
  final double[][] mIIdata=compleData.mII;
  final double[][] mIQdata=compleData.mIQ;
  final double[][] sIIdata=compleData.sII;
  final double[][] sIQdata=compleData.sIQ;
  double[] mII, mIQ, sII, sIQ;
  int rIdx, cIdx;
  for (int r=0; r < coherenceWindowHeight; r++) {
    rIdx=row + r;
    mII=mIIdata[rIdx];
    mIQ=mIQdata[rIdx];
    sII=sIIdata[rIdx];
    sIQ=sIQdata[rIdx];
    for (int c=0; c < coherenceWindowWidth; c++) {
      cIdx=col + c;
      mr=mII[cIdx];
      mi=mIQ[cIdx];
      sr=sII[cIdx];
      si=sIQ[cIdx];
      sum1+=mr * sr + mi * si;
      sum2+=mi * sr - mr * si;
      sum3+=mr * mr + mi * mi;
      sum4+=sr * sr + si * si;
    }
  }
  return Math.sqrt(sum1 * sum1 + sum2 * sum2) / Math.sqrt(sum3 * sum4);
}

Fixed version (ground truth):
private static double getCoherence(final ComplexCoregData complexData,final int row,final int col,final int coherenceWindowWidth,final int coherenceWindowHeight){
  double sum1=0.0;
  double sum2=0.0;
  double sum3=0.0;
  double sum4=0.0;
  double mr, mi, sr, si;
  final double[][] mIIdata=complexData.mII;
  final double[][] mIQdata=complexData.mIQ;
  final double[][] sIIdata=complexData.sII;
  final double[][] sIQdata=complexData.sIQ;
  double[] mII, mIQ, sII, sIQ;
  int rIdx, cIdx;
  for (int r=0; r < coherenceWindowHeight; r++) {
    rIdx=row + r;
    mII=mIIdata[rIdx];
    mIQ=mIQdata[rIdx];
    sII=sIIdata[rIdx];
    sIQ=sIQdata[rIdx];
    for (int c=0; c < coherenceWindowWidth; c++) {
      cIdx=col + c;
      mr=mII[cIdx];
      mi=mIQ[cIdx];
      sr=sII[cIdx];
      si=sIQ[cIdx];
      sum1+=mr * sr + mi * si;
      sum2+=mi * sr - mr * si;
      sum3+=mr * mr + mi * mi;
      sum4+=sr * sr + si * si;
    }
  }
  return Math.sqrt(sum1 * sum1 + sum2 * sum2) / Math.sqrt(sum3 * sum4);
}
Program: 11439
Project: 11439
Buggy source:
/** 
 * Compute scaled noise LUTs for the given range line.
 * @param y         Index of the given range line.
 * @param x0        X coordinate of the upper left corner pixel of the given tile.
 * @param y0        Y coordinate of the upper left corner pixel of the given tile.
 * @param w         Tile width.
 * @param noiseInfo Object of ThermalNoiseInfo class.
 * @param calInfo   Object of CalibrationInfo class.
 * @param lut       The scaled noise LUT.
 */
private void computeTileScaledNoiseLUT(final int y,final int x0,final int y0,final int w,final ThermalNoiseInfo noiseInfo,final Sentinel1Calibrator.CalibrationInfo calInfo,final double azT0,final double azT1,final float[] vec0LUT,final float[] vec1LUT,final int[] vec0Pixels,final int pixelIdx0,final double[] lut){
  final double[] noiseLut=new double[w];
  computeTileNoiseLUT(y,x0,y0,w,noiseInfo,noiseLut);
  final double[] calLut=new double[w];
  computeTileCalibrationLUTs(y,x0,w,calInfo,azT0,azT1,vec0LUT,vec1LUT,vec0Pixels,pixelIdx0,calLut);
  if (removeThermalNoise) {
    for (int i=0; i < w; i++) {
      lut[i]=noiseLut[i] / (calLut[i] * calLut[i]);
    }
  }
 else {
    for (int i=0; i < w; i++) {
      lut[i]=-noiseLut[i] / (calLut[i] * calLut[i]);
    }
  }
}

Fixed version (ground truth):
/** 
 * Compute scaled noise LUTs for the given range line.
 * @param y         Index of the given range line.
 * @param x0        X coordinate of the upper left corner pixel of the given tile.
 * @param w         Tile width.
 * @param noiseInfo Object of ThermalNoiseInfo class.
 * @param calInfo   Object of CalibrationInfo class.
 * @param lut       The scaled noise LUT.
 */
private void computeTileScaledNoiseLUT(final int y,final int x0,final int w,final ThermalNoiseInfo noiseInfo,final Sentinel1Calibrator.CalibrationInfo calInfo,final double azT0,final double azT1,final float[] vec0LUT,final float[] vec1LUT,final int[] vec0Pixels,final int pixelIdx0,final double[] lut){
  final double[] noiseLut=new double[w];
  computeTileNoiseLUT(y,x0,w,noiseInfo,noiseLut);
  final double[] calLut=new double[w];
  computeTileCalibrationLUTs(y,x0,w,calInfo,azT0,azT1,vec0LUT,vec1LUT,vec0Pixels,pixelIdx0,calLut);
  if (removeThermalNoise) {
    for (int i=0; i < w; i++) {
      lut[i]=noiseLut[i] / (calLut[i] * calLut[i]);
    }
  }
 else {
    for (int i=0; i < w; i++) {
      lut[i]=-noiseLut[i] / (calLut[i] * calLut[i]);
    }
  }
}
Program: 11442
Project: 11442
Buggy source:
private void computeSubSwathEffectStartEndPixels(){
  subSwathEffectStartEndPixels=new SubSwathEffectStartEndPixels[numOfSubSwath];
  for (int i=0; i < numOfSubSwath; i++) {
    subSwathEffectStartEndPixels[i]=new SubSwathEffectStartEndPixels();
    if (i == 0) {
      subSwathEffectStartEndPixels[i].xMin=(int)Math.round((subSwath[i].slrTimeToFirstValidPixel - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
 else {
      final double midTime=(subSwath[i - 1].slrTimeToLastValidPixel + subSwath[i].slrTimeToFirstValidPixel) / 2.0;
      subSwathEffectStartEndPixels[i].xMin=(int)Math.round((midTime - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
    if (i < numOfSubSwath - 1) {
      final double midTime=(subSwath[i].slrTimeToLastValidPixel + subSwath[i + 1].slrTimeToFirstValidPixel) / 2.0;
      subSwathEffectStartEndPixels[i].xMax=(int)Math.round((midTime - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
 else {
      subSwathEffectStartEndPixels[i].xMax=(int)Math.round((subSwath[i].slrTimeToLastValidPixel - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
  }
}

Fixed version (ground truth):
private void computeSubSwathEffectStartEndPixels(){
  subSwathEffectStartEndPixels=new SubSwathEffectStartEndPixels[numOfSubSwath];
  for (int i=0; i < numOfSubSwath; i++) {
    subSwathEffectStartEndPixels[i]=new SubSwathEffectStartEndPixels();
    if (i == 0) {
      subSwathEffectStartEndPixels[i].xMin=0;
    }
 else {
      final double midTime=(subSwath[i - 1].slrTimeToLastValidPixel + subSwath[i].slrTimeToFirstValidPixel) / 2.0;
      subSwathEffectStartEndPixels[i].xMin=(int)Math.round((midTime - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
    if (i < numOfSubSwath - 1) {
      final double midTime=(subSwath[i].slrTimeToLastValidPixel + subSwath[i + 1].slrTimeToFirstValidPixel) / 2.0;
      subSwathEffectStartEndPixels[i].xMax=(int)Math.round((midTime - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
 else {
      subSwathEffectStartEndPixels[i].xMax=(int)Math.round((subSwath[i].slrTimeToLastPixel - subSwath[i].slrTimeToFirstPixel) / targetDeltaSlantRangeTime);
    }
  }
}
Program: 11443
Project: 11443
Buggy source:
/** 
 * Set pixel displacements in X and Y direction based on user selected angle.
 */
private void setXYDisplacements(){
switch (angleStr) {
case ANGLE_0:
    displacementX=displacement;
  displacementY=0;
break;
case ANGLE_45:
displacementX=displacement;
displacementY=displacement;
break;
case ANGLE_90:
displacementX=0;
displacementY=displacement;
break;
case ANGLE_135:
displacementX=-displacement;
displacementY=displacement;
break;
case ANGLE_ALL:
computeGLCPWithAllAngles=true;
break;
default :
throw new OperatorException("String_Node_Str" + angleStr);
}
}

Fixed version (ground truth):
/** 
 * Set pixel displacements in X and Y direction based on user selected angle.
 */
private void setXYDisplacements(){
switch (angleStr) {
case ANGLE_0:
    displacementX=displacement;
  displacementY=0;
break;
case ANGLE_45:
displacementX=-displacement;
displacementY=displacement;
break;
case ANGLE_90:
displacementX=0;
displacementY=displacement;
break;
case ANGLE_135:
displacementX=displacement;
displacementY=displacement;
break;
case ANGLE_ALL:
computeGLCPWithAllAngles=true;
break;
default :
throw new OperatorException("String_Node_Str" + angleStr);
}
}
Program: 11444
Project: 11444
Buggy source:
private Totals computeGLCM(final int x0,final int y0,final int xMax,final int yMax,final int[][] quantizedImage,final GLCMElem[] GLCM){
  final Totals totals=new Totals();
  int xx, yy, dX, dY;
  if (computeGLCPWithAllAngles) {
    for (int y=y0; y < yMax; y++) {
      yy=y - y0;
      for (int x=x0; x < xMax; x++) {
        xx=x - x0;
        final int i=quantizedImage[yy][xx];
        if (i < 0) {
          continue;
        }
        for (int angle=0; angle <= 135; angle+=45) {
switch (angle) {
case 0:
            dX=displacement;
          dY=0;
        break;
case 45:
      dX=displacement;
    dY=displacement;
  break;
case 90:
dX=0;
dY=displacement;
break;
case 135:
dX=-displacement;
dY=displacement;
break;
default :
throw new OperatorException("String_Node_Str" + angle);
}
int j;
if (y + dY >= y0 && y + dY < yMax && x + dX >= x0 && x + dX < xMax) {
j=quantizedImage[yy + dY][xx + dX];
if (j < 0) {
continue;
}
}
 else {
continue;
}
addElement(GLCM,i,j,totals);
addElement(GLCM,j,i,totals);
totals.totalCount++;
}
}
}
}
 else {
for (int y=y0; y < yMax; y++) {
yy=y - y0;
for (int x=x0; x < xMax; x++) {
xx=x - x0;
final int i=quantizedImage[yy][xx];
if (i < 0) {
continue;
}
int j;
if (y + displacementY >= y0 && y + displacementY < yMax && x + displacementX >= x0 && x + displacementX < xMax) {
j=quantizedImage[yy + displacementY][xx + displacementX];
if (j < 0) {
continue;
}
}
 else {
continue;
}
addElement(GLCM,i,j,totals);
addElement(GLCM,j,i,totals);
totals.totalCount++;
}
}
}
return totals;
}

Fixed version (ground truth):
private Totals computeGLCM(final int x0,final int y0,final int xMax,final int yMax,final int[][] quantizedImage,final GLCMElem[] GLCM){
  final Totals totals=new Totals();
  int xx, yy, dX, dY;
  if (computeGLCPWithAllAngles) {
    for (int y=y0; y < yMax; y++) {
      yy=y - y0;
      for (int x=x0; x < xMax; x++) {
        xx=x - x0;
        final int i=quantizedImage[yy][xx];
        if (i < 0) {
          continue;
        }
        for (int angle=0; angle <= 135; angle+=45) {
switch (angle) {
case 0:
            dX=displacement;
          dY=0;
        break;
case 45:
      dX=-displacement;
    dY=displacement;
  break;
case 90:
dX=0;
dY=displacement;
break;
case 135:
dX=displacement;
dY=displacement;
break;
default :
throw new OperatorException("String_Node_Str" + angle);
}
int j;
if (y + dY >= y0 && y + dY < yMax && x + dX >= x0 && x + dX < xMax) {
j=quantizedImage[yy + dY][xx + dX];
if (j < 0) {
continue;
}
}
 else {
continue;
}
addElement(GLCM,i,j,totals);
addElement(GLCM,j,i,totals);
totals.totalCount++;
}
}
}
}
 else {
for (int y=y0; y < yMax; y++) {
yy=y - y0;
for (int x=x0; x < xMax; x++) {
xx=x - x0;
final int i=quantizedImage[yy][xx];
if (i < 0) {
continue;
}
int j;
if (y + displacementY >= y0 && y + displacementY < yMax && x + displacementX >= x0 && x + displacementX < xMax) {
j=quantizedImage[yy + displacementY][xx + displacementX];
if (j < 0) {
continue;
}
}
 else {
continue;
}
addElement(GLCM,i,j,totals);
addElement(GLCM,j,i,totals);
totals.totalCount++;
}
}
}
return totals;
}
Program: 11445
Project: 11445
Buggy source:
/** 
 * Create warped image.
 * @param warp     The WARP polynomial.
 * @param srcImage The source image.
 * @return The warped image.
 */
private RenderedOp createWarpImage(WarpPolynomial warp,final RenderedImage srcImage){
  final ParameterBlock pb1=new ParameterBlock();
  pb1.addSource(srcImage);
  pb1.add(DataBuffer.TYPE_FLOAT);
  final RenderedImage srcImageFloat=JAI.create("String_Node_Str",pb1);
  final ParameterBlock pb2=new ParameterBlock();
  pb2.addSource(srcImageFloat);
  pb2.add(warp);
  if (interp != null) {
    pb2.add(interp);
  }
 else   if (interpTable != null) {
    pb2.add(interpTable);
  }
  return JAI.create("String_Node_Str",pb2);
}

Fixed version (ground truth):
/** 
 * Create warped image.
 * @param warp     The WARP polynomial.
 * @param srcImage The source image.
 * @return The warped image.
 */
private RenderedOp createWarpImage(WarpPolynomial warp,final RenderedImage srcImage){
  final ParameterBlock pb1=new ParameterBlock();
  pb1.addSource(srcImage);
  pb1.add(DataBuffer.TYPE_FLOAT);
  final RenderedImage srcImageFloat=JAI.create("String_Node_Str",pb1);
  if (warp == null) {
    return (RenderedOp)srcImageFloat;
  }
  final ParameterBlock pb2=new ParameterBlock();
  pb2.addSource(srcImageFloat);
  pb2.add(warp);
  if (interp != null) {
    pb2.add(interp);
  }
 else   if (interpTable != null) {
    pb2.add(interpTable);
  }
  return JAI.create("String_Node_Str",pb2);
}
Program: 11447
Project: 11447
Buggy source:
private synchronized void createReader(final ImageReader iioReader) throws IOException {
  reader=iioReader;
  initReader();
  numImages=reader.getNumImages(true);
  numBands=3;
  dataType=ProductData.TYPE_INT32;
  final ImageTypeSpecifier its=reader.getRawImageType(0);
  if (its != null) {
    numBands=reader.getRawImageType(0).getNumBands();
    dataType=bufferImageTypeToProductType(its.getBufferedImageType());
    if (its.getBufferedImageType() == BufferedImage.TYPE_BYTE_INDEXED) {
      isIndexed=true;
      createIndexedImageInfo(its.getColorModel());
    }
  }
}

Fixed version (ground truth):
private synchronized void createReader(final ImageReader iioReader) throws IOException {
  reader=iioReader;
  initReader();
  numImages=reader.getNumImages(!reader.isSeekForwardOnly());
  if (numImages < 0)   numImages=1;
  numBands=3;
  dataType=ProductData.TYPE_INT32;
  final ImageTypeSpecifier its=reader.getRawImageType(0);
  if (its != null) {
    numBands=reader.getRawImageType(0).getNumBands();
    dataType=bufferImageTypeToProductType(its.getBufferedImageType());
    if (its.getBufferedImageType() == BufferedImage.TYPE_BYTE_INDEXED) {
      isIndexed=true;
      createIndexedImageInfo(its.getColorModel());
    }
  }
}
Program: 11448
Project: 11448
Buggy source:
public void initReader(){
  if (reader != null) {
    reader.setInput(stream,true,true);
  }
}

Fixed version (ground truth):
public void initReader(){
  if (reader != null) {
    reader.setInput(stream,false,true);
  }
}
Program: 11451
Project: 11451
Buggy source:
public LocalGeometry(final int i,final int j,final ElevationModel dem,final double latMaxIdx,final double lonMinIdx,final PosVector earthPoint,final PosVector sensorPos) throws Exception {
  PixelPos pix=new PixelPos();
  GeoPos gp;
  pix.setLocation(lonMinIdx + j,latMaxIdx + i);
  gp=dem.getGeoPos(pix);
  this.t00Lat=gp.lat;
  this.t00Lon=gp.lon;
  this.t00Height=dem.getElevation(gp);
  pix.setLocation(lonMinIdx + j,latMaxIdx + i - 1);
  gp=dem.getGeoPos(pix);
  this.t01Lat=gp.lat;
  this.t01Lon=gp.lon;
  this.t01Height=dem.getElevation(gp);
  pix.setLocation(lonMinIdx + j + 1,latMaxIdx + i);
  gp=dem.getGeoPos(pix);
  this.t10Lat=gp.lat;
  this.t10Lon=gp.lon;
  this.t10Height=dem.getElevation(gp);
  pix.setLocation(lonMinIdx + j + 1,latMaxIdx + i - 1);
  gp=dem.getGeoPos(pix);
  this.t11Lat=gp.lat;
  this.t11Lon=gp.lon;
  this.t11Height=dem.getElevation(gp);
  this.centerPoint=earthPoint;
  this.sensorPos=sensorPos;
}

Fixed version (ground truth):
public LocalGeometry(final double pixelX,final double pixelY,final ElevationModel dem,final PosVector earthPoint,final PosVector sensorPos) throws Exception {
  PixelPos pix=new PixelPos();
  GeoPos gp;
  pix.setLocation(pixelX,pixelY);
  gp=dem.getGeoPos(pix);
  this.t00Lat=gp.lat;
  this.t00Lon=gp.lon;
  this.t00Height=dem.getSample(pixelX,pixelY);
  pix.setLocation(pixelX,pixelY - 1);
  gp=dem.getGeoPos(pix);
  this.t01Lat=gp.lat;
  this.t01Lon=gp.lon;
  this.t01Height=dem.getSample(pixelX,pixelY);
  pix.setLocation(pixelX + 1,pixelY);
  gp=dem.getGeoPos(pix);
  this.t10Lat=gp.lat;
  this.t10Lon=gp.lon;
  this.t10Height=dem.getSample(pixelX,pixelY);
  pix.setLocation(pixelX + 1,pixelY - 1);
  gp=dem.getGeoPos(pix);
  this.t11Lat=gp.lat;
  this.t11Lon=gp.lon;
  this.t11Height=dem.getSample(pixelX,pixelY);
  this.centerPoint=earthPoint;
  this.sensorPos=sensorPos;
}
Program: 11454
Project: 11454
Buggy source:
private boolean getPosition(final double lat,final double lon,final double alt,final int x0,final int y0,final int w,final int h,final PositionData data){
  GeoUtils.geo2xyzWGS84(lat,lon,alt,data.earthPoint);
  final double zeroDopplerTime=SARGeocoding.getEarthPointZeroDopplerTime(firstLineUTC,lineTimeInterval,wavelength,data.earthPoint,orbit.sensorPosition,orbit.sensorVelocity);
  if (zeroDopplerTime == SARGeocoding.NonValidZeroDopplerTime) {
    return false;
  }
  data.slantRange=SARGeocoding.computeSlantRange(zeroDopplerTime,orbit,data.earthPoint,data.sensorPos);
  final double zeroDopplerTimeWithoutBias=zeroDopplerTime + data.slantRange / Constants.lightSpeedInMetersPerDay;
  data.azimuthIndex=(zeroDopplerTimeWithoutBias - firstLineUTC) / lineTimeInterval;
  if (!(data.azimuthIndex >= y0 - 1 && data.azimuthIndex <= y0 + h)) {
    return false;
  }
  data.slantRange=SARGeocoding.computeSlantRange(zeroDopplerTimeWithoutBias,orbit,data.earthPoint,data.sensorPos);
  if (!srgrFlag) {
    data.rangeIndex=(data.slantRange - nearEdgeSlantRange) / rangeSpacing;
  }
 else {
    data.rangeIndex=SARGeocoding.computeRangeIndex(srgrFlag,sourceImageWidth,firstLineUTC,lastLineUTC,rangeSpacing,zeroDopplerTimeWithoutBias,data.slantRange,nearEdgeSlantRange,srgrConvParams);
  }
  if (!nearRangeOnLeft) {
    data.rangeIndex=sourceImageWidth - 1 - data.rangeIndex;
  }
  if (!(data.rangeIndex >= x0 - 1 && data.rangeIndex <= x0 + w)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean getPosition(final double lat,final double lon,final double alt,final int x0,final int y0,final int w,final int h,final PositionData data){
  GeoUtils.geo2xyzWGS84(lat,lon,alt,data.earthPoint);
  final double zeroDopplerTime=SARGeocoding.getZeroDopplerTime(firstLineUTC,lineTimeInterval,wavelength,data.earthPoint,orbit);
  if (zeroDopplerTime == SARGeocoding.NonValidZeroDopplerTime) {
    return false;
  }
  data.slantRange=SARGeocoding.computeSlantRange(zeroDopplerTime,orbit,data.earthPoint,data.sensorPos);
  data.azimuthIndex=(zeroDopplerTime - firstLineUTC) / lineTimeInterval;
  if (!(data.azimuthIndex >= y0 - 1 && data.azimuthIndex <= y0 + h)) {
    return false;
  }
  if (!srgrFlag) {
    data.rangeIndex=(data.slantRange - nearEdgeSlantRange) / rangeSpacing;
  }
 else {
    data.rangeIndex=SARGeocoding.computeRangeIndex(srgrFlag,sourceImageWidth,firstLineUTC,lastLineUTC,rangeSpacing,zeroDopplerTime,data.slantRange,nearEdgeSlantRange,srgrConvParams);
  }
  if (!nearRangeOnLeft) {
    data.rangeIndex=sourceImageWidth - 1 - data.rangeIndex;
  }
  if (!(data.rangeIndex >= x0 - 1 && data.rangeIndex <= x0 + w)) {
    return false;
  }
  return true;
}
Program: 11455
Project: 11455
Buggy source:
/** 
 * Initializes this operator and sets the one and only target product. <p>The target product can be either defined by a field of type   {@link org.esa.snap.framework.datamodel.Product}annotated with the   {@link org.esa.snap.framework.gpf.annotations.TargetProduct TargetProduct} annotation orby calling  {@link #setTargetProduct} method.</p><p>The framework calls this method after it has created this operator. Any client code that must be performed before computation of tile data should be placed here.</p>
 * @throws org.esa.snap.framework.gpf.OperatorException If an error occurs during operator initialisation.
 * @see #getTargetProduct()
 */
@Override public void initialize() throws OperatorException {
  try {
    final InputProductValidator validator=new InputProductValidator(sourceProduct);
    validator.checkIfMapProjected(false);
    if (!validator.isCalibrated(sourceProduct)) {
      throw new OperatorException("String_Node_Str");
    }
    getMetadata();
    getTiePointGrid();
    getSourceImageDimension();
    computeSensorPositionsAndVelocities();
    createTargetProduct();
    if (externalDEMFile == null) {
      DEMFactory.checkIfDEMInstalled(demName);
    }
    DEMFactory.validateDEM(demName,sourceProduct);
    noDataValue=sourceProduct.getBands()[0].getNoDataValue();
    beta0=azimuthSpacing * rangeSpacing;
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException(getId(),e);
  }
}

Fixed version (ground truth):
/** 
 * Initializes this operator and sets the one and only target product. <p>The target product can be either defined by a field of type   {@link org.esa.snap.framework.datamodel.Product}annotated with the   {@link org.esa.snap.framework.gpf.annotations.TargetProduct TargetProduct} annotation orby calling  {@link #setTargetProduct} method.</p><p>The framework calls this method after it has created this operator. Any client code that must be performed before computation of tile data should be placed here.</p>
 * @throws org.esa.snap.framework.gpf.OperatorException If an error occurs during operator initialisation.
 * @see #getTargetProduct()
 */
@Override public void initialize() throws OperatorException {
  outputSimulatedImage=true;
  try {
    final InputProductValidator validator=new InputProductValidator(sourceProduct);
    validator.checkIfMapProjected(false);
    if (!validator.isCalibrated(sourceProduct)) {
      throw new OperatorException("String_Node_Str");
    }
    getMetadata();
    getTiePointGrid();
    getSourceImageDimension();
    computeSensorPositionsAndVelocities();
    createTargetProduct();
    if (externalDEMFile == null) {
      DEMFactory.checkIfDEMInstalled(demName);
    }
    DEMFactory.validateDEM(demName,sourceProduct);
    noDataValue=sourceProduct.getBands()[0].getNoDataValue();
    beta0=azimuthSpacing * rangeSpacing;
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException(getId(),e);
  }
}
Program: 11458
Project: 11458
Buggy source:
private int getSampleIndexInSourceProduct(final int tx,final Sentinel1Utils.SubSwathInfo subSwath){
  final int sx=(int)((((targetSlantRangeTimeToFirstPixel + tx * targetDeltaSlantRangeTime) - subSwath.slrTimeToFirstValidPixel) / targetDeltaSlantRangeTime) + 0.5);
  final int numOfValidSamples=subSwath.lastValidPixel - subSwath.firstValidPixel + 1;
  return sx < 0 ? 0 : sx > numOfValidSamples - 1 ? numOfValidSamples - 1 : sx;
}

Fixed version (ground truth):
private int getSampleIndexInSourceProduct(final int tx,final Sentinel1Utils.SubSwathInfo subSwath){
  final int sx=(int)((((targetSlantRangeTimeToFirstPixel + tx * targetDeltaSlantRangeTime) - subSwath.slrTimeToFirstPixel) / targetDeltaSlantRangeTime) + 0.5);
  return sx < 0 ? 0 : sx > subSwath.numOfSamples - 1 ? subSwath.numOfSamples - 1 : sx;
}
Program: 11461
Project: 11461
Buggy source:
private static void saveSimulatedData(final double azimuthIndex,final double rangeIndex,double v,final int x0,final int y0,final int w,final int h,final Tile targetTile,final ProductData masterBuffer){
  final int ia0=(int)(azimuthIndex);
  final int ia1=ia0 + 1;
  final int ir0=(int)(rangeIndex);
  final int ir1=ir0 + 1;
  final double wr=rangeIndex - ir0;
  final double wa=azimuthIndex - ia0;
  final double wac=1 - wa;
  if (ir0 >= x0) {
    final double wrc=1 - wr;
    if (ia0 >= y0) {
      final int idx00=targetTile.getDataBufferIndex(ir0,ia0);
      masterBuffer.setElemDoubleAt(idx00,wrc * wac * v + masterBuffer.getElemDoubleAt(idx00));
    }
    if (ia1 < y0 + h) {
      final int idx10=targetTile.getDataBufferIndex(ir0,ia1);
      masterBuffer.setElemDoubleAt(idx10,wrc * wa * v + masterBuffer.getElemDoubleAt(idx10));
    }
  }
  if (ir1 < x0 + w) {
    if (ia0 >= y0) {
      final int idx01=targetTile.getDataBufferIndex(ir1,ia0);
      masterBuffer.setElemDoubleAt(idx01,wr * wac * v + masterBuffer.getElemDoubleAt(idx01));
    }
    if (ia1 < y0 + h) {
      final int idx11=targetTile.getDataBufferIndex(ir1,ia1);
      masterBuffer.setElemDoubleAt(idx11,wr * wa * v + masterBuffer.getElemDoubleAt(idx11));
    }
  }
}

Fixed version (ground truth):
private static void saveSimulatedData(final double azimuthIndex,final double rangeIndex,double v,final int x0,final int y0,final int w,final int h,final Tile targetTile,final ProductData masterBuffer){
  final int ia0=(int)(azimuthIndex);
  final int ia1=ia0 + 1;
  final int ir0=(int)(rangeIndex);
  final int ir1=ir0 + 1;
  final double wr=rangeIndex - ir0;
  final double wa=azimuthIndex - ia0;
  final double wac=1 - wa;
  if (ir0 >= x0 && ir0 < x0 + w) {
    final double wrc=1 - wr;
    if (ia0 >= y0 && ia0 < y0 + h) {
      final int idx00=targetTile.getDataBufferIndex(ir0,ia0);
      masterBuffer.setElemDoubleAt(idx00,wrc * wac * v + masterBuffer.getElemDoubleAt(idx00));
    }
    if (ia1 >= y0 && ia1 < y0 + h) {
      final int idx10=targetTile.getDataBufferIndex(ir0,ia1);
      masterBuffer.setElemDoubleAt(idx10,wrc * wa * v + masterBuffer.getElemDoubleAt(idx10));
    }
  }
  if (ir1 >= x0 && ir1 < x0 + w) {
    if (ia0 >= y0 && ia0 < y0 + h) {
      final int idx01=targetTile.getDataBufferIndex(ir1,ia0);
      masterBuffer.setElemDoubleAt(idx01,wr * wac * v + masterBuffer.getElemDoubleAt(idx01));
    }
    if (ia1 >= y0 && ia1 < y0 + h) {
      final int idx11=targetTile.getDataBufferIndex(ir1,ia1);
      masterBuffer.setElemDoubleAt(idx11,wr * wa * v + masterBuffer.getElemDoubleAt(idx11));
    }
  }
}
Program: 11469
Project: 11469
Buggy source:
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  if (incidenceAngleSelection.contains(USE_INCIDENCE_ANGLE_FROM_DEM)) {
    return sigma * calibrationFactor * FastMath.sin(localIncidenceAngle * Constants.DTOR);
  }
 else {
    return sigma * calibrationFactor;
  }
}

Fixed version (ground truth):
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandName,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  if (incidenceAngleSelection.contains(USE_INCIDENCE_ANGLE_FROM_DEM)) {
    return sigma * calibrationFactor * FastMath.sin(localIncidenceAngle * Constants.DTOR);
  }
 else {
    return sigma * calibrationFactor;
  }
}
Program: 11472
Project: 11472
Buggy source:
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandPolar,final Unit.UnitType bandUnit,final int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.AMPLITUDE_DB) {
    sigma=FastMath.pow(10,v / 5.0);
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  if (multilookFlag && antennaPatternCorrectionFlag) {
    return FastMath.sin(Math.abs(localIncidenceAngle) * Constants.DTOR) / FastMath.sin(referenceIncidenceAngle) / calibrationConstant;
  }
  sigma*=FastMath.sin(Math.abs(localIncidenceAngle) * Constants.DTOR) / FastMath.sin(referenceIncidenceAngle);
  sigma/=getNewAntennaPatternGainSquare((int)rangeIndex);
  sigma*=rangeSpreadingLoss[(int)rangeIndex];
  sigma*=replicaPulseVariationsCorrectionFactor;
  sigma/=calibrationConstant;
  return sigma;
}

Fixed version (ground truth):
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandName,final String bandPolar,final Unit.UnitType bandUnit,final int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.AMPLITUDE_DB) {
    sigma=FastMath.pow(10,v / 5.0);
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  if (multilookFlag && antennaPatternCorrectionFlag) {
    return FastMath.sin(Math.abs(localIncidenceAngle) * Constants.DTOR) / FastMath.sin(referenceIncidenceAngle) / calibrationConstant;
  }
  sigma*=FastMath.sin(Math.abs(localIncidenceAngle) * Constants.DTOR) / FastMath.sin(referenceIncidenceAngle);
  sigma/=getNewAntennaPatternGainSquare((int)rangeIndex);
  sigma*=rangeSpreadingLoss[(int)rangeIndex];
  sigma*=replicaPulseVariationsCorrectionFactor;
  sigma/=calibrationConstant;
  return sigma;
}
Program: 11473
Project: 11473
Buggy source:
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  if (isComplex) {
    if (gains != null) {
      sigma/=(gains[(int)rangeIndex] * gains[(int)rangeIndex]);
    }
  }
 else {
    sigma+=offset;
    if (gains != null) {
      sigma/=gains[(int)rangeIndex];
    }
  }
  if (incidenceAngleSelection.contains(USE_INCIDENCE_ANGLE_FROM_DEM)) {
    return sigma * FastMath.sin(localIncidenceAngle * Constants.DTOR);
  }
 else {
    return sigma;
  }
}

Fixed version (ground truth):
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandName,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  if (isComplex) {
    if (gains != null) {
      sigma/=(gains[(int)rangeIndex] * gains[(int)rangeIndex]);
    }
  }
 else {
    sigma+=offset;
    if (gains != null) {
      sigma/=gains[(int)rangeIndex];
    }
  }
  if (incidenceAngleSelection.contains(USE_INCIDENCE_ANGLE_FROM_DEM)) {
    return sigma * FastMath.sin(localIncidenceAngle * Constants.DTOR);
  }
 else {
    return sigma;
  }
}
Program: 11475
Project: 11475
Buggy source:
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  final double Ks=calibrationFactor.get(bandPolar.toUpperCase());
  sigma*=Ks * FastMath.sin(localIncidenceAngle * Constants.DTOR);
  return sigma;
}

Fixed version (ground truth):
public double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandName,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex){
  double sigma=0.0;
  if (bandUnit == Unit.UnitType.AMPLITUDE) {
    sigma=v * v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY || bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY) {
    sigma=v;
  }
 else   if (bandUnit == Unit.UnitType.INTENSITY_DB) {
    sigma=FastMath.pow(10,v / 10.0);
  }
 else {
    throw new OperatorException("String_Node_Str");
  }
  final double Ks=calibrationFactor.get(bandPolar.toUpperCase());
  sigma*=Ks * FastMath.sin(localIncidenceAngle * Constants.DTOR);
  return sigma;
}
Program: 11476
Project: 11476
Buggy source:
double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex);

Fixed version (ground truth):
double applyCalibration(final double v,final double rangeIndex,final double azimuthIndex,final double slantRange,final double satelliteHeight,final double sceneToEarthCentre,final double localIncidenceAngle,final String bandName,final String bandPolar,final Unit.UnitType bandUnit,int[] subSwathIndex);
Program: 11479
Project: 11479
Buggy source:
private void checkSourceProductType(){
  final PolBandUtils.MATRIX sourceProductType=PolBandUtils.getSourceProductType(sourceProduct);
  if (sourceProductType == PolBandUtils.MATRIX.UNKNOWN) {
    throw new OperatorException("String_Node_Str");
  }
switch (matrix) {
case C2:
    if (sourceProductType != PolBandUtils.MATRIX.DUAL_HH_HV && sourceProductType != PolBandUtils.MATRIX.DUAL_HH_VV && sourceProductType != PolBandUtils.MATRIX.DUAL_HH_VV) {
      throw new OperatorException("String_Node_Str");
    }
  break;
case C3:
case C4:
case T3:
case T4:
if (PolBandUtils.isDualPol(sourceProductType)) {
  throw new OperatorException("String_Node_Str");
}
break;
default :
throw new OperatorException("String_Node_Str" + matrix);
}
}

Fixed version (ground truth):
private void checkSourceProductType(){
  final PolBandUtils.MATRIX sourceProductType=PolBandUtils.getSourceProductType(sourceProduct);
  if (sourceProductType == PolBandUtils.MATRIX.UNKNOWN) {
    throw new OperatorException("String_Node_Str");
  }
switch (matrix) {
case C2:
    if (sourceProductType != PolBandUtils.MATRIX.DUAL_HH_HV && sourceProductType != PolBandUtils.MATRIX.DUAL_VH_VV && sourceProductType != PolBandUtils.MATRIX.DUAL_HH_VV) {
      throw new OperatorException("String_Node_Str");
    }
  break;
case C3:
case C4:
case T3:
case T4:
if (PolBandUtils.isDualPol(sourceProductType)) {
  throw new OperatorException("String_Node_Str");
}
break;
default :
throw new OperatorException("String_Node_Str" + matrix);
}
}
Program: 11483
Project: 11483
Buggy source:
@Override public void actionPerformed(final CommandEvent event){
  final LayerSourceAssistantPane pane=new LayerSourceAssistantPane(VisatApp.getApp().getApplicationWindow(),"String_Node_Str",getAppContext());
  final LayerSourceDescriptor[] layerSourceDescriptors=BeamUiActivator.getInstance().getLayerSources();
  pane.show(new SelectLayerSourceAssistantPage(layerSourceDescriptors));
}

Fixed version (ground truth):
@Override public void actionPerformed(final CommandEvent event){
  final LayerSourceAssistantPane pane=new LayerSourceAssistantPane(VisatApp.getApp().getApplicationWindow(),"String_Node_Str");
  final LayerSourceDescriptor[] layerSourceDescriptors=BeamUiActivator.getInstance().getLayerSources();
  pane.show(new SelectLayerSourceAssistantPage(layerSourceDescriptors));
}
Program: 11487
Project: 11487
Buggy source:
public static void gridDataLinear(final double[][] x_in,final double[][] y_in,final double[][] z1_in,final double[][] z2_in,final double[][] z1_out,final double[][] z2_out,final org.jlinda.core.Window window,final double xyRatio,final int xScale,final int yScale,final double invalidIndex,final int offset) throws Exception {
  final FastDelaunayTriangulator FDT=triangulate(x_in,y_in,xyRatio,invalidIndex);
  if (FDT == null) {
    return;
  }
  interpolate(xyRatio,window,xScale,yScale,offset,invalidIndex,FDT,z1_in,z2_in,z1_out,z2_out);
}

Fixed version (ground truth):
public static void gridDataLinear(final double[][] x_in,final double[][] y_in,final double[][] z1_in,final double[][] z2_in,final double[][] z3_in,final double[][] z4_in,final double[][] z1_out,final double[][] z2_out,final double[][] z3_out,final double[][] z4_out,final org.jlinda.core.Window window,final double xyRatio,final int xScale,final int yScale,final double invalidIndex,final int offset) throws Exception {
  final FastDelaunayTriangulator FDT=triangulate(x_in,y_in,xyRatio,invalidIndex);
  if (FDT == null) {
    return;
  }
  interpolate(xyRatio,window,xScale,yScale,offset,invalidIndex,FDT,z1_in,z2_in,z3_in,z4_in,z1_out,z2_out,z3_out,z4_out);
}
Program: 11489
Project: 11489
Buggy source:
public LocalGeometry(final int x,final int y,final double[] earthPoint,final double[] sensPos,final TerrainData terrainData,final int xx,final int yy){
  t00Lat=terrainData.latPixels[yy][xx];
  t00Lon=terrainData.lonPixels[yy][xx];
  t01Lat=terrainData.latPixels[yy - 1][xx];
  t01Lon=terrainData.lonPixels[yy - 1][xx];
  t10Lat=terrainData.latPixels[yy][xx + 1];
  t10Lon=terrainData.lonPixels[yy][xx + 1];
  t11Lat=terrainData.latPixels[yy + 1][xx + 1];
  t11Lon=terrainData.lonPixels[yy + 1][xx + 1];
  centerPoint=earthPoint;
  sensorPos=sensPos;
}

Fixed version (ground truth):
public LocalGeometry(final double[] earthPoint,final double[] sensPos,final TerrainData terrainData,final int xx,final int yy){
  t00Lat=terrainData.latPixels[yy][xx];
  t00Lon=terrainData.lonPixels[yy][xx];
  t00Height=terrainData.localDEM[yy][xx];
  t01Lat=terrainData.latPixels[yy - 1][xx];
  t01Lon=terrainData.lonPixels[yy - 1][xx];
  t01Height=terrainData.localDEM[yy - 1][xx];
  t10Lat=terrainData.latPixels[yy][xx + 1];
  t10Lon=terrainData.lonPixels[yy][xx + 1];
  t10Height=terrainData.localDEM[yy][xx + 1];
  t11Lat=terrainData.latPixels[yy - 1][xx + 1];
  t11Lon=terrainData.lonPixels[yy - 1][xx + 1];
  t11Height=terrainData.localDEM[yy - 1][xx + 1];
  centerPoint=earthPoint;
  sensorPos=sensPos;
}
Program: 11491
Project: 11491
Buggy source:
public double ta2line(double azitime){
  return 1.0 + PRF * (azitime - tAzi1);
}

Fixed version (ground truth):
public double ta2line(double azitime){
  return (azitime - tAzi1) / lineTimeInterval;
}
Program: 11493
Project: 11493
Buggy source:
public double line2ta(double line){
  return tAzi1 + ((line - 1.0) / PRF);
}

Fixed version (ground truth):
public double line2ta(double line){
  return tAzi1 + (line * lineTimeInterval);
}
Program: 11495
Project: 11495
Buggy source:
private double[] computeMaxHeight(PixelPos[] corners,Rectangle rectangle) throws Exception {
  final float extraTileX=(float)(1 + tileExtensionPercent / 100);
  final float extraTileY=(float)(1 + tileExtensionPercent / 100);
  final float scaleMaxHeight=(float)(1 + tileExtensionPercent / 100);
  double[] heightArray=new double[2];
  final int numberOfPoints=(int)(10 * Math.sqrt(Math.sqrt(rectangle.width * rectangle.height)));
  int offsetX=(int)(extraTileX * rectangle.width);
  int offsetY=(int)(extraTileY * rectangle.height);
  final Window window=new Window((long)(corners[0].y - offsetY),(long)(corners[1].y + offsetY),(long)(corners[0].x - offsetX),(long)(corners[1].x + offsetX));
  final int[][] points=MathUtils.distributePoints(numberOfPoints,window);
  final ArrayList<Double> heights=new ArrayList();
  for (  int[] point : points) {
    double height=dem.getSample(point[1],point[0]);
    if (!Double.isNaN(height) && height != demNoDataValue) {
      heights.add(height);
    }
  }
  if (heights.size() > 2) {
    heightArray[0]=Collections.min(heights);
    heightArray[1]=Collections.max(heights) * scaleMaxHeight;
  }
 else {
    heightArray[0]=0;
    heightArray[1]=0;
  }
  return heightArray;
}

Fixed version (ground truth):
private double[] computeMaxHeight(PixelPos[] corners,Rectangle rectangle) throws Exception {
  final float extraTileX=(float)(1 + tileExtensionPercent / 100.0);
  final float extraTileY=(float)(1 + tileExtensionPercent / 100.0);
  final float scaleMaxHeight=(float)(1 + tileExtensionPercent / 100.0);
  double[] heightArray=new double[2];
  final int numberOfPoints=(int)(10 * Math.sqrt(Math.sqrt(rectangle.width * rectangle.height)));
  final int offsetX=(int)(extraTileX * rectangle.width);
  final int offsetY=(int)(extraTileY * rectangle.height);
  final Window window=new Window((long)(corners[0].y - offsetY),(long)(corners[1].y + offsetY),(long)(corners[0].x - offsetX),(long)(corners[1].x + offsetX));
  final int[][] points=MathUtils.distributePoints(numberOfPoints,window);
  final ArrayList<Double> heights=new ArrayList();
  for (  int[] point : points) {
    double height=dem.getSample(point[1],point[0]);
    if (!Double.isNaN(height) && height != demNoDataValue) {
      heights.add(height);
    }
  }
  if (heights.size() > 2) {
    heightArray[0]=Collections.min(heights);
    heightArray[1]=Collections.max(heights) * scaleMaxHeight;
  }
 else {
    heightArray[0]=0;
    heightArray[1]=0;
  }
  return heightArray;
}