nus-yam/ex-repair huggingface dataset:
Program: 175049
Project: 175049
Buggy source:
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(bounds);
  t.setSourceRegion(rect);
  TIFF tiff=getImage(band);
  try {
    int img=tiff.read(0,t).getRaster().getSample(0,0,1);
    int real=tiff.read(0,t).getRaster().getSample(0,0,0);
    return (int)Math.sqrt(real * real + img * img);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
catch (  ArrayIndexOutOfBoundsException ex) {
    logger.warn(ex.getMessage());
    ex.printStackTrace();
  }
catch (  IllegalArgumentException iae) {
    logger.warn(iae.getMessage());
  }
 finally {
  }
  return -1;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(bounds);
  t.setSourceRegion(rect);
  TIFF tiff=getImage(band);
  try {
    int img=tiff.read(0,t).getRaster().getSample(0,0,1);
    int real=tiff.read(0,t).getRaster().getSample(0,0,0);
    return (int)Math.sqrt(real * real + img * img);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
catch (  ArrayIndexOutOfBoundsException ex) {
    logger.warn("String_Node_Str" + ex.getMessage());
  }
catch (  IllegalArgumentException iae) {
    logger.warn("String_Node_Str" + iae.getMessage());
  }
 finally {
  }
  return -1;
}
Program: 175051
Project: 175051
Buggy source:
private boolean tryFileCache(GL gl,String file,int level,int i,int j,float xmin,float xmax,float ymin,float ymax){
  String tileId=new StringBuilder("String_Node_Str").append(level).append("String_Node_Str").append(getBandFolder(activeBand)).append("String_Node_Str").append(i).append("String_Node_Str").append(j).toString();
  Cache cacheInstance=CacheManager.getCacheInstance(activeGir.getDisplayName(activeBand));
  boolean ok=true;
  if (cacheInstance.contains(file) & !submitedTiles.contains(tileId)) {
    BufferedImage temp=null;
    try {
      try {
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
 catch (      Exception ex) {
        try {
          Thread.sleep(200);
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
        }
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
      if (temp == null) {
        ok=false;
      }
    }
 catch (    Exception ex) {
      ok=false;
      logger.warn("String_Node_Str" + file + "String_Node_Str"+ ex.getMessage());
    }
 finally {
      pngReader.dispose();
    }
    if (ok) {
      if (temp.getColorModel().getNumComponents() == 1) {
        temp=rescale.filter(temp,rescale.createCompatibleDestImage(temp,temp.getColorModel()));
      }
      Texture t=AWTTextureIO.newTexture(gl.getGLProfile(),temp,false);
      tcm.add(file,t);
      bindTexture(gl,t,xmin,xmax,ymin,ymax);
    }
  }
 else {
    ok=false;
  }
  return ok;
}

Fixed version (ground truth):
/** 
 * search for tiles in the file cache
 * @param gl
 * @param file
 * @param level
 * @param i
 * @param j
 * @param xmin
 * @param xmax
 * @param ymin
 * @param ymax
 * @return
 */
private BufferedImage tryFileCache(GL gl,String file,int level,int i,int j,float xmin,float xmax,float ymin,float ymax){
  String tileId=new StringBuilder("String_Node_Str").append(level).append("String_Node_Str").append(getBandFolder(activeBand)).append("String_Node_Str").append(i).append("String_Node_Str").append(j).toString();
  Cache cacheInstance=CacheManager.getCacheInstance(activeGir.getDisplayName(activeBand));
  BufferedImage temp=null;
  if (cacheInstance.contains(file) & !submitedTiles.contains(tileId)) {
    try {
      try {
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
 catch (      Exception ex) {
        try {
          Thread.sleep(200);
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
        }
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
    }
 catch (    Exception ex) {
      logger.warn("String_Node_Str" + file + "String_Node_Str"+ ex.getMessage());
      return null;
    }
 finally {
      pngReader.dispose();
    }
    if (temp.getColorModel().getNumComponents() == 1) {
      temp=rescale.filter(temp,rescale.createCompatibleDestImage(temp,temp.getColorModel()));
    }
  }
  return temp;
}
Program: 175052
Project: 175052
Buggy source:
private void displayDownloading(int size){
  GeoImageViewerView view=((GeoImageViewerView)SumoPlatform.getApplication().getMainView());
  if (currentSize != size) {
    if (size == 0) {
      view.setInfo("String_Node_Str",-1);
    }
 else {
      view.setInfo(new StringBuilder("String_Node_Str").append(size).toString());
    }
    currentSize=size;
  }
}

Fixed version (ground truth):
private void displayDownloading(int size){
  if (currentSize != size) {
    if (size == 0) {
      SumoPlatform.getApplication().setMessageInfo("String_Node_Str");
    }
 else {
      SumoPlatform.getApplication().setMessageInfo(new StringBuilder("String_Node_Str").append(size).toString());
    }
    currentSize=size;
  }
}
Program: 175053
Project: 175053
Buggy source:
private boolean tryMemoryCache(GL gl,String file,float xmin,float xmax,float ymin,float ymax){
  Texture t=tcm.getTexture(file);
  if (t != null) {
    bindTexture(gl,t,xmin,xmax,ymin,ymax);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * search for the tiles on memory
 * @param gl
 * @param file
 * @param xmin
 * @param xmax
 * @param ymin
 * @param ymax
 * @return
 */
private Texture tryMemoryCache(GL gl,String file,float xmin,float xmax,float ymin,float ymax){
  Texture t=tcm.getTexture(file);
  return t;
}
Program: 175054
Project: 175054
Buggy source:
/** 
 * Reads single pixel value of the curent band.
 * @param x
 * @param y
 * @return pixel value
 */
public int readPixel(int x,int y,int band);

Fixed version (ground truth):
/** 
 * Reads single pixel value of the curent band.
 * @param x
 * @param y
 * @return pixel value
 */
public long readPixel(int x,int y,int band);
Program: 175055
Project: 175055
Buggy source:
@Override public int readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  t.setSourceRegion(new Rectangle(x,y,1,1));
  int[] pix=new int[1];
  tiffRaster.getPixel(x,y,pix);
  return pix[0];
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  t.setSourceRegion(new Rectangle(x,y,1,1));
  int[] pix=new int[1];
  tiffRaster.getPixel(x,y,pix);
  return pix[0];
}
Program: 175056
Project: 175056
Buggy source:
public int readPixel(int x,int y,int band){
  return readTile(x,y,1,1,band)[0];
}

Fixed version (ground truth):
public long readPixel(int x,int y,int band){
  return readTile(x,y,1,1,band)[0];
}
Program: 175057
Project: 175057
Buggy source:
@Override public int readPixel(int x,int y,int band){
  return read(x,y,1,1,band)[0];
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  return read(x,y,1,1,band)[0];
}
Program: 175058
Project: 175058
Buggy source:
@Override public int[] readTile(int x,int y,int width,int height,int band){
  TIFF tiff=(TIFF)getImage(band);
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(tiff.getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.width * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
    logger.debug("String_Node_Str");
  }
  int yOffset=tiff.xSize;
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}

Fixed version (ground truth):
@Override public int[] readTile(int x,int y,int width,int height,int band){
  TIFF tiff=(TIFF)getImage(band);
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(tiff.getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.width * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
    logger.debug("String_Node_Str");
  }
  int yOffset=tiff.xSize;
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=(int)preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}
Program: 175059
Project: 175059
Buggy source:
@Override public void preloadLineTile(int y,int length,int band){
  TIFF tiff=(TIFF)getImage(band);
  if (y < 0) {
    return;
  }
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,tiff.xSize,length);
  rect=tiff.getBounds().intersection(rect);
  try {
    BufferedImage bi=null;
    try {
      bi=tiff.read(0,rect);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.read(0,rect);
    }
    WritableRaster raster=bi.getRaster();
    preloadedData=(short[])raster.getDataElements(0,0,raster.getWidth(),raster.getHeight(),null);
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}

Fixed version (ground truth):
@Override public void preloadLineTile(int y,int length,int band){
  TIFF tiff=(TIFF)getImage(band);
  if (y < 0) {
    return;
  }
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,tiff.xSize,length);
  rect=tiff.getBounds().intersection(rect);
  try {
    BufferedImage bi=null;
    try {
      bi=tiff.read(0,rect);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.read(0,rect);
    }
    WritableRaster raster=bi.getRaster();
    preloadedData=(Short[])raster.getDataElements(0,0,raster.getWidth(),raster.getHeight(),null);
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}
Program: 175060
Project: 175060
Buggy source:
@Override public int[] readTile(int x,int y,int width,int height,int band){
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(getImage(band).getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.width * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
    logger.debug("String_Node_Str");
  }
  int yOffset=getImage(band).xSize;
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}

Fixed version (ground truth):
@Override public int[] readTile(int x,int y,int width,int height,int band){
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(getImage(band).getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.width * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
  }
  int yOffset=getImage(band).xSize;
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=((Short)preloadedData[temp]).intValue();
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}
Program: 175061
Project: 175061
Buggy source:
@Override public void preloadLineTile(int y,int length,int band){
  if (y < 0) {
    return;
  }
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,getImage(band).xSize,length);
  TIFF tiff=getImage(band);
  rect=tiff.getBounds().intersection(rect);
  try {
    BufferedImage bi=null;
    try {
      bi=tiff.read(0,rect);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.read(0,rect);
    }
    WritableRaster raster=bi.getRaster();
    preloadedData=(short[])raster.getDataElements(0,0,raster.getWidth(),raster.getHeight(),null);
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}

Fixed version (ground truth):
@Override public void preloadLineTile(int y,int length,int band){
  if (y < 0) {
    return;
  }
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,getImage(band).xSize,length);
  TIFF tiff=getImage(band);
  rect=tiff.getBounds().intersection(rect);
  try {
    BufferedImage bi=null;
    try {
      bi=tiff.read(0,rect);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.read(0,rect);
    }
    WritableRaster raster=bi.getRaster();
    short[] ss=(short[])raster.getDataElements(0,0,raster.getWidth(),raster.getHeight(),null);
    preloadedData=ArrayUtils.toObject(ss);
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}
Program: 175062
Project: 175062
Buggy source:
@Override public int readPixel(int x,int y,int band){
  return read(x,y,1,1,band)[0];
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  return read(x,y,1,1,band)[0];
}
Program: 175063
Project: 175063
Buggy source:
@Override public int[] read(int x,int y,int width,int height,int band){
  int data[]=null;
  GeoToolsGDALReader tiff=(GeoToolsGDALReader)getImage(band);
  try {
    short[] b=tiff.readShortValues(x,y,width,height);
    data=new int[b.length];
    for (int i=0; i < b.length; i++)     data[i]=b[i];
  }
 catch (  Exception ex) {
    logger.warn(ex.getMessage());
  }
 finally {
  }
  return data;
}

Fixed version (ground truth):
@Override public int[] read(int x,int y,int width,int height,int band){
  int data[]=null;
  GeoToolsGDALReader tiff=(GeoToolsGDALReader)getImage(band);
  try {
    int[] b=tiff.readPixValues(x,y,width,height);
    data=new int[b.length];
    for (int i=0; i < b.length; i++)     data[i]=b[i];
  }
 catch (  Exception ex) {
    logger.warn(ex.getMessage());
  }
 finally {
  }
  return data;
}
Program: 175064
Project: 175064
Buggy source:
@Override public int[] readTile(int x,int y,int width,int height,int band){
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(getImage(band).getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.y * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
  }
  int yOffset=getImage(band).getxSize();
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}

Fixed version (ground truth):
@Override public int[] readTile(int x,int y,int width,int height,int band){
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(getImage(band).getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.y * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
  }
  int yOffset=getImage(band).getxSize();
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=(int)preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}
Program: 175065
Project: 175065
Buggy source:
@Override public void preloadLineTile(int y,int length,int band){
  if (y < 0) {
    return;
  }
  GeoToolsGDALReader tiff=(GeoToolsGDALReader)getImage(band);
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,tiff.getxSize(),length);
  rect=tiff.getBounds().intersection(rect);
  try {
    short[] bi=null;
    try {
      bi=tiff.readShortValues(0,y,rect.width,rect.height);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.readShortValues(0,y,rect.width,rect.height);
    }
    preloadedData=bi;
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}

Fixed version (ground truth):
@Override public void preloadLineTile(int y,int length,int band){
  if (y < 0) {
    return;
  }
  GeoToolsGDALReader tiff=(GeoToolsGDALReader)getImage(band);
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,tiff.getxSize(),length);
  rect=tiff.getBounds().intersection(rect);
  try {
    int[] bi=null;
    try {
      bi=tiff.readPixValues(0,y,rect.width,rect.height);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.readPixValues(0,y,rect.width,rect.height);
    }
    preloadedData=ArrayUtils.toObject(bi);
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}
Program: 175066
Project: 175066
Buggy source:
@Override public int readPixel(int x,int y,int band){
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(getImage(band).getBounds());
  short data[]=null;
  GeoToolsGDALReader img=(GeoToolsGDALReader)getImage(band);
  try {
    data=img.readShortValues(x,y,1,1);
  }
  finally {
  }
  return data[0];
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(getImage(band).getBounds());
  int data[]=null;
  GeoToolsGDALReader img=(GeoToolsGDALReader)getImage(band);
  try {
    data=img.readPixValues(x,y,1,1);
  }
  finally {
  }
  return data[0];
}
Program: 175067
Project: 175067
Buggy source:
@Override public int[] readTile(int x,int y,int width,int height,int band){
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(getImage(band).getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.y * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
  }
  int yOffset=getImage(band).getxSize();
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}

Fixed version (ground truth):
@Override public int[] readTile(int x,int y,int width,int height,int band){
  Rectangle rect=new Rectangle(x,y,width,height);
  rect=rect.intersection(getImage(band).getBounds());
  int[] tile=new int[height * width];
  if (rect.isEmpty()) {
    return tile;
  }
  if (rect.y != preloadedInterval[0] || rect.y + rect.height != preloadedInterval[1] || preloadedData.length < (rect.y * rect.height - 1)) {
    preloadLineTile(rect.y,rect.height,band);
  }
 else {
  }
  int yOffset=getImage(band).getxSize();
  int xinit=rect.x - x;
  int yinit=rect.y - y;
  for (int i=0; i < rect.height; i++) {
    for (int j=0; j < rect.width; j++) {
      int temp=i * yOffset + j + rect.x;
      try {
        tile[(i + yinit) * width + j + xinit]=(int)preloadedData[temp];
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
  return tile;
}
Program: 175068
Project: 175068
Buggy source:
@Override public void preloadLineTile(int y,int length,int band){
  if (y < 0) {
    return;
  }
  CeosBinaryReader tiff=(CeosBinaryReader)getImage(band);
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,tiff.getxSize(),length);
  rect=tiff.getBounds().intersection(rect);
  try {
    short[] bi=null;
    try {
      bi=tiff.readShort(0,y,rect.width,rect.height);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.readShort(0,y,rect.width,rect.height);
    }
    preloadedData=bi;
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}

Fixed version (ground truth):
@Override public void preloadLineTile(int y,int length,int band){
  if (y < 0) {
    return;
  }
  CeosBinaryReader tiff=(CeosBinaryReader)getImage(band);
  preloadedInterval=new int[]{y,y + length};
  Rectangle rect=new Rectangle(0,y,tiff.getxSize(),length);
  rect=tiff.getBounds().intersection(rect);
  try {
    int[] bi=null;
    try {
      bi=tiff.readInt(0,y,rect.width,rect.height);
    }
 catch (    Exception e) {
      logger.warn("String_Node_Str" + 0 + "String_Node_Str"+ y+ "String_Node_Str");
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException exx) {
        Thread.currentThread().interrupt();
      }
      bi=tiff.readInt(0,y,rect.width,rect.height);
    }
    preloadedData=ArrayUtils.toObject(bi);
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
  }
}
Program: 175069
Project: 175069
Buggy source:
@Override public int readPixel(int x,int y,int band){
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(getImage(band).getBounds());
  short data[]=null;
  CeosBinaryReader img=(CeosBinaryReader)getImage(band);
  try {
    data=img.readShort(x,y,1,1);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return data[0];
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(getImage(band).getBounds());
  short data[]=null;
  CeosBinaryReader img=(CeosBinaryReader)getImage(band);
  try {
    data=img.readShort(x,y,1,1);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return data[0];
}
Program: 175070
Project: 175070
Buggy source:
public int readPixel(int x,int y,int band){
  if (x < 0 || y < 0 || x > xSize || y > ySize) {
    return -1;
  }
  stride[1]=1;
  stride[0]=1;
  dims[1]=1;
  dims[0]=1;
  starts[1]=x;
  starts[0]=y;
  try {
    Object o2=imagedata.read();
    return Array.getInt(o2,0) & 0xFFFF;
  }
 catch (  Exception ex) {
    logger.error(null,ex);
    return 0;
  }
}

Fixed version (ground truth):
public long readPixel(int x,int y,int band){
  if (x < 0 || y < 0 || x > xSize || y > ySize) {
    return -1;
  }
  stride[1]=1;
  stride[0]=1;
  dims[1]=1;
  dims[0]=1;
  starts[1]=x;
  starts[0]=y;
  try {
    Object o2=imagedata.read();
    return Array.getInt(o2,0) & 0xFFFF;
  }
 catch (  Exception ex) {
    logger.error(null,ex);
    return 0;
  }
}
Program: 175071
Project: 175071
Buggy source:
@Override public int readPixel(int x,int y,int band){
  int result=0;
  long temp=0;
  byte[] pixelByte=new byte[2];
  if (x >= 0 & y >= 0 & x < xSize & y < ySize) {
    try {
      temp=(y * (xOffset + xSize * 2) + xOffset + x * 2);
      fss.seek(temp + offsetBand);
      fss.read(pixelByte,0,2);
      int interm1=pixelByte[0];
      int interm2=pixelByte[1];
      result=((interm1) << 8 | interm2 & 0xff);
    }
 catch (    IOException e) {
      logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  int result=0;
  long temp=0;
  byte[] pixelByte=new byte[2];
  if (x >= 0 & y >= 0 & x < xSize & y < ySize) {
    try {
      temp=(y * (xOffset + xSize * 2) + xOffset + x * 2);
      fss.seek(temp + offsetBand);
      fss.read(pixelByte,0,2);
      int interm1=pixelByte[0];
      int interm2=pixelByte[1];
      result=((interm1) << 8 | interm2 & 0xff);
    }
 catch (    IOException e) {
      logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
    }
  }
  return result;
}
Program: 175072
Project: 175072
Buggy source:
@Override public int readPixel(int x,int y,int band){
  int result=0;
  long temp=0;
  byte[] pixelByte=new byte[4];
  if (x >= 0 & y >= 0 & x < xSize & y < ySize) {
    try {
      temp=(y * (xOffset + xSize * 4) + xOffset + x * 4);
      fss.seek(temp + offsetBand);
      fss.read(pixelByte,0,4);
      byte interm0=pixelByte[0];
      byte interm1=pixelByte[1];
      byte interm2=pixelByte[2];
      byte interm3=pixelByte[3];
      long real=((interm0) << 8) | (interm1 & 0xFF);
      long img=((interm2) << 8) | (interm3 & 0xFF);
      result=(int)Math.sqrt(real * real + img * img);
    }
 catch (    IOException e) {
      logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  int result=0;
  long temp=0;
  byte[] pixelByte=new byte[4];
  if (x >= 0 & y >= 0 & x < xSize & y < ySize) {
    try {
      temp=(y * (xOffset + xSize * 4) + xOffset + x * 4);
      fss.seek(temp + offsetBand);
      fss.read(pixelByte,0,4);
      byte interm0=pixelByte[0];
      byte interm1=pixelByte[1];
      byte interm2=pixelByte[2];
      byte interm3=pixelByte[3];
      long real=((interm0) << 8) | (interm1 & 0xFF);
      long img=((interm2) << 8) | (interm3 & 0xFF);
      result=(int)Math.sqrt(real * real + img * img);
    }
 catch (    IOException e) {
      logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
    }
  }
  return result;
}
Program: 175073
Project: 175073
Buggy source:
@Override public int readPixel(int x,int y,int band){
  int result=0;
  long temp=0;
  byte[] pixelByte=new byte[2];
  if (x >= 0 & y >= 0 & x < xSize & y < ySize) {
    if (numberOfBytes == 2) {
      try {
        temp=(y * (xOffset + xSize * 2) + xOffset + x * 2);
        dat.seek(temp + offsetImage);
        dat.read(pixelByte,0,2);
        int interm1=pixelByte[0];
        int interm2=pixelByte[1];
        result=((interm1 & 0xff) << 8 | interm2 & 0xff);
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
      }
    }
 else {
      try {
        temp=(y * (xOffset + xSize) + xOffset + x);
        dat.seek(temp + offsetImage);
        dat.read(pixelByte,0,1);
        result=pixelByte[0];
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  int result=0;
  long temp=0;
  byte[] pixelByte=new byte[2];
  if (x >= 0 & y >= 0 & x < xSize & y < ySize) {
    if (numberOfBytes == 2) {
      try {
        temp=(y * (xOffset + xSize * 2) + xOffset + x * 2);
        dat.seek(temp + offsetImage);
        dat.read(pixelByte,0,2);
        int interm1=pixelByte[0];
        int interm2=pixelByte[1];
        result=((interm1 & 0xff) << 8 | interm2 & 0xff);
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
      }
    }
 else {
      try {
        temp=(y * (xOffset + xSize) + xOffset + x);
        dat.seek(temp + offsetImage);
        dat.read(pixelByte,0,1);
        result=pixelByte[0];
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str",e);
      }
    }
  }
  return result;
}
Program: 175074
Project: 175074
Buggy source:
@Override public int readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  t.setSourceRegion(new Rectangle(x,y,1,1));
  TIFF tiff=getImage(band);
  try {
    return tiff.read(0,t).getRGB(x,y);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
  return -1;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  t.setSourceRegion(new Rectangle(x,y,1,1));
  TIFF tiff=getImage(band);
  try {
    return tiff.read(0,t).getRGB(x,y);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
  return -1;
}
Program: 175075
Project: 175075
Buggy source:
@Override public int readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(bounds);
  t.setSourceRegion(rect);
  TIFF tiff=getImage(band);
  try {
    int img=tiff.read(0,t).getRaster().getSample(0,0,1);
    int real=tiff.read(0,t).getRaster().getSample(0,0,0);
    return (int)Math.sqrt(real * real + img * img);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
catch (  ArrayIndexOutOfBoundsException ex) {
    logger.warn(ex.getMessage());
    ex.printStackTrace();
  }
catch (  IllegalArgumentException iae) {
    logger.warn(iae.getMessage());
  }
 finally {
  }
  return -1;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(bounds);
  t.setSourceRegion(rect);
  TIFF tiff=getImage(band);
  try {
    int img=tiff.read(0,t).getRaster().getSample(0,0,1);
    int real=tiff.read(0,t).getRaster().getSample(0,0,0);
    return (int)Math.sqrt(real * real + img * img);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
catch (  ArrayIndexOutOfBoundsException ex) {
    logger.warn(ex.getMessage());
    ex.printStackTrace();
  }
catch (  IllegalArgumentException iae) {
    logger.warn(iae.getMessage());
  }
 finally {
  }
  return -1;
}
Program: 175076
Project: 175076
Buggy source:
@Override public int[] getAmbiguityCorrection(final int xPos,final int yPos){
  orbitInclination=FastMath.toRadians(getSatelliteOrbitInclination());
  double temp, deltaAzimuth, deltaRange;
  int[] output=new int[2];
  try {
    double incidenceAngle=getIncidence(xPos);
    double[] lonlat=geotransform.getGeoFromPixel(xPos,yPos);
    double slantRange=getSlanteRange(lonlat[0],lonlat[1]);
    double prf=getPRF(xPos,yPos);
    double sampleDistAzim=getPixelsize()[1];
    double sampleDistRange=getPixelsize()[0];
    temp=(getRadarWaveLenght() * slantRange * prf) / (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));
    deltaAzimuth=temp / sampleDistAzim;
    deltaRange=(temp * temp) / (2 * slantRange * sampleDistRange* FastMath.sin(incidenceAngle));
    output[0]=(int)FastMath.floor(deltaAzimuth);
    output[1]=(int)FastMath.floor(deltaRange);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str" + ex.getMessage(),ex);
  }
  return output;
}

Fixed version (ground truth):
@Override public int[] getAmbiguityCorrection(final int xPos,final int yPos){
  orbitInclination=FastMath.toRadians(getSatelliteOrbitInclination());
  double temp, deltaAzimuth, deltaRange;
  int[] output=new int[2];
  try {
    double incidenceAngle=getIncidence(xPos);
    double[] lonlat=geotransform.getGeoFromPixel(xPos,yPos);
    double slantRange=getSlanteRange(lonlat[1],lonlat[0]);
    double prf=getPRF(xPos,yPos);
    double sampleDistAzim=getPixelsize()[1];
    double sampleDistRange=getPixelsize()[0];
    temp=(getRadarWaveLenght() * slantRange * prf) / (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));
    deltaAzimuth=temp / sampleDistAzim;
    deltaRange=(temp * temp) / (2 * slantRange * sampleDistRange* FastMath.sin(incidenceAngle));
    output[0]=(int)FastMath.floor(deltaAzimuth);
    output[1]=(int)FastMath.floor(deltaRange);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str" + ex.getMessage(),ex);
  }
  return output;
}
Program: 175077
Project: 175077
Buggy source:
@Override public int[] getAmbiguityCorrection(final int xPos,final int yPos){
  orbitInclination=FastMath.toRadians(getSatelliteOrbitInclination());
  double temp, deltaAzimuth, deltaRange;
  int[] output=new int[2];
  try {
    double incidenceAngle=getIncidence(xPos);
    double[] lonlat=geotransform.getGeoFromPixel(xPos,yPos);
    double slantRange=getSlanteRange(lonlat[0],lonlat[1]);
    double prf=getPRF(xPos,yPos);
    double sampleDistAzim=getPixelsize()[1];
    double sampleDistRange=getPixelsize()[0];
    temp=(getRadarWaveLenght() * slantRange * prf) / (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));
    deltaAzimuth=temp / sampleDistAzim;
    deltaRange=(temp * temp) / (2 * slantRange * sampleDistRange* FastMath.sin(incidenceAngle));
    output[0]=(int)FastMath.floor(deltaAzimuth);
    output[1]=(int)FastMath.floor(deltaRange);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str" + ex.getMessage(),ex);
  }
  return output;
}

Fixed version (ground truth):
@Override public int[] getAmbiguityCorrection(final int xPos,final int yPos){
  orbitInclination=FastMath.toRadians(getSatelliteOrbitInclination());
  double temp, deltaAzimuth, deltaRange;
  int[] output=new int[2];
  try {
    double incidenceAngle=getIncidence(xPos);
    double[] lonlat=geotransform.getGeoFromPixel(xPos,yPos);
    double slantRange=getSlanteRange(lonlat[1],lonlat[0]);
    double prf=getPRF(xPos,yPos);
    double sampleDistAzim=getPixelsize()[1];
    double sampleDistRange=getPixelsize()[0];
    temp=(getRadarWaveLenght() * slantRange * prf) / (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));
    deltaAzimuth=temp / sampleDistAzim;
    deltaRange=(temp * temp) / (2 * slantRange * sampleDistRange* FastMath.sin(incidenceAngle));
    output[0]=(int)FastMath.floor(deltaAzimuth);
    output[1]=(int)FastMath.floor(deltaRange);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str" + ex.getMessage(),ex);
  }
  return output;
}
Program: 175078
Project: 175078
Buggy source:
public MaskGeometries(String maskName,List<Geometry> maskGeometries,String fileName){
  this.maskName=maskName;
  this.maskGeometries=maskGeometries;
  intersectedMapCache=new HashMap<String,Boolean>();
  includesMapCache=new HashMap<String,Boolean>();
  this.fileName=fileName;
}

Fixed version (ground truth):
public MaskGeometries(String maskName,List<Geometry> maskGeometries,String fileName){
  this.maskName=maskName;
  this.maskGeometries=maskGeometries;
  intersectedMapCache=new HashMap<String,Boolean>();
  includesMapCache=new HashMap<String,Boolean>();
  this.fileName=fileName;
  splitMultiPolygons();
}
Program: 175079
Project: 175079
Buggy source:
/** 
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public int[] getRasterDataMask(int x,int y,int w,int h,int offsetX,int offsetY,double scalingFactor){
  Rectangle rect=new Rectangle(x,y,w,h);
  BufferedImage bi=this.rasterize(rect,offsetX,offsetY,scalingFactor);
  Raster rastermask=bi.getData();
  int[] maskdata=rastermask.getPixels(0,0,rastermask.getWidth(),rastermask.getHeight(),(int[])null);
  return maskdata;
}

Fixed version (ground truth):
/** 
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public int[] getRasterDataMask(int x,int y,int w,int h,int offsetX,int offsetY,double scalingFactor){
  Rectangle rect=new Rectangle(x,y,w,h);
  BufferedImage bi=this.rasterize(rect,offsetX,offsetY,scalingFactor);
  Raster rastermask=bi.getData();
  int[] maskdata=rastermask.getSamples(0,0,rastermask.getWidth(),rastermask.getHeight(),0,(int[])null);
  return maskdata;
}
Program: 175080
Project: 175080
Buggy source:
/** 
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public BufferedImage rasterize(Rectangle rect,int offsetX,int offsetY,double scalingFactor){
  BufferedImage image=new BufferedImage(rect.width,rect.height,BufferedImage.TYPE_BYTE_BINARY);
  GeometryFactory gf=new GeometryFactory();
  Coordinate[] coords=new Coordinate[]{new Coordinate((int)(((double)rect.getMinX() / scalingFactor)),(int)(((double)rect.getMinY() / scalingFactor))),new Coordinate((int)(((double)rect.getMaxX() / scalingFactor)),(int)(((double)rect.getMinY() / scalingFactor))),new Coordinate((int)(((double)rect.getMaxX() / scalingFactor)),(int)(((double)rect.getMaxY() / scalingFactor))),new Coordinate((int)(((double)rect.getMinX() / scalingFactor)),(int)(((double)rect.getMaxY() / scalingFactor))),new Coordinate((int)(((double)rect.getMinX() / scalingFactor)),(int)(((double)rect.getMinY() / scalingFactor)))};
  Polygon geom=gf.createPolygon(gf.createLinearRing(coords));
  Graphics g2d=image.getGraphics();
  g2d.setColor(Color.WHITE);
  for (  Geometry p : maskGeometries) {
    if (p.intersects(geom)) {
      int[] xPoints=new int[p.getNumPoints()];
      int[] yPoints=new int[p.getNumPoints()];
      int i=0;
      for (      Coordinate c : p.getCoordinates()) {
        xPoints[i]=(int)((c.x + offsetX) * scalingFactor);
        yPoints[i]=(int)((c.y + offsetY) * scalingFactor);
        i++;
      }
      g2d.fillPolygon(xPoints,yPoints,p.getNumPoints());
    }
  }
  g2d.dispose();
  return image;
}

Fixed version (ground truth):
/** 
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public BufferedImage rasterize(Rectangle rect,int offsetX,int offsetY,double scalingFactor){
  BufferedImage image=new BufferedImage(rect.width,rect.height,BufferedImage.TYPE_BYTE_BINARY);
  GeometryFactory gf=new GeometryFactory();
  Coordinate[] coords=new Coordinate[]{new Coordinate((int)(((double)rect.getMinX() / scalingFactor)),(int)(((double)rect.getMinY() / scalingFactor))),new Coordinate((int)(((double)rect.getMaxX() / scalingFactor)),(int)(((double)rect.getMinY() / scalingFactor))),new Coordinate((int)(((double)rect.getMaxX() / scalingFactor)),(int)(((double)rect.getMaxY() / scalingFactor))),new Coordinate((int)(((double)rect.getMinX() / scalingFactor)),(int)(((double)rect.getMaxY() / scalingFactor))),new Coordinate((int)(((double)rect.getMinX() / scalingFactor)),(int)(((double)rect.getMinY() / scalingFactor)))};
  Polygon geom=gf.createPolygon(gf.createLinearRing(coords));
  Graphics g2d=image.getGraphics();
  g2d.setColor(Color.white);
  for (  Geometry p : maskGeometries) {
    if (p.intersects(geom)) {
      int[] xPoints=new int[p.getNumPoints()];
      int[] yPoints=new int[p.getNumPoints()];
      int i=0;
      for (      Coordinate c : p.getCoordinates()) {
        xPoints[i]=(int)((c.x + offsetX) * scalingFactor);
        yPoints[i]=(int)((c.y + offsetY) * scalingFactor);
        i++;
      }
      g2d.fillPolygon(xPoints,yPoints,i);
    }
  }
  g2d.dispose();
  return image;
}
Program: 175084
Project: 175084
Buggy source:
/** 
 * @param shpInput
 * @param bbox
 * @param transform
 * @return
 */
public static GeometryImage createIntersectedLayer(File shpInput,Polygon bbox,GeoTransform transform){
  GeometryImage glout=null;
  DataStore dataStore=null;
  try {
    if (shpInput != null) {
      Map<String,Serializable> params=new HashMap<String,Serializable>();
      params.put("String_Node_Str",shpInput.toURI().toURL());
      dataStore=DataStoreFinder.getDataStore(params);
      SimpleFeatureSource featureSource=(SimpleFeatureSource)dataStore.getFeatureSource(dataStore.getTypeNames()[0]);
      Polygon imageP=bbox;
      ClipProcess clip=new ClipProcess();
      SimpleFeatureCollection fc=clip.execute(featureSource.getFeatures(),imageP,true);
      if (fc.isEmpty()) {
        return null;
      }
      String[] schemaStr=createSchema(fc.getSchema().getDescriptors());
      String[] types=createTypes(fc.getSchema().getDescriptors());
      String geoName=fc.getSchema().getGeometryDescriptor().getType().getName().toString();
      boolean applayT=false;
      if (transform != null)       applayT=true;
      glout=GeometryImage.createFromSimpleGeometry(imageP,geoName,fc,schemaStr,types,applayT,transform);
      glout.setName(shpInput.getName());
    }
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
    if (dataStore != null)     dataStore.dispose();
  }
  return glout;
}

Fixed version (ground truth):
/** 
 * @param shpInput
 * @param bbox
 * @param transform
 * @return
 */
public static GeometryImage createIntersectedLayer(File shpInput,Polygon bbox,GeoTransform transform){
  GeometryImage glout=null;
  DataStore dataStore=null;
  try {
    if (shpInput != null) {
      Map<String,Serializable> params=new HashMap<String,Serializable>();
      params.put("String_Node_Str",shpInput.toURI().toURL());
      dataStore=DataStoreFinder.getDataStore(params);
      SimpleFeatureSource featureSource=(SimpleFeatureSource)dataStore.getFeatureSource(dataStore.getTypeNames()[0]);
      Polygon imageP=bbox;
      ClipProcess clip=new ClipProcess();
      SimpleFeatureCollection fc=clip.execute(featureSource.getFeatures(),imageP,true);
      if (fc.isEmpty()) {
        return null;
      }
      String[] schemaStr=createSchema(fc.getSchema().getDescriptors());
      String[] types=createTypes(fc.getSchema().getDescriptors());
      String geoName=fc.getSchema().getGeometryDescriptor().getType().getName().toString();
      boolean applayT=false;
      if (transform != null)       applayT=true;
      glout=GeometryImage.createFromSimpleGeometry(imageP,geoName,fc,schemaStr,types,applayT,transform);
      glout.setName(shpInput.getName());
      glout.splitMultiPolygons();
    }
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage(),ex);
  }
 finally {
    if (dataStore != null)     dataStore.dispose();
  }
  return glout;
}
Program: 175086
Project: 175086
Buggy source:
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(bounds);
  t.setSourceRegion(rect);
  TIFF tiff=getImage(band);
  try {
    int img=tiff.read(0,t).getRaster().getSample(0,0,1);
    int real=tiff.read(0,t).getRaster().getSample(0,0,0);
    return (int)Math.sqrt(real * real + img * img);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
catch (  ArrayIndexOutOfBoundsException ex) {
    logger.warn(ex.getMessage());
    ex.printStackTrace();
  }
catch (  IllegalArgumentException iae) {
    logger.warn(iae.getMessage());
  }
 finally {
  }
  return -1;
}

Fixed version (ground truth):
@Override public long readPixel(int x,int y,int band){
  TIFFImageReadParam t=new TIFFImageReadParam();
  Rectangle rect=new Rectangle(x,y,1,1);
  rect=rect.intersection(bounds);
  t.setSourceRegion(rect);
  TIFF tiff=getImage(band);
  try {
    int img=tiff.read(0,t).getRaster().getSample(0,0,1);
    int real=tiff.read(0,t).getRaster().getSample(0,0,0);
    return (int)Math.sqrt(real * real + img * img);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage(),ex);
  }
catch (  ArrayIndexOutOfBoundsException ex) {
    logger.warn("String_Node_Str" + ex.getMessage());
  }
catch (  IllegalArgumentException iae) {
    logger.warn("String_Node_Str" + iae.getMessage());
  }
 finally {
  }
  return -1;
}
Program: 175088
Project: 175088
Buggy source:
private boolean tryFileCache(GL gl,String file,int level,int i,int j,float xmin,float xmax,float ymin,float ymax){
  String tileId=new StringBuilder("String_Node_Str").append(level).append("String_Node_Str").append(getBandFolder(activeBand)).append("String_Node_Str").append(i).append("String_Node_Str").append(j).toString();
  Cache cacheInstance=CacheManager.getCacheInstance(activeGir.getDisplayName(activeBand));
  boolean ok=true;
  if (cacheInstance.contains(file) & !submitedTiles.contains(tileId)) {
    BufferedImage temp=null;
    try {
      try {
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
 catch (      Exception ex) {
        try {
          Thread.sleep(200);
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
        }
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
      if (temp == null) {
        ok=false;
      }
    }
 catch (    Exception ex) {
      ok=false;
      logger.warn("String_Node_Str" + file + "String_Node_Str"+ ex.getMessage());
    }
 finally {
      pngReader.dispose();
    }
    if (ok) {
      if (temp.getColorModel().getNumComponents() == 1) {
        temp=rescale.filter(temp,rescale.createCompatibleDestImage(temp,temp.getColorModel()));
      }
      Texture t=AWTTextureIO.newTexture(gl.getGLProfile(),temp,false);
      tcm.add(file,t);
      bindTexture(gl,t,xmin,xmax,ymin,ymax);
    }
  }
 else {
    ok=false;
  }
  return ok;
}

Fixed version (ground truth):
/** 
 * search for tiles in the file cache
 * @param gl
 * @param file
 * @param level
 * @param i
 * @param j
 * @param xmin
 * @param xmax
 * @param ymin
 * @param ymax
 * @return
 */
private BufferedImage tryFileCache(GL gl,String file,int level,int i,int j,float xmin,float xmax,float ymin,float ymax){
  String tileId=new StringBuilder("String_Node_Str").append(level).append("String_Node_Str").append(getBandFolder(activeBand)).append("String_Node_Str").append(i).append("String_Node_Str").append(j).toString();
  Cache cacheInstance=CacheManager.getCacheInstance(activeGir.getDisplayName(activeBand));
  BufferedImage temp=null;
  if (cacheInstance.contains(file) & !submitedTiles.contains(tileId)) {
    try {
      try {
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
 catch (      Exception ex) {
        try {
          Thread.sleep(200);
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
        }
        temp=ImageIO.read(cacheInstance.newFile(file));
      }
    }
 catch (    Exception ex) {
      logger.warn("String_Node_Str" + file + "String_Node_Str"+ ex.getMessage());
      return null;
    }
 finally {
      pngReader.dispose();
    }
    if (temp.getColorModel().getNumComponents() == 1) {
      temp=rescale.filter(temp,rescale.createCompatibleDestImage(temp,temp.getColorModel()));
    }
  }
  return temp;
}