Program: 11011
Project: 11011
Buggy source:
@Override public FastShape end(URL context){
  validateProperties();
  if (axisN == null) {
    if (axisD == null || axisMIN == null || axisMAX == null) {
      return null;
    }
    double nx=(axisMAX.x - axisMIN.x) / axisD.x + 1;
    double ny=(axisMAX.y - axisMIN.y) / axisD.y + 1;
    double nz=(axisMAX.z - axisMIN.z) / axisD.z + 1;
    axisN=new Vec4(nx,ny,nz);
  }
  Vec4 axisUStride=axisU.multiply3((axisMAX.x - axisMIN.x) / (axisN.x - 1));
  Vec4 axisVStride=axisV.multiply3((axisMAX.y - axisMIN.y) / (axisN.y - 1));
  Vec4 axisWStride=axisW.multiply3((axisMAX.z - axisMIN.z) / (axisN.z - 1));
  Vec4 origin=calculateAxisOrigin();
  int[] strides=calculateStrides();
  long[] axisN=calculateAxisN();
  int[] samples=calculateSamples(strides,axisN);
  List<Position> positions=new ArrayList<Position>();
  float[] values=createValuesArray(samples);
  double[] transformed=new double[3];
  float[] minmax=new float[]{Float.MAX_VALUE,-Float.MAX_VALUE};
  try {
    URL fileUrl=new URL(context,file);
    InputStream is=new BufferedInputStream(fileUrl.openStream());
    FloatReader reader=FloatReader.Builder.newFloatReaderForStream(is).withOffset(offset).withFormat(FloatFormat.valueOf(etype)).withByteOrder(parameters.getByteOrder()).build();
    float[] floatValue=new float[1];
    if (parameters.isBilinearMinification()) {
      int[] count=new int[values.length];
      for (int w=0; w < axisN[W]; w++) {
        int wRegion=(w / strides[W]) * samples[V] * samples[U];
        for (int v=0; v < axisN[V]; v++) {
          int vRegion=(v / strides[V]) * samples[U];
          for (int u=0; u < axisN[U]; u++) {
            reader.readNextValues(floatValue);
            if (!Float.isNaN(floatValue[0]) && floatValue[0] != noDataValue) {
              int uRegion=(u / strides[U]);
              int valueIndex=wRegion + vRegion + uRegion;
              if (count[valueIndex] == 0) {
                values[valueIndex]=floatValue[0];
              }
 else {
                values[valueIndex]+=floatValue[0];
              }
              count[valueIndex]++;
            }
          }
        }
      }
      normaliseValues(values,minmax,count);
      for (int w=0, wi=0; w < axisN[W]; w+=strides[W], wi++) {
        int wOffset=wi * samples[V] * samples[U];
        Vec4 wAdd=axisWStride.multiply3(w);
        for (int v=0, vi=0; v < axisN[V]; v+=strides[V], vi++) {
          int vOffset=vi * samples[U];
          Vec4 vAdd=axisVStride.multiply3(v);
          for (int u=0, ui=0; u < axisN[U]; u+=strides[U], ui++) {
            int uOffset=ui;
            int valueIndex=wOffset + vOffset + uOffset;
            float value=values[valueIndex];
            if (!Float.isNaN(value)) {
              Vec4 uAdd=axisUStride.multiply3(u);
              Vec4 point=new Vec4(origin.x + uAdd.x + vAdd.x+ wAdd.x,origin.y + uAdd.y + vAdd.y+ wAdd.y,origin.z + uAdd.z + vAdd.z+ wAdd.z);
              positions.add(createPositionFromPoint(transformed,point));
            }
          }
        }
      }
    }
 else {
      int valueIndex=0;
      for (int w=0; w < axisN[W]; w+=strides[W]) {
        Vec4 wAdd=axisWStride.multiply3(w);
        for (int v=0; v < axisN[V]; v+=strides[V]) {
          Vec4 vAdd=axisVStride.multiply3(v);
          for (int u=0; u < axisN[U]; u+=strides[U]) {
            reader.readNextValues(floatValue);
            if (!Float.isNaN(floatValue[0]) && floatValue[0] != noDataValue) {
              values[valueIndex]=floatValue[0];
              minmax[0]=Math.min(minmax[0],floatValue[0]);
              minmax[1]=Math.max(minmax[1],floatValue[0]);
              Vec4 uAdd=axisUStride.multiply3(u);
              Vec4 point=new Vec4(origin.x + uAdd.x + vAdd.x+ wAdd.x,origin.y + uAdd.y + vAdd.y+ wAdd.y,origin.z + uAdd.z + vAdd.z+ wAdd.z);
              positions.add(createPositionFromPoint(transformed,point));
            }
            valueIndex++;
            reader.skip(esize * Math.min(strides[U] - 1,axisN[U] - u - 1));
          }
          reader.skip(esize * axisN[U] * Math.min(strides[V] - 1,axisN[V] - v - 1));
        }
        reader.skip(esize * axisN[U] * axisN[V]* Math.min(strides[W] - 1,axisN[W] - w - 1));
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
  FloatBuffer colorBuffer=createColorBuffer(values,minmax);
  if (name == null) {
    name="String_Node_Str";
  }
  FastShape shape=new FastShape(positions,GL2.GL_POINTS);
  shape.setName(name);
  shape.setColorBuffer(colorBuffer.array());
  shape.setColorBufferElementSize(4);
  shape.setForceSortedPrimitives(true);
  shape.setFollowTerrain(true);
  return shape;
}

Fixed version (ground truth):
@Override public FastShape end(URL context){
  validateProperties();
  if (axisN == null) {
    if (axisD == null || axisMIN == null || axisMAX == null) {
      return null;
    }
    double nx=(axisMAX.x - axisMIN.x) / axisD.x + 1;
    double ny=(axisMAX.y - axisMIN.y) / axisD.y + 1;
    double nz=(axisMAX.z - axisMIN.z) / axisD.z + 1;
    axisN=new Vec4(nx,ny,nz);
  }
  Vec4 axisUStride=axisU.multiply3((axisMAX.x - axisMIN.x) / (axisN.x > 1 ? axisN.x - 1 : 1));
  Vec4 axisVStride=axisV.multiply3((axisMAX.y - axisMIN.y) / (axisN.y > 1 ? axisN.y - 1 : 1));
  Vec4 axisWStride=axisW.multiply3((axisMAX.z - axisMIN.z) / (axisN.z > 1 ? axisN.z - 1 : 1));
  Vec4 origin=calculateAxisOrigin();
  int[] strides=calculateStrides();
  long[] axisN=calculateAxisN();
  int[] samples=calculateSamples(strides,axisN);
  List<Position> positions=new ArrayList<Position>();
  float[] values=createValuesArray(samples);
  double[] transformed=new double[3];
  float[] minmax=new float[]{Float.MAX_VALUE,-Float.MAX_VALUE};
  try {
    URL fileUrl=new URL(context,file);
    InputStream is=new BufferedInputStream(fileUrl.openStream());
    FloatReader reader=FloatReader.Builder.newFloatReaderForStream(is).withOffset(offset).withFormat(FloatFormat.valueOf(etype)).withByteOrder(parameters.getByteOrder()).build();
    float[] floatValue=new float[1];
    if (parameters.isBilinearMinification()) {
      int[] count=new int[values.length];
      for (int w=0; w < axisN[W]; w++) {
        int wRegion=(w / strides[W]) * samples[V] * samples[U];
        for (int v=0; v < axisN[V]; v++) {
          int vRegion=(v / strides[V]) * samples[U];
          for (int u=0; u < axisN[U]; u++) {
            reader.readNextValues(floatValue);
            if (!Float.isNaN(floatValue[0]) && floatValue[0] != noDataValue) {
              int uRegion=(u / strides[U]);
              int valueIndex=wRegion + vRegion + uRegion;
              if (count[valueIndex] == 0) {
                values[valueIndex]=floatValue[0];
              }
 else {
                values[valueIndex]+=floatValue[0];
              }
              count[valueIndex]++;
            }
          }
        }
      }
      normaliseValues(values,minmax,count);
      for (int w=0, wi=0; w < axisN[W]; w+=strides[W], wi++) {
        int wOffset=wi * samples[V] * samples[U];
        Vec4 wAdd=axisWStride.multiply3(w);
        for (int v=0, vi=0; v < axisN[V]; v+=strides[V], vi++) {
          int vOffset=vi * samples[U];
          Vec4 vAdd=axisVStride.multiply3(v);
          for (int u=0, ui=0; u < axisN[U]; u+=strides[U], ui++) {
            int uOffset=ui;
            int valueIndex=wOffset + vOffset + uOffset;
            float value=values[valueIndex];
            if (!Float.isNaN(value)) {
              Vec4 uAdd=axisUStride.multiply3(u);
              Vec4 point=new Vec4(origin.x + uAdd.x + vAdd.x+ wAdd.x,origin.y + uAdd.y + vAdd.y+ wAdd.y,origin.z + uAdd.z + vAdd.z+ wAdd.z);
              positions.add(createPositionFromPoint(transformed,point));
            }
          }
        }
      }
    }
 else {
      int valueIndex=0;
      for (int w=0; w < axisN[W]; w+=strides[W]) {
        Vec4 wAdd=axisWStride.multiply3(w);
        for (int v=0; v < axisN[V]; v+=strides[V]) {
          Vec4 vAdd=axisVStride.multiply3(v);
          for (int u=0; u < axisN[U]; u+=strides[U]) {
            reader.readNextValues(floatValue);
            if (!Float.isNaN(floatValue[0]) && floatValue[0] != noDataValue) {
              values[valueIndex]=floatValue[0];
              minmax[0]=Math.min(minmax[0],floatValue[0]);
              minmax[1]=Math.max(minmax[1],floatValue[0]);
              Vec4 uAdd=axisUStride.multiply3(u);
              Vec4 point=new Vec4(origin.x + uAdd.x + vAdd.x+ wAdd.x,origin.y + uAdd.y + vAdd.y+ wAdd.y,origin.z + uAdd.z + vAdd.z+ wAdd.z);
              positions.add(createPositionFromPoint(transformed,point));
            }
            valueIndex++;
            reader.skip(esize * Math.min(strides[U] - 1,axisN[U] - u - 1));
          }
          reader.skip(esize * axisN[U] * Math.min(strides[V] - 1,axisN[V] - v - 1));
        }
        reader.skip(esize * axisN[U] * axisN[V]* Math.min(strides[W] - 1,axisN[W] - w - 1));
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
  FloatBuffer colorBuffer=createColorBuffer(values,minmax);
  if (name == null) {
    name="String_Node_Str";
  }
  FastShape shape=new FastShape(positions,GL2.GL_POINTS);
  shape.setName(name);
  shape.setColorBuffer(colorBuffer.array());
  shape.setColorBufferElementSize(4);
  shape.setForceSortedPrimitives(true);
  shape.setFollowTerrain(true);
  return shape;
}