Program: 11154
Project: 11154
Buggy source:
private void replaceValues(ByteBuffer buffer,Dimension bufferSize,Rectangle replaceRegion,int bufferBandCount,int bufferType,int bufferTypeSize,boolean floatingPoint,MinMaxArray[] minMaxs,NullableNumberArray replacement,NullableNumberArray otherwise) throws TilerException {
  if (minMaxs == null || minMaxs.length == 0)   return;
  if (replacement == null && otherwise == null)   return;
  for (int i=0; i < minMaxs.length; i++)   if (minMaxs[i].length() != bufferBandCount)   throw new IllegalArgumentException("String_Node_Str");
  if ((replacement != null && replacement.length() != bufferBandCount) || (otherwise != null && otherwise.length() != bufferBandCount))   throw new IllegalArgumentException("String_Node_Str");
  boolean allNull=true;
  for (int b=0; b < bufferBandCount; b++) {
    if ((replacement != null && replacement.getDouble(b) != null) || (otherwise != null && otherwise.getDouble(b) != null)) {
      allNull=false;
      break;
    }
  }
  if (allNull) {
    return;
  }
  double[] doubleValues=new double[bufferBandCount];
  long[] longValues=new long[bufferBandCount];
  int[] indices=new int[bufferBandCount];
  for (int y=replaceRegion.y; y < replaceRegion.height; y++) {
    for (int x=replaceRegion.x; x < replaceRegion.width; x++) {
      boolean between=false;
      for (int b=0; b < bufferBandCount; b++) {
        indices[b]=getBufferIndex(x,y,b,bufferSize.width,bufferSize.height) * bufferTypeSize;
        if (floatingPoint)         doubleValues[b]=getDoubleValue(indices[b],buffer,bufferType);
 else         longValues[b]=getLongValue(indices[b],buffer,bufferType);
      }
      for (int i=0; i < minMaxs.length; i++) {
        if (minMaxs[i] != null) {
          if (floatingPoint)           between=minMaxs[i].isBetweenDouble(doubleValues);
 else           between=minMaxs[i].isBetweenLong(longValues);
          if (between)           break;
        }
      }
      NullableNumberArray values=between ? replacement : otherwise;
      if (values != null) {
        for (int b=0; b < bufferBandCount; b++) {
          if (values.getDouble(b) != null) {
            if (floatingPoint)             putDoubleValue(indices[b],buffer,bufferType,values.getDouble(b));
 else             putLongValue(indices[b],buffer,bufferType,values.getLong(b));
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void replaceValues(ByteBuffer buffer,Dimension bufferSize,Rectangle replaceRegion,int bufferBandCount,int bufferType,int bufferTypeSize,boolean floatingPoint,MinMaxArray[] minMaxs,NullableNumberArray replacement,NullableNumberArray otherwise) throws TilerException {
  if (minMaxs == null || minMaxs.length == 0)   return;
  if (replacement == null && otherwise == null)   return;
  for (int i=0; i < minMaxs.length; i++)   if (minMaxs[i].length() != bufferBandCount)   throw new IllegalArgumentException("String_Node_Str");
  if ((replacement != null && replacement.length() != bufferBandCount) || (otherwise != null && otherwise.length() != bufferBandCount))   throw new IllegalArgumentException("String_Node_Str");
  boolean allNull=true;
  for (int b=0; b < bufferBandCount; b++) {
    if ((replacement != null && replacement.getDouble(b) != null) || (otherwise != null && otherwise.getDouble(b) != null)) {
      allNull=false;
      break;
    }
  }
  if (allNull) {
    return;
  }
  double[] doubleValues=new double[bufferBandCount];
  long[] longValues=new long[bufferBandCount];
  int[] indices=new int[bufferBandCount];
  for (int y=replaceRegion.y; y < replaceRegion.y + replaceRegion.height; y++) {
    for (int x=replaceRegion.x; x < replaceRegion.x + replaceRegion.width; x++) {
      boolean between=false;
      for (int b=0; b < bufferBandCount; b++) {
        indices[b]=getBufferIndex(x,y,b,bufferSize.width,bufferSize.height) * bufferTypeSize;
        if (floatingPoint)         doubleValues[b]=getDoubleValue(indices[b],buffer,bufferType);
 else         longValues[b]=getLongValue(indices[b],buffer,bufferType);
      }
      for (int i=0; i < minMaxs.length; i++) {
        if (minMaxs[i] != null) {
          if (floatingPoint)           between=minMaxs[i].isBetweenDouble(doubleValues);
 else           between=minMaxs[i].isBetweenLong(longValues);
          if (between)           break;
        }
      }
      NullableNumberArray values=between ? replacement : otherwise;
      if (values != null) {
        for (int b=0; b < bufferBandCount; b++) {
          if (values.getDouble(b) != null) {
            if (floatingPoint)             putDoubleValue(indices[b],buffer,bufferType,values.getDouble(b));
 else             putLongValue(indices[b],buffer,bufferType,values.getLong(b));
          }
        }
      }
    }
  }
}