nus-yam/ex-repair huggingface dataset:
Program: 154046
Project: 154046
Buggy source:
private int nextLesserThan8Bits(int bitsToGet){
  byte b, next;
  int l=data.length - 1;
  int bp=this.bytePointer;
  if (fillOrder == 1) {
    b=data[bp];
    if (bp == l) {
      next=0x00;
    }
 else {
      next=data[bp + 1];
    }
  }
 else   if (fillOrder == 2) {
    b=flipTable[data[bp] & 0xff];
    if (bp == l) {
      next=0x00;
    }
 else {
      next=flipTable[data[bp + 1] & 0xff];
    }
  }
 else {
    throw new Error(JaiI18N.getString("String_Node_Str"));
  }
  int bitsLeft=8 - bitPointer;
  int bitsFromNextByte=bitsToGet - bitsLeft;
  int shift=bitsLeft - bitsToGet;
  int i1, i2;
  if (shift >= 0) {
    i1=(b & table1[bitsLeft]) >>> shift;
    bitPointer+=bitsToGet;
    if (bitPointer == 8) {
      bitPointer=0;
      bytePointer++;
    }
  }
 else {
    i1=(b & table1[bitsLeft]) << (-shift);
    i2=(next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte);
    i1|=i2;
    bytePointer++;
    bitPointer=bitsFromNextByte;
  }
  return i1;
}

Fixed version (ground truth):
private int nextLesserThan8Bits(int bitsToGet){
  byte b, next;
  int l=data.length - 1;
  int bp=this.bytePointer;
  if (fillOrder == 1) {
    b=data[bp];
    if (bp == l) {
      next=0x00;
    }
 else {
      next=data[bp + 1];
    }
  }
 else   if (fillOrder == 2) {
    b=flipTable[data[bp] & 0xff];
    if (bp == l) {
      next=0x00;
    }
 else {
      next=flipTable[data[bp + 1] & 0xff];
    }
  }
 else {
    throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
  }
  int bitsLeft=8 - bitPointer;
  int bitsFromNextByte=bitsToGet - bitsLeft;
  int shift=bitsLeft - bitsToGet;
  int i1, i2;
  if (shift >= 0) {
    i1=(b & table1[bitsLeft]) >>> shift;
    bitPointer+=bitsToGet;
    if (bitPointer == 8) {
      bitPointer=0;
      bytePointer++;
    }
  }
 else {
    i1=(b & table1[bitsLeft]) << (-shift);
    i2=(next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte);
    i1|=i2;
    bytePointer++;
    bitPointer=bitsFromNextByte;
  }
  return i1;
}
Program: 154047
Project: 154047
Buggy source:
private int decodeBlackCodeWord(){
  int current, entry, bits, isT, twoBits, code=-1;
  int runLength=0;
  boolean isWhite=false;
  while (!isWhite) {
    current=nextLesserThan8Bits(4);
    entry=initBlack[current];
    isT=entry & 0x0001;
    bits=(entry >>> 1) & 0x000f;
    code=(entry >>> 5) & 0x07ff;
    if (code == 100) {
      current=nextNBits(9);
      entry=black[current];
      isT=entry & 0x0001;
      bits=(entry >>> 1) & 0x000f;
      code=(entry >>> 5) & 0x07ff;
      if (bits == 12) {
        updatePointer(5);
        current=nextLesserThan8Bits(4);
        entry=additionalMakeup[current];
        bits=(entry >>> 1) & 0x07;
        code=(entry >>> 4) & 0x0fff;
        runLength+=code;
        updatePointer(4 - bits);
      }
 else       if (bits == 15) {
        throw new Error(JaiI18N.getString("String_Node_Str"));
      }
 else {
        runLength+=code;
        updatePointer(9 - bits);
        if (isT == 0) {
          isWhite=true;
        }
      }
    }
 else     if (code == 200) {
      current=nextLesserThan8Bits(2);
      entry=twoBitBlack[current];
      code=(entry >>> 5) & 0x07ff;
      runLength+=code;
      bits=(entry >>> 1) & 0x0f;
      updatePointer(2 - bits);
      isWhite=true;
    }
 else {
      runLength+=code;
      updatePointer(4 - bits);
      isWhite=true;
    }
  }
  return runLength;
}

Fixed version (ground truth):
private int decodeBlackCodeWord(){
  int current, entry, bits, isT, twoBits, code=-1;
  int runLength=0;
  boolean isWhite=false;
  while (!isWhite) {
    current=nextLesserThan8Bits(4);
    entry=initBlack[current];
    isT=entry & 0x0001;
    bits=(entry >>> 1) & 0x000f;
    code=(entry >>> 5) & 0x07ff;
    if (code == 100) {
      current=nextNBits(9);
      entry=black[current];
      isT=entry & 0x0001;
      bits=(entry >>> 1) & 0x000f;
      code=(entry >>> 5) & 0x07ff;
      if (bits == 12) {
        updatePointer(5);
        current=nextLesserThan8Bits(4);
        entry=additionalMakeup[current];
        bits=(entry >>> 1) & 0x07;
        code=(entry >>> 4) & 0x0fff;
        runLength+=code;
        updatePointer(4 - bits);
      }
 else       if (bits == 15) {
        throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
      }
 else {
        runLength+=code;
        updatePointer(9 - bits);
        if (isT == 0) {
          isWhite=true;
        }
      }
    }
 else     if (code == 200) {
      current=nextLesserThan8Bits(2);
      entry=twoBitBlack[current];
      code=(entry >>> 5) & 0x07ff;
      runLength+=code;
      bits=(entry >>> 1) & 0x0f;
      updatePointer(2 - bits);
      isWhite=true;
    }
 else {
      runLength+=code;
      updatePointer(4 - bits);
      isWhite=true;
    }
  }
  return runLength;
}
Program: 154050
Project: 154050
Buggy source:
private int decodeWhiteCodeWord(){
  int current, entry, bits, isT, twoBits, code=-1;
  int runLength=0;
  boolean isWhite=true;
  while (isWhite) {
    current=nextNBits(10);
    entry=white[current];
    isT=entry & 0x0001;
    bits=(entry >>> 1) & 0x0f;
    if (bits == 12) {
      twoBits=nextLesserThan8Bits(2);
      current=((current << 2) & 0x000c) | twoBits;
      entry=additionalMakeup[current];
      bits=(entry >>> 1) & 0x07;
      code=(entry >>> 4) & 0x0fff;
      runLength+=code;
      updatePointer(4 - bits);
    }
 else     if (bits == 0) {
      throw new Error(JaiI18N.getString("String_Node_Str"));
    }
 else     if (bits == 15) {
      throw new Error(JaiI18N.getString("String_Node_Str"));
    }
 else {
      code=(entry >>> 5) & 0x07ff;
      runLength+=code;
      updatePointer(10 - bits);
      if (isT == 0) {
        isWhite=false;
      }
    }
  }
  return runLength;
}

Fixed version (ground truth):
private int decodeWhiteCodeWord(){
  int current, entry, bits, isT, twoBits, code=-1;
  int runLength=0;
  boolean isWhite=true;
  while (isWhite) {
    current=nextNBits(10);
    entry=white[current];
    isT=entry & 0x0001;
    bits=(entry >>> 1) & 0x0f;
    if (bits == 12) {
      twoBits=nextLesserThan8Bits(2);
      current=((current << 2) & 0x000c) | twoBits;
      entry=additionalMakeup[current];
      bits=(entry >>> 1) & 0x07;
      code=(entry >>> 4) & 0x0fff;
      runLength+=code;
      updatePointer(4 - bits);
    }
 else     if (bits == 0) {
      throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
    }
 else     if (bits == 15) {
      throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
    }
 else {
      code=(entry >>> 5) & 0x07ff;
      runLength+=code;
      updatePointer(10 - bits);
      if (isT == 0) {
        isWhite=false;
      }
    }
  }
  return runLength;
}
Program: 154052
Project: 154052
Buggy source:
private void writeValuesAsFourBytes(TIFFField field) throws IOException {
  int dataType=field.getType();
  int count=field.getCount();
switch (dataType) {
case TIFFField.TIFF_BYTE:
case TIFFField.TIFF_SBYTE:
case TIFFField.TIFF_UNDEFINED:
    byte bytes[]=field.getAsBytes();
  for (int i=0; i < count; i++) {
    output.write(bytes[i]);
  }
for (int i=0; i < (4 - count); i++) {
  output.write(0);
}
break;
case TIFFField.TIFF_SHORT:
char shorts[]=field.getAsChars();
for (int i=0; i < count; i++) {
writeUnsignedShort(shorts[i]);
}
for (int i=0; i < (2 - count); i++) {
writeUnsignedShort(0);
}
break;
case TIFFField.TIFF_SSHORT:
short sshorts[]=field.getAsShorts();
for (int i=0; i < count; i++) {
writeUnsignedShort(sshorts[i]);
}
for (int i=0; i < (2 - count); i++) {
writeUnsignedShort(0);
}
break;
case TIFFField.TIFF_LONG:
writeLong(field.getAsLong(0));
break;
case TIFFField.TIFF_SLONG:
writeLong(field.getAsInt(0));
break;
case TIFFField.TIFF_FLOAT:
writeLong(Float.floatToIntBits(field.getAsFloat(0)));
break;
case TIFFField.TIFF_ASCII:
int asciiByteCount=0;
for (int i=0; i < count; i++) {
byte[] stringBytes=field.getAsString(i).getBytes();
output.write(stringBytes);
asciiByteCount+=stringBytes.length;
if (stringBytes[stringBytes.length - 1] != (byte)0) {
output.write(0);
asciiByteCount++;
}
}
for (int i=0; i < (4 - asciiByteCount); i++) {
output.write(0);
}
break;
default :
throw new Error(JaiI18N.getString("String_Node_Str"));
}
}

Fixed version (ground truth):
private void writeValuesAsFourBytes(TIFFField field) throws IOException {
  int dataType=field.getType();
  int count=field.getCount();
switch (dataType) {
case TIFFField.TIFF_BYTE:
case TIFFField.TIFF_SBYTE:
case TIFFField.TIFF_UNDEFINED:
    byte bytes[]=field.getAsBytes();
  for (int i=0; i < count; i++) {
    output.write(bytes[i]);
  }
for (int i=0; i < (4 - count); i++) {
  output.write(0);
}
break;
case TIFFField.TIFF_SHORT:
char shorts[]=field.getAsChars();
for (int i=0; i < count; i++) {
writeUnsignedShort(shorts[i]);
}
for (int i=0; i < (2 - count); i++) {
writeUnsignedShort(0);
}
break;
case TIFFField.TIFF_SSHORT:
short sshorts[]=field.getAsShorts();
for (int i=0; i < count; i++) {
writeUnsignedShort(sshorts[i]);
}
for (int i=0; i < (2 - count); i++) {
writeUnsignedShort(0);
}
break;
case TIFFField.TIFF_LONG:
writeLong(field.getAsLong(0));
break;
case TIFFField.TIFF_SLONG:
writeLong(field.getAsInt(0));
break;
case TIFFField.TIFF_FLOAT:
writeLong(Float.floatToIntBits(field.getAsFloat(0)));
break;
case TIFFField.TIFF_ASCII:
int asciiByteCount=0;
for (int i=0; i < count; i++) {
byte[] stringBytes=field.getAsString(i).getBytes();
output.write(stringBytes);
asciiByteCount+=stringBytes.length;
if (stringBytes[stringBytes.length - 1] != (byte)0) {
output.write(0);
asciiByteCount++;
}
}
for (int i=0; i < (4 - asciiByteCount); i++) {
output.write(0);
}
break;
default :
throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
}
}
Program: 154059
Project: 154059
Buggy source:
/** 
 * Validates the input parameters. <p> In addition to the standard checks performed by the superclass method, this method by default checks that the source file exists and is readable. This check may be bypassed by setting the <code>checkFileLocally</code> parameter to <code>FALSE</code>
 */
protected boolean validateParameters(ParameterBlock args,StringBuffer msg){
  if (!super.validateParameters(args,msg)) {
    return false;
  }
  Boolean checkFile=(Boolean)args.getObjectParameter(2);
  if (checkFile.booleanValue()) {
    String filename=(String)args.getObjectParameter(0);
    File f=new File(filename);
    boolean fileExists=f.exists();
    if (!fileExists) {
      InputStream is=getClass().getResourceAsStream(filename);
      if (is == null) {
        msg.append("String_Node_Str" + filename + "String_Node_Str"+ JaiI18N.getString("String_Node_Str"));
        return false;
      }
    }
 else {
      if (!f.canRead()) {
        msg.append("String_Node_Str" + filename + "String_Node_Str"+ JaiI18N.getString("String_Node_Str"));
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Validates the input parameters. <p> In addition to the standard checks performed by the superclass method, this method by default checks that the source file exists and is readable. This check may be bypassed by setting the <code>checkFileLocally</code> parameter to <code>FALSE</code>
 */
protected boolean validateParameters(ParameterBlock args,StringBuffer msg){
  if (!super.validateParameters(args,msg)) {
    return false;
  }
  Boolean checkFile=(Boolean)args.getObjectParameter(2);
  if (checkFile.booleanValue()) {
    String filename=(String)args.getObjectParameter(0);
    File f=new File(filename);
    boolean fileExists=f.exists();
    if (!fileExists) {
      InputStream is=this.getClass().getClassLoader().getResourceAsStream(filename);
      if (is == null) {
        msg.append("String_Node_Str" + filename + "String_Node_Str"+ JaiI18N.getString("String_Node_Str"));
        return false;
      }
    }
 else {
      if (!f.canRead()) {
        msg.append("String_Node_Str" + filename + "String_Node_Str"+ JaiI18N.getString("String_Node_Str"));
        return false;
      }
    }
  }
  return true;
}
Program: 154060
Project: 154060
Buggy source:
/** 
 * Sets the compression level for DEFLATE-compressed data which should either be <code>java.util.Deflater.DEFAULT_COMPRESSION</code> or a value in the range [1,9] where larger values indicate more compression. The default setting is <code>Deflater.DEFAULT_COMPRESSION</code>.  This setting is ignored if the compression type is not DEFLATE.
 */
public void setDeflateLevel(int deflateLevel){
  if (deflateLevel < 1 && deflateLevel > 9 && deflateLevel != Deflater.DEFAULT_COMPRESSION) {
    throw new Error(JaiI18N.getString("String_Node_Str"));
  }
  this.deflateLevel=deflateLevel;
}

Fixed version (ground truth):
/** 
 * Sets the compression level for DEFLATE-compressed data which should either be <code>java.util.Deflater.DEFAULT_COMPRESSION</code> or a value in the range [1,9] where larger values indicate more compression. The default setting is <code>Deflater.DEFAULT_COMPRESSION</code>.  This setting is ignored if the compression type is not DEFLATE.
 * @throws IllegalArgumentException if <code>deflateLevel</code> isnot in the range <code>[1,&nbsp;9]</code> and is not {@link Deflater#DEFAULT_COMPRESSION}.
 */
public void setDeflateLevel(int deflateLevel){
  if (deflateLevel < 1 && deflateLevel > 9 && deflateLevel != Deflater.DEFAULT_COMPRESSION) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  this.deflateLevel=deflateLevel;
}
Program: 154061
Project: 154061
Buggy source:
/** 
 * Specifies the type of compression to be used.  The compression type specified will be honored only if it is compatible with the image being written out.  Currently only PackBits, JPEG, and DEFLATE compression schemes are supported. <p> If <code>compression</code> is set to any value but <code>COMPRESSION_NONE</code> and the <code>OutputStream</code> supplied to the <code>ImageEncoder</code> is not a <code>SeekableOutputStream</code>, then the encoder will use either a temporary file or a memory cache when compressing the data depending on whether the file system is accessible.  Compression will therefore be more efficient if a <code>SeekableOutputStream</code> is supplied.
 * @param compression    The compression type.
 */
public void setCompression(int compression){
switch (compression) {
case COMPRESSION_NONE:
case COMPRESSION_GROUP3_1D:
case COMPRESSION_GROUP3_2D:
case COMPRESSION_GROUP4:
case COMPRESSION_PACKBITS:
case COMPRESSION_JPEG_TTN2:
case COMPRESSION_DEFLATE:
    break;
default :
  throw new Error(JaiI18N.getString("String_Node_Str"));
}
this.compression=compression;
}

Fixed version (ground truth):
/** 
 * Specifies the type of compression to be used.  The compression type specified will be honored only if it is compatible with the image being written out.  Currently only PackBits, JPEG, and DEFLATE compression schemes are supported. <p> If <code>compression</code> is set to any value but <code>COMPRESSION_NONE</code> and the <code>OutputStream</code> supplied to the <code>ImageEncoder</code> is not a <code>SeekableOutputStream</code>, then the encoder will use either a temporary file or a memory cache when compressing the data depending on whether the file system is accessible.  Compression will therefore be more efficient if a <code>SeekableOutputStream</code> is supplied.
 * @param compression    The compression type.
 * @throws IllegalArgumentException if <code>compression</code> isnot one of the defined <code>COMPRESSION_*</code> constants.
 */
public void setCompression(int compression){
switch (compression) {
case COMPRESSION_NONE:
case COMPRESSION_GROUP3_1D:
case COMPRESSION_GROUP3_2D:
case COMPRESSION_GROUP4:
case COMPRESSION_PACKBITS:
case COMPRESSION_JPEG_TTN2:
case COMPRESSION_DEFLATE:
    break;
default :
  throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
}
this.compression=compression;
}
Program: 154063
Project: 154063
Buggy source:
/** 
 * Returns the alpha component for the specified pixel, scaled from 0 to 255.  The pixel value is specified by an array of data elements of type <code>transferType</code> passed in as an object reference.  If the <code>ColorModel</code> does not have alpha, 255 is returned.
 * @param inData The pixel from which to get the alphacomponent, specified by an array of data elements of type <code>transferType</code>.
 * @return The alpha component for the specified pixel, as an int.
 * @throws IllegalArgumentException if <code>inData</code> is<code>null</code> and the <code>colorModel</code> has alpha.
 * @throws ClassCastException If <code>inData</code> is not aprimitive array of type <code>transferType</code> and the <code>ColorModel</code> has alpha.
 * @throws ArrayIndexOutOfBoundsException if <code>inData</code>is not large enough to hold a pixel value for this <code>ColorModel</code> and the <code>ColorModel</code> has alpha.
 */
public int getAlpha(Object inData){
  if (inData == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (hasAlpha == false) {
    return 255;
  }
  if (transferType == DataBuffer.TYPE_FLOAT) {
    float[] fdata=(float[])inData;
    return (int)(fdata[numColorComponents] * 255.0F);
  }
 else {
    double[] ddata=(double[])inData;
    return (int)(ddata[numColorComponents] * 255.0);
  }
}

Fixed version (ground truth):
/** 
 * Returns the alpha component for the specified pixel, scaled from 0 to 255.  The pixel value is specified by an array of data elements of type <code>transferType</code> passed in as an object reference.  If the <code>ColorModel</code> does not have alpha, 255 is returned.
 * @param inData The pixel from which to get the alphacomponent, specified by an array of data elements of type <code>transferType</code>.
 * @return The alpha component for the specified pixel, as an int.
 * @throws IllegalArgumentException if <code>inData</code> is<code>null</code> and the <code>colorModel</code> has alpha.
 * @throws ClassCastException If <code>inData</code> is not aprimitive array of type <code>transferType</code> and the <code>ColorModel</code> has alpha.
 * @throws ArrayIndexOutOfBoundsException if <code>inData</code>is not large enough to hold a pixel value for this <code>ColorModel</code> and the <code>ColorModel</code> has alpha.
 */
public int getAlpha(Object inData){
  if (inData == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (hasAlpha == false) {
    return 255;
  }
  if (transferType == DataBuffer.TYPE_FLOAT) {
    float[] fdata=(float[])inData;
    return (int)(fdata[numColorComponents] * 255.0F + 0.5F);
  }
 else {
    double[] ddata=(double[])inData;
    return (int)(ddata[numColorComponents] * 255.0 + 0.5);
  }
}
Program: 154070
Project: 154070
Buggy source:
/** 
 * Creates an <code>InterpAverage</code> instance having the supplied dimensions.  The <code>subsampleBitsH</code> and <code>subsampleBitsV</code> instance variables are set to 32.
 * @param blockX The width of the interpolation block.
 * @param blockY The height of the interpolation block.
 * @throws IllegalArgumentException if either parameter is non-positive.
 */
public InterpAverage(int blockX,int blockY){
  super(blockX,blockY,0,blockX - 1,0,blockY - 1,32,32);
  if (blockX <= 0 || blockY <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Creates an <code>InterpAverage</code> instance having the supplied dimensions.  The left and top padding are <code>(blockX&nbsp;-&nbsp;1)/2</code> and <code>(blockY&nbsp;-&nbsp;1)/2</code>, respectively. The <code>subsampleBitsH</code> and <code>subsampleBitsV</code> instance variables are set to 32.
 * @param blockX The width of the interpolation block.
 * @param blockY The height of the interpolation block.
 * @throws IllegalArgumentException if either parameter is non-positive.
 */
public InterpAverage(int blockX,int blockY){
  super(blockX,blockY,(blockX - 1) / 2,blockX - 1 - (blockX - 1) / 2,(blockY - 1) / 2,blockY - 1 - (blockY - 1) / 2,32,32);
  if (blockX <= 0 || blockY <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 154080
Project: 154080
Buggy source:
/** 
 * Performs a subsampling operation on a specified rectangle. The sources are cobbled.
 * @param sources  an array of source Rasters, guaranteed to provide allnecessary source data for computing the output.
 * @param dest     a WritableRaster  containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  RasterFormatTag[] formatTags=getFormatTags();
  RasterAccessor dst=new RasterAccessor(dest,destRect,formatTags[1],getColorModel());
  RasterAccessor src=new RasterAccessor(sources[0],mapDestRect(destRect,0),formatTags[0],getSourceImage(0).getColorModel());
switch (dst.getDataType()) {
case DataBuffer.TYPE_BYTE:
    computeRectByte(src,dst);
  break;
case DataBuffer.TYPE_USHORT:
computeRectUShort(src,dst);
break;
case DataBuffer.TYPE_SHORT:
computeRectShort(src,dst);
break;
case DataBuffer.TYPE_INT:
computeRectInt(src,dst);
break;
case DataBuffer.TYPE_FLOAT:
computeRectFloat(src,dst);
break;
case DataBuffer.TYPE_DOUBLE:
computeRectDouble(src,dst);
break;
default :
throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
}
if (dst.isDataCopy()) {
dst.clampDataArrays();
dst.copyDataToRaster();
}
}

Fixed version (ground truth):
/** 
 * Performs a subsampling operation on a specified rectangle. The sources are cobbled.
 * @param sources  an array of source Rasters, guaranteed to provide allnecessary source data for computing the output.
 * @param dest     a WritableRaster  containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  RasterFormatTag[] formatTags=getFormatTags();
  RasterAccessor dst=new RasterAccessor(dest,destRect,formatTags[1],getColorModel());
  Rectangle srcRect=mapDestRect(destRect,0).intersection(sources[0].getBounds());
  RasterAccessor src=new RasterAccessor(sources[0],srcRect,formatTags[0],getSourceImage(0).getColorModel());
switch (dst.getDataType()) {
case DataBuffer.TYPE_BYTE:
    computeRectByte(src,dst);
  break;
case DataBuffer.TYPE_USHORT:
computeRectUShort(src,dst);
break;
case DataBuffer.TYPE_SHORT:
computeRectShort(src,dst);
break;
case DataBuffer.TYPE_INT:
computeRectInt(src,dst);
break;
case DataBuffer.TYPE_FLOAT:
computeRectFloat(src,dst);
break;
case DataBuffer.TYPE_DOUBLE:
computeRectDouble(src,dst);
break;
default :
throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
}
if (dst.isDataCopy()) {
dst.clampDataArrays();
dst.copyDataToRaster();
}
}
Program: 154081
Project: 154081
Buggy source:
/** 
 * Computes a tile of the destination image in the destination color space.
 * @param sources   Cobbled sources, guaranteed to provide all thesource data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  WritableRaster tempRas=null;
switch (caseNumber) {
case 1:
    tempRas=computeRectColorSpaceJAIToRGB(sources[0],srcParam,null,tempParam);
  computeRectColorSpaceJAIFromRGB(tempRas,tempParam,dest,dstParam);
break;
case 2:
tempRas=computeRectColorSpaceJAIToRGB(sources[0],srcParam,null,tempParam);
computeRectNonColorSpaceJAI(tempRas,tempParam,dest,dstParam,destRect);
break;
case 3:
computeRectColorSpaceJAIToRGB(sources[0],srcParam,dest,dstParam);
break;
case 4:
tempRas=createTempWritableRaster(sources[0]);
computeRectNonColorSpaceJAI(sources[0],srcParam,tempRas,tempParam,destRect);
computeRectColorSpaceJAIFromRGB(tempRas,tempParam,dest,dstParam);
break;
case 5:
computeRectColorSpaceJAIFromRGB(sources[0],srcParam,dest,dstParam);
break;
case 6:
computeRectNonColorSpaceJAI(sources[0],srcParam,dest,dstParam,destRect);
default :
break;
}
}

Fixed version (ground truth):
/** 
 * Computes a tile of the destination image in the destination color space.
 * @param sources   Cobbled sources, guaranteed to provide all thesource data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  WritableRaster tempRas=null;
  Raster source=sources[0];
  if (!destRect.equals(source.getBounds())) {
    source=source.createChild(destRect.x,destRect.y,destRect.width,destRect.height,destRect.x,destRect.y,null);
  }
switch (caseNumber) {
case 1:
    tempRas=computeRectColorSpaceJAIToRGB(source,srcParam,null,tempParam);
  computeRectColorSpaceJAIFromRGB(tempRas,tempParam,dest,dstParam);
break;
case 2:
tempRas=computeRectColorSpaceJAIToRGB(source,srcParam,null,tempParam);
computeRectNonColorSpaceJAI(tempRas,tempParam,dest,dstParam,destRect);
break;
case 3:
computeRectColorSpaceJAIToRGB(source,srcParam,dest,dstParam);
break;
case 4:
tempRas=createTempWritableRaster(source);
computeRectNonColorSpaceJAI(source,srcParam,tempRas,tempParam,destRect);
computeRectColorSpaceJAIFromRGB(tempRas,tempParam,dest,dstParam);
break;
case 5:
computeRectColorSpaceJAIFromRGB(source,srcParam,dest,dstParam);
break;
case 6:
computeRectNonColorSpaceJAI(source,srcParam,dest,dstParam,destRect);
default :
break;
}
}
Program: 154083
Project: 154083
Buggy source:
/** 
 * Return min of <code>maxOffset</code> or offset of first pixel different from pixel at <code>bitOffset</code>.
 */
private int nextState(byte[] data,int base,int bitOffset,int maxOffset){
  if (data == null) {
    return maxOffset;
  }
  int next=base + (bitOffset >>> 3);
  int end=base + (maxOffset >>> 3);
  if (end == data.length) {
    end--;
  }
  int extra=bitOffset & 0x7;
  int testbyte;
  if ((data[next] & (0x80 >>> extra)) != 0) {
    testbyte=~(data[next]) & (0xff >>> extra);
    while (next < end) {
      if (testbyte != 0) {
        break;
      }
      testbyte=~(data[++next]) & 0xff;
    }
  }
 else {
    if ((testbyte=(data[next] & (0xff >>> extra))) != 0) {
      bitOffset=(next - base) * 8 + byteTable[testbyte];
      return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
    }
    while (next < end) {
      if ((testbyte=data[++next] & 0xff) != 0) {
        bitOffset=(next - base) * 8 + byteTable[testbyte];
        return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
      }
    }
  }
  bitOffset=(next - base) * 8 + byteTable[testbyte];
  return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
}

Fixed version (ground truth):
/** 
 * Return min of <code>maxOffset</code> or offset of first pixel different from pixel at <code>bitOffset</code>.
 */
private int nextState(byte[] data,int base,int bitOffset,int maxOffset){
  if (data == null) {
    return maxOffset;
  }
  int next=base + (bitOffset >>> 3);
  if (next >= data.length) {
    return maxOffset;
  }
  int end=base + (maxOffset >>> 3);
  if (end == data.length) {
    end--;
  }
  int extra=bitOffset & 0x7;
  int testbyte;
  if ((data[next] & (0x80 >>> extra)) != 0) {
    testbyte=~(data[next]) & (0xff >>> extra);
    while (next < end) {
      if (testbyte != 0) {
        break;
      }
      testbyte=~(data[++next]) & 0xff;
    }
  }
 else {
    if ((testbyte=(data[next] & (0xff >>> extra))) != 0) {
      bitOffset=(next - base) * 8 + byteTable[testbyte];
      return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
    }
    while (next < end) {
      if ((testbyte=data[++next] & 0xff) != 0) {
        bitOffset=(next - base) * 8 + byteTable[testbyte];
        return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
      }
    }
  }
  bitOffset=(next - base) * 8 + byteTable[testbyte];
  return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
}
Program: 154085
Project: 154085
Buggy source:
/** 
 * Defines a checkerboard image of several grey shades. 
 */
public CheckerboardOpImage(int minX,int minY,int width,int height,SampleModel sampleModel,TileCache cache,ImageLayout layout,int checkerSize,int numColors){
  super(minX,minY,width,height,sampleModel,cache,layout);
  if (numColors < 2) {
    numColors=2;
  }
  this.checkerSize=checkerSize;
  this.numColors=numColors;
switch (sampleModel.getTransferType()) {
case DataBuffer.TYPE_BYTE:
    increment=255 / (numColors - 1);
  break;
case DataBuffer.TYPE_USHORT:
increment=65535 / (numColors - 1);
break;
case DataBuffer.TYPE_SHORT:
increment=Short.MAX_VALUE / (numColors - 1);
break;
case DataBuffer.TYPE_INT:
increment=Integer.MAX_VALUE / (numColors - 1);
break;
}
}

Fixed version (ground truth):
/** 
 * Defines a checkerboard image of several grey shades. 
 */
public CheckerboardOpImage(int minX,int minY,int width,int height,SampleModel sampleModel,Map configuration,ImageLayout layout,int checkerSize,int numColors){
  super(layout,configuration,sampleModel,minX,minY,width,height);
  if (numColors < 2) {
    numColors=2;
  }
  this.checkerSize=checkerSize;
  this.numColors=numColors;
switch (sampleModel.getTransferType()) {
case DataBuffer.TYPE_BYTE:
    increment=255 / (numColors - 1);
  break;
case DataBuffer.TYPE_USHORT:
increment=65535 / (numColors - 1);
break;
case DataBuffer.TYPE_SHORT:
increment=Short.MAX_VALUE / (numColors - 1);
break;
case DataBuffer.TYPE_INT:
increment=Integer.MAX_VALUE / (numColors - 1);
break;
}
}
Program: 154086
Project: 154086
Buggy source:
public static OpImage createRandomOpImage(ImageLayout layout){
  return new RandomOpImage(0,0,800,800,RasterFactory.createPixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,200,200,3),null,layout);
}

Fixed version (ground truth):
public static OpImage createRandomOpImage(Map configuration,ImageLayout layout){
  return new RandomOpImage(0,0,800,800,RasterFactory.createPixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,200,200,3),configuration,layout);
}
Program: 154087
Project: 154087
Buggy source:
/** 
 * Print out the pixel values of the destination image within a specific rectangle, and all of its source image(s) pixel values within the cooresponding rectangle obtained by calling <code>OpImage.mapDestRect()</code>.
 * @param dst      The destination image to be tested.
 * @param dstRect  The rectangle of interest within dst.
 */
public static void testOpImage(OpImage dst,Rectangle dstRect){
  for (int i=0; i < dst.getNumSources(); i++) {
    PlanarImage src=dst.getSource(i);
    Rectangle srcRect=dst.mapDestRect(dstRect,i);
    String message="String_Node_Str" + (i + 1) + "String_Node_Str";
    printPixels(message,src,srcRect);
  }
  printPixels("String_Node_Str",dst,dstRect);
}

Fixed version (ground truth):
/** 
 * Print out the pixel values of the destination image within a specific rectangle, and all of its source image(s) pixel values within the cooresponding rectangle obtained by calling <code>OpImage.mapDestRect()</code>.
 * @param dst      The destination image to be tested.
 * @param dstRect  The rectangle of interest within dst.
 */
public static void testOpImage(OpImage dst,Rectangle dstRect){
  for (int i=0; i < dst.getNumSources(); i++) {
    PlanarImage src=dst.getSourceImage(i);
    Rectangle srcRect=dst.mapDestRect(dstRect,i);
    String message="String_Node_Str" + (i + 1) + "String_Node_Str";
    printPixels(message,src,srcRect);
  }
  printPixels("String_Node_Str",dst,dstRect);
}
Program: 154088
Project: 154088
Buggy source:
public RampOpImage(int minX,int minY,int width,int height,SampleModel sampleModel,TileCache cache,ImageLayout layout){
  super(minX,minY,width,height,sampleModel,cache,layout);
}

Fixed version (ground truth):
public RampOpImage(int minX,int minY,int width,int height,SampleModel sampleModel,Map configuration,ImageLayout layout){
  super(layout,configuration,sampleModel,minX,minY,width,height);
}
Program: 154089
Project: 154089
Buggy source:
public RandomOpImage(int minX,int minY,int width,int height,SampleModel sampleModel,TileCache cache,ImageLayout layout){
  super(minX,minY,width,height,sampleModel,cache,layout);
switch (this.transtype=sampleModel.getTransferType()) {
case DataBuffer.TYPE_BYTE:
    maxValue=255;
  break;
case DataBuffer.TYPE_USHORT:
maxValue=65535;
break;
case DataBuffer.TYPE_SHORT:
maxValue=Short.MAX_VALUE;
break;
case DataBuffer.TYPE_INT:
maxValue=Integer.MAX_VALUE;
break;
}
for (int y=getMinTileY(); y <= getMaxTileY(); y++) {
for (int x=getMinTileX(); x <= getMaxTileX(); x++) {
getTile(x,y);
}
}
}

Fixed version (ground truth):
public RandomOpImage(int minX,int minY,int width,int height,SampleModel sampleModel,Map configuration,ImageLayout layout){
  super(layout,configuration,sampleModel,minX,minY,width,height);
switch (this.transtype=sampleModel.getTransferType()) {
case DataBuffer.TYPE_BYTE:
    maxValue=255;
  break;
case DataBuffer.TYPE_USHORT:
maxValue=65535;
break;
case DataBuffer.TYPE_SHORT:
maxValue=Short.MAX_VALUE;
break;
case DataBuffer.TYPE_INT:
maxValue=Integer.MAX_VALUE;
break;
}
for (int y=getMinTileY(); y <= getMaxTileY(); y++) {
for (int x=getMinTileX(); x <= getMaxTileX(); x++) {
getTile(x,y);
}
}
}
Program: 154090
Project: 154090
Buggy source:
/** 
 * Creates a new instance of RandomOpImage in the rendered layer. This method satisfies the implementation of RIF.
 */
public RenderedImage create(ParameterBlock paramBlock,RenderingHints renderHints){
  ImageLayout layout=RIFUtil.getImageLayoutHint(renderHints);
  TileCache cache=RIFUtil.getTileCacheHint(renderHints);
  return new RandomOpImage(cache,OpImageTester.setLayout(layout));
}

Fixed version (ground truth):
/** 
 * Creates a new instance of RandomOpImage in the rendered layer. This method satisfies the implementation of RIF.
 */
public RenderedImage create(ParameterBlock paramBlock,RenderingHints renderHints){
  ImageLayout layout=(renderHints == null) ? null : (ImageLayout)renderHints.get(JAI.KEY_IMAGE_LAYOUT);
  return OpImageTester.createRandomOpImage(renderHints,layout);
}
Program: 154093
Project: 154093
Buggy source:
/** 
 * Merge one <code>RenderingHints</code> into another.
 * @param defaultHints The default <code>RenderingHints</code>.
 * @param hints The superseding <code>RenderingHints</code>; hints inthis mapping take precedence over any in <code>defaultHints</code>.
 */
static RenderingHints mergeRenderingHints(RenderingHints defaultHints,RenderingHints hints){
  RenderingHints mergedHints;
  if (hints == null || hints.isEmpty()) {
    mergedHints=defaultHints;
  }
 else   if (defaultHints == null || defaultHints.isEmpty()) {
    mergedHints=hints;
  }
 else {
    mergedHints=new RenderingHints(defaultHints);
    mergedHints.add(hints);
  }
  return mergedHints;
}

Fixed version (ground truth):
/** 
 * Merge one <code>RenderingHints</code> into another.
 * @param defaultHints The default <code>RenderingHints</code>.
 * @param hints The superseding <code>RenderingHints</code>; hints inthis mapping take precedence over any in <code>defaultHints</code>.
 */
static RenderingHints mergeRenderingHints(RenderingHints defaultHints,RenderingHints hints){
  RenderingHints mergedHints;
  if (hints == null || hints.isEmpty()) {
    mergedHints=defaultHints;
  }
 else   if (defaultHints == null || defaultHints.isEmpty()) {
    mergedHints=hints;
  }
 else {
    mergedHints=new RenderingHints((Map)defaultHints);
    mergedHints.add(hints);
  }
  return mergedHints;
}
Program: 154096
Project: 154096
Buggy source:
protected Rectangle backwardMapRect(Rectangle destRect,int sourceIndex){
  if (destRect == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
 else   if (sourceIndex != 0) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  int x1=sourceMinX + (int)Math.floor((destRect.x - minX) / scaleX + 0.5);
  int y1=sourceMinY + (int)Math.floor((destRect.y - minY) / scaleY + 0.5);
  int x2=x1 + (destRect.width - 1) * blockX;
  int y2=y1 + (destRect.height - 1) * blockY;
  return new Rectangle(x1,y1,x2 - x1 + 1,y2 - y1 + 1);
}

Fixed version (ground truth):
protected Rectangle backwardMapRect(Rectangle destRect,int sourceIndex){
  if (destRect == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
 else   if (sourceIndex != 0) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  Point2D p1=mapDestPoint(new Point2D.Double(destRect.x,destRect.y));
  Point2D p2=mapDestPoint(new Point2D.Double(destRect.x + destRect.width - 1,destRect.y + destRect.height - 1));
  int x1=(int)Math.floor(p1.getX());
  int y1=(int)Math.floor(p1.getY());
  int x2=(int)Math.floor(p2.getX());
  int y2=(int)Math.floor(p2.getY());
  return new Rectangle(x1,y1,x2 - x1 + 1,y2 - y1 + 1);
}
Program: 154097
Project: 154097
Buggy source:
protected Rectangle forwardMapRect(Rectangle sourceRect,int sourceIndex){
  if (sourceRect == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
 else   if (sourceIndex != 0) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  return new Rectangle(minX + (int)Math.floor((sourceRect.x - sourceMinX) * scaleX),minY + (int)Math.floor((sourceRect.y - sourceMinY) * scaleY),(int)Math.ceil(sourceRect.width * scaleX),(int)Math.ceil(sourceRect.height * scaleY));
}

Fixed version (ground truth):
protected Rectangle forwardMapRect(Rectangle sourceRect,int sourceIndex){
  if (sourceRect == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
 else   if (sourceIndex != 0) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  Point2D p1=mapSourcePoint(new Point2D.Double(sourceRect.x,sourceRect.y));
  Point2D p2=mapSourcePoint(new Point2D.Double(sourceRect.x + sourceRect.width - 1,sourceRect.y + sourceRect.height - 1));
  int x1=(int)Math.floor(p1.getX());
  int y1=(int)Math.floor(p1.getY());
  int x2=(int)Math.floor(p2.getX());
  int y2=(int)Math.floor(p2.getY());
  return new Rectangle(x1,y1,x2 - x1 + 1,y2 - y1 + 1);
}
Program: 154098
Project: 154098
Buggy source:
public Point2D mapSourcePoint(Point2D sourcePt){
  if (sourcePt == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Point2D pt=(Point2D)sourcePt.clone();
  pt.setLocation(minX + (sourcePt.getX() - sourceMinX) * scaleX,minY + (sourcePt.getY() - sourceMinY) * scaleY);
  return pt;
}

Fixed version (ground truth):
public Point2D mapSourcePoint(Point2D sourcePt){
  if (sourcePt == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Point2D pt=(Point2D)sourcePt.clone();
  pt.setLocation(minX + (sourcePt.getX() + 0.5 - sourceMinX) * scaleX - 0.5,minY + (sourcePt.getY() + 0.5 - sourceMinY) * scaleY - 0.5);
  return pt;
}
Program: 154099
Project: 154099
Buggy source:
public Point2D mapDestPoint(Point2D destPt){
  if (destPt == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Point2D pt=(Point2D)destPt.clone();
  pt.setLocation(sourceMinX + (destPt.getX() - minX) / scaleX,sourceMinY + (destPt.getY() - minY) / scaleY);
  return pt;
}

Fixed version (ground truth):
public Point2D mapDestPoint(Point2D destPt){
  if (destPt == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Point2D pt=(Point2D)destPt.clone();
  pt.setLocation(sourceMinX + (destPt.getX() + 0.5 - minX) / scaleX - 0.5,sourceMinY + (destPt.getY() + 0.5 - minY) / scaleY - 0.5);
  return pt;
}
Program: 154101
Project: 154101
Buggy source:
private byte[] decodePackbits(byte data[],int arraySize,byte[] dst){
  if (dst == null) {
    dst=new byte[arraySize];
  }
  int srcCount=0, dstCount=0;
  byte repeat, b;
  try {
    while (dstCount < arraySize) {
      b=data[srcCount++];
      if (b >= 0 && b <= 127) {
        for (int i=0; i < (b + 1); i++) {
          dst[dstCount++]=data[srcCount++];
        }
      }
 else       if (b <= -1 && b >= -127) {
        repeat=data[srcCount++];
        for (int i=0; i < (-b + 1); i++) {
          dst[dstCount++]=repeat;
        }
      }
 else {
        srcCount++;
      }
    }
  }
 catch (  java.lang.ArrayIndexOutOfBoundsException ae) {
    String message=JaiI18N.getString("String_Node_Str");
    ImagingListenerProxy.errorOccurred(message,new ImagingException(message,ae),this,false);
  }
  return dst;
}

Fixed version (ground truth):
private byte[] decodePackbits(byte data[],int arraySize,byte[] dst){
  if (dst == null) {
    dst=new byte[arraySize];
  }
  int srcCount=0, dstCount=0;
  int srcArraySize=data.length;
  byte repeat, b;
  try {
    while (dstCount < arraySize && srcCount < srcArraySize) {
      b=data[srcCount++];
      if (b >= 0 && b <= 127) {
        for (int i=0; i < (b + 1); i++) {
          dst[dstCount++]=data[srcCount++];
        }
      }
 else       if (b <= -1 && b >= -127) {
        repeat=data[srcCount++];
        for (int i=0; i < (-b + 1); i++) {
          dst[dstCount++]=repeat;
        }
      }
 else {
        srcCount++;
      }
    }
  }
 catch (  java.lang.ArrayIndexOutOfBoundsException ae) {
    String message=JaiI18N.getString("String_Node_Str");
    ImagingListenerProxy.errorOccurred(message,new ImagingException(message,ae),this,false);
  }
  return dst;
}
Program: 154102
Project: 154102
Buggy source:
/** 
 * Creates a new instance of <code>MlibConvolveOpImage</code> in the rendered image mode.
 * @param args  The source image and convolution kernel.
 * @param hints  May contain rendering hints and destination image layout.
 */
public RenderedImage create(ParameterBlock args,RenderingHints hints){
  ImageLayout layout=RIFUtil.getImageLayoutHint(hints);
  if (!MediaLibAccessor.isMediaLibCompatible(args,layout) || !MediaLibAccessor.hasSameNumBands(args,layout)) {
    return null;
  }
  BorderExtender extender=RIFUtil.getBorderExtenderHint(hints);
  RenderedImage source=args.getRenderedSource(0);
  KernelJAI unRotatedKernel=(KernelJAI)args.getObjectParameter(0);
  KernelJAI kJAI=unRotatedKernel.getRotatedKernel();
  int kWidth=kJAI.getWidth();
  int kHeight=kJAI.getHeight();
  if (kWidth < 2 || kHeight < 2) {
    return null;
  }
  boolean centered=(kWidth == kJAI.getXOrigin() * 2 + 1) && (kHeight == kJAI.getYOrigin() * 2 + 1);
  if (kJAI.isSeparable() && kWidth >= 3 && kWidth <= 7 && kWidth == kHeight) {
    return new MlibSeparableConvolveOpImage(source,extender,hints,layout,kJAI);
  }
 else   if ((kWidth == 3 && kHeight == 3) || (kWidth == 5 && kHeight == 5)) {
    return new MlibConvolve3x3Or5x5OpImage(source,extender,hints,layout,kJAI);
  }
 else {
    return new MlibConvolveOpImage(source,extender,hints,layout,kJAI);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance of <code>MlibConvolveOpImage</code> in the rendered image mode.
 * @param args  The source image and convolution kernel.
 * @param hints  May contain rendering hints and destination image layout.
 */
public RenderedImage create(ParameterBlock args,RenderingHints hints){
  ImageLayout layout=RIFUtil.getImageLayoutHint(hints);
  if (!MediaLibAccessor.isMediaLibCompatible(args,layout) || !MediaLibAccessor.hasSameNumBands(args,layout)) {
    return null;
  }
  BorderExtender extender=RIFUtil.getBorderExtenderHint(hints);
  RenderedImage source=args.getRenderedSource(0);
  KernelJAI unRotatedKernel=(KernelJAI)args.getObjectParameter(0);
  KernelJAI kJAI=unRotatedKernel.getRotatedKernel();
  int kWidth=kJAI.getWidth();
  int kHeight=kJAI.getHeight();
  if (kWidth < 2 || kHeight < 2) {
    return null;
  }
  if (kJAI.isSeparable() && (kWidth == kHeight) && (kWidth == 3 || kWidth == 5 || kWidth == 7)) {
    return new MlibSeparableConvolveOpImage(source,extender,hints,layout,kJAI);
  }
 else   if ((kWidth == kHeight) && (kWidth == 2 || kWidth == 3 || kWidth == 4 || kWidth == 5 || kWidth == 7)) {
    return new MlibConvolveNxNOpImage(source,extender,hints,layout,kJAI);
  }
 else {
    return new MlibConvolveOpImage(source,extender,hints,layout,kJAI);
  }
}
Program: 154103
Project: 154103
Buggy source:
/** 
 * Creates a new instance of <code>MlibConvolveOpImage</code> in the rendered image mode.
 * @param args  The source image and convolution kernel.
 * @param hints  May contain rendering hints and destination image layout.
 */
public RenderedImage create(ParameterBlock args,RenderingHints hints){
  ImageLayout layout=RIFUtil.getImageLayoutHint(hints);
  if (!MediaLibAccessor.isMediaLibCompatible(args,layout) || !MediaLibAccessor.hasSameNumBands(args,layout)) {
    return null;
  }
  BorderExtender extender=RIFUtil.getBorderExtenderHint(hints);
  RenderedImage source=args.getRenderedSource(0);
  KernelJAI unRotatedKernel=ImageUtil.getUnsharpMaskEquivalentKernel((KernelJAI)args.getObjectParameter(0),args.getFloatParameter(1));
  KernelJAI kJAI=unRotatedKernel.getRotatedKernel();
  int kWidth=kJAI.getWidth();
  int kHeight=kJAI.getHeight();
  if (kWidth < 2 || kHeight < 2) {
    return null;
  }
  if (kJAI.isSeparable() && kWidth >= 3 && kWidth <= 7 && kWidth == kHeight) {
    return new MlibSeparableConvolveOpImage(source,extender,hints,layout,kJAI);
  }
 else   if ((kWidth == 3 && kHeight == 3) || (kWidth == 5 && kHeight == 5)) {
    return new MlibConvolve3x3Or5x5OpImage(source,extender,hints,layout,kJAI);
  }
 else {
    return new MlibConvolveOpImage(source,extender,hints,layout,kJAI);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance of <code>MlibConvolveOpImage</code> in the rendered image mode.
 * @param args  The source image and convolution kernel.
 * @param hints  May contain rendering hints and destination image layout.
 */
public RenderedImage create(ParameterBlock args,RenderingHints hints){
  ImageLayout layout=RIFUtil.getImageLayoutHint(hints);
  if (!MediaLibAccessor.isMediaLibCompatible(args,layout) || !MediaLibAccessor.hasSameNumBands(args,layout)) {
    return null;
  }
  BorderExtender extender=RIFUtil.getBorderExtenderHint(hints);
  RenderedImage source=args.getRenderedSource(0);
  KernelJAI unRotatedKernel=ImageUtil.getUnsharpMaskEquivalentKernel((KernelJAI)args.getObjectParameter(0),args.getFloatParameter(1));
  KernelJAI kJAI=unRotatedKernel.getRotatedKernel();
  int kWidth=kJAI.getWidth();
  int kHeight=kJAI.getHeight();
  if (kWidth < 2 || kHeight < 2) {
    return null;
  }
  if (kJAI.isSeparable() && kWidth >= 3 && kWidth <= 7 && kWidth == kHeight) {
    return new MlibSeparableConvolveOpImage(source,extender,hints,layout,kJAI);
  }
 else   if ((kWidth == 3 && kHeight == 3) || (kWidth == 5 && kHeight == 5)) {
    return new MlibConvolveNxNOpImage(source,extender,hints,layout,kJAI);
  }
 else {
    return new MlibConvolveOpImage(source,extender,hints,layout,kJAI);
  }
}
Program: 154105
Project: 154105
Buggy source:
/** 
 * Returns one of the available statistics as a property. 
 */
public Object getProperty(String name){
  int numBands=sampleModel.getNumBands();
  if ("String_Node_Str".equals(name)) {
    if (colorMap == null)     train();
    return colorMap;
  }
  return super.getProperty(name);
}

Fixed version (ground truth):
/** 
 * Returns one of the available statistics as a property. 
 */
public Object getProperty(String name){
  int numBands=sampleModel.getNumBands();
  if (name.equals("String_Node_Str") || name.equals("String_Node_Str")) {
    if (colorMap == null)     train();
    return colorMap;
  }
  return super.getProperty(name);
}