Program: 94404
Project: 94404
Buggy source:
final public MrGeoRaster reduce(final int xfactor,final int yfactor,Aggregator aggregator,double[] nodatas) throws MrGeoRasterException {
  MrGeoRaster child=createCompatibleRaster(width / xfactor,height / yfactor);
  final int subsize=xfactor * yfactor;
  final int[] intsamples=new int[subsize];
  final float[] floatsamples=new float[subsize];
  final double[] doublesamples=new double[subsize];
  int ndx;
  for (int b=0; b < bands; b++) {
    for (int y=0; y < height; y+=yfactor) {
      for (int x=0; x < width; x+=xfactor) {
switch (datatype) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_INT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
          ndx=0;
        for (int yy=y; yy < y + yfactor; yy++) {
          for (int xx=x; xx < x + xfactor; xx++) {
            intsamples[ndx++]=getPixelInt(xx,yy,b);
          }
        }
      int intSample=aggregator.aggregate(intsamples,(int)nodatas[b]);
    child.setPixel(x / xfactor,y / yfactor,b,intSample);
  break;
case DataBuffer.TYPE_FLOAT:
ndx=0;
for (int yy=y; yy < y + yfactor; yy++) {
for (int xx=x; xx < x + xfactor; xx++) {
  floatsamples[ndx++]=getPixelInt(xx,yy,b);
}
}
float floatsample=aggregator.aggregate(floatsamples,(float)nodatas[b]);
child.setPixel(x / xfactor,y / yfactor,b,floatsample);
break;
case DataBuffer.TYPE_DOUBLE:
ndx=0;
for (int yy=y; yy < y + yfactor; yy++) {
for (int xx=x; xx < x + xfactor; xx++) {
doublesamples[ndx++]=getPixelInt(xx,yy,b);
}
}
double doublesample=aggregator.aggregate(doublesamples,nodatas[b]);
child.setPixel(x / xfactor,y / yfactor,b,doublesample);
break;
default :
throw new RasterWritable.RasterWritableException("String_Node_Str");
}
}
}
}
return child;
}

Fixed version (ground truth):
final public MrGeoRaster reduce(final int xfactor,final int yfactor,Aggregator aggregator,double[] nodatas) throws MrGeoRasterException {
  MrGeoRaster child=createCompatibleRaster(width / xfactor,height / yfactor);
  final int subsize=xfactor * yfactor;
  final int[] intsamples=new int[subsize];
  final float[] floatsamples=new float[subsize];
  final double[] doublesamples=new double[subsize];
  int ndx;
  for (int b=0; b < bands; b++) {
    for (int y=0; y < height; y+=yfactor) {
      for (int x=0; x < width; x+=xfactor) {
switch (datatype) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_INT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
          ndx=0;
        for (int yy=y; yy < y + yfactor; yy++) {
          for (int xx=x; xx < x + xfactor; xx++) {
            intsamples[ndx++]=getPixelInt(xx,yy,b);
          }
        }
      int intSample=aggregator.aggregate(intsamples,(int)nodatas[b]);
    child.setPixel(x / xfactor,y / yfactor,b,intSample);
  break;
case DataBuffer.TYPE_FLOAT:
ndx=0;
for (int yy=y; yy < y + yfactor; yy++) {
for (int xx=x; xx < x + xfactor; xx++) {
  floatsamples[ndx++]=getPixelFloat(xx,yy,b);
}
}
float floatsample=aggregator.aggregate(floatsamples,(float)nodatas[b]);
child.setPixel(x / xfactor,y / yfactor,b,floatsample);
break;
case DataBuffer.TYPE_DOUBLE:
ndx=0;
for (int yy=y; yy < y + yfactor; yy++) {
for (int xx=x; xx < x + xfactor; xx++) {
doublesamples[ndx++]=getPixelDouble(xx,yy,b);
}
}
double doublesample=aggregator.aggregate(doublesamples,nodatas[b]);
child.setPixel(x / xfactor,y / yfactor,b,doublesample);
break;
default :
throw new RasterWritable.RasterWritableException("String_Node_Str");
}
}
}
}
return child;
}