nus-yam/ex-repair huggingface dataset:
Program: 92902
Project: 92902
Buggy source:
/** 
 * Ensures that the buffered bytes extend to cover the specified index. If not, an attempt is made to read to that point. <p/> If the stream ends before the point is reached, a   {@link BufferBoundsException} is raised.
 * @param index the index from which the required bytes start
 * @param bytesRequested the number of bytes which are required
 * @throws IOException if the stream ends before the required number of bytes are acquired
 */
protected abstract void validateIndex(int index,int bytesRequested) throws IOException ;

Fixed version (ground truth):
/** 
 * Ensures that the buffered bytes extend to cover the specified index. If not, an attempt is made to read to that point. <p> If the stream ends before the point is reached, a   {@link BufferBoundsException} is raised.
 * @param index the index from which the required bytes start
 * @param bytesRequested the number of bytes which are required
 * @throws IOException if the stream ends before the required number of bytes are acquired
 */
protected abstract void validateIndex(int index,int bytesRequested) throws IOException ;
Program: 92903
Project: 92903
Buggy source:
/** 
 * <p> Simplifies the   {@link Rational} number.</p><p> Prime number series: 1, 2, 3, 5, 7, 9, 11, 13, 17</p> <p> To reduce a rational, need to see if both numerator and denominator are divisible by a common factor.  Using the prime number series in ascending order guarantees the minimum number of checks required.</p> <p> However, generating the prime number series seems to be a hefty task.  Perhaps it's simpler to check if both d & n are divisible by all numbers from 2 -> (Math.min(denominator, numerator) / 2).  In doing this, one can check for 2 and 5 once, then ignore all even numbers, and all numbers ending in 0 or 5. This leaves four numbers from every ten to check.</p> <p> Therefore, the max number of pairs of modulus divisions required will be:</p> <code><pre> 4   Math.min(denominator, numerator) - 1 -- * ------------------------------------ + 2 10                    2 <p/> Math.min(denominator, numerator) - 1 = ------------------------------------ + 2 5 </pre></code>
 * @return a simplified instance, or if the Rational could not be simplified,returns itself (unchanged)
 */
@NotNull public Rational getSimplifiedInstance(){
  if (tooComplexForSimplification()) {
    return this;
  }
  for (int factor=2; factor <= Math.min(_denominator,_numerator); factor++) {
    if ((factor % 2 == 0 && factor > 2) || (factor % 5 == 0 && factor > 5)) {
      continue;
    }
    if (_denominator % factor == 0 && _numerator % factor == 0) {
      return new Rational(_numerator / factor,_denominator / factor);
    }
  }
  return this;
}

Fixed version (ground truth):
/** 
 * <p> Simplifies the   {@link Rational} number.</p><p> Prime number series: 1, 2, 3, 5, 7, 9, 11, 13, 17</p> <p> To reduce a rational, need to see if both numerator and denominator are divisible by a common factor.  Using the prime number series in ascending order guarantees the minimum number of checks required.</p> <p> However, generating the prime number series seems to be a hefty task.  Perhaps it's simpler to check if both d &amp; n are divisible by all numbers from 2  {@literal ->}(Math.min(denominator, numerator) / 2).  In doing this, one can check for 2 and 5 once, then ignore all even numbers, and all numbers ending in 0 or 5. This leaves four numbers from every ten to check.</p> <p> Therefore, the max number of pairs of modulus divisions required will be:</p> <pre><code> 4   Math.min(denominator, numerator) - 1 -- * ------------------------------------ + 2 10                    2 Math.min(denominator, numerator) - 1 = ------------------------------------ + 2 5 </code></pre>
 * @return a simplified instance, or if the Rational could not be simplified,returns itself (unchanged)
 */
@NotNull public Rational getSimplifiedInstance(){
  if (tooComplexForSimplification()) {
    return this;
  }
  for (int factor=2; factor <= Math.min(_denominator,_numerator); factor++) {
    if ((factor % 2 == 0 && factor > 2) || (factor % 5 == 0 && factor > 5)) {
      continue;
    }
    if (_denominator % factor == 0 && _numerator % factor == 0) {
      return new Rational(_numerator / factor,_denominator / factor);
    }
  }
  return this;
}
Program: 92904
Project: 92904
Buggy source:
/** 
 * Gets a s15.16 fixed point float from the buffer. <p/> This particular fixed point encoding has one sign bit, 15 numerator bits and 16 denominator bits.
 * @return the floating point value
 * @throws IOException the buffer does not contain enough bytes to service the request
 */
public float getS15Fixed16() throws IOException {
  if (_isMotorolaByteOrder) {
    float res=(getByte() & 0xFF) << 8 | (getByte() & 0xFF);
    int d=(getByte() & 0xFF) << 8 | (getByte() & 0xFF);
    return (float)(res + d / 65536.0);
  }
 else {
    int d=(getByte() & 0xFF) | (getByte() & 0xFF) << 8;
    float res=(getByte() & 0xFF) | (getByte() & 0xFF) << 8;
    return (float)(res + d / 65536.0);
  }
}

Fixed version (ground truth):
/** 
 * Gets a s15.16 fixed point float from the buffer. <p> This particular fixed point encoding has one sign bit, 15 numerator bits and 16 denominator bits.
 * @return the floating point value
 * @throws IOException the buffer does not contain enough bytes to service the request
 */
public float getS15Fixed16() throws IOException {
  if (_isMotorolaByteOrder) {
    float res=(getByte() & 0xFF) << 8 | (getByte() & 0xFF);
    int d=(getByte() & 0xFF) << 8 | (getByte() & 0xFF);
    return (float)(res + d / 65536.0);
  }
 else {
    int d=(getByte() & 0xFF) | (getByte() & 0xFF) << 8;
    float res=(getByte() & 0xFF) | (getByte() & 0xFF) << 8;
    return (float)(res + d / 65536.0);
  }
}
Program: 92905
Project: 92905
Buggy source:
/** 
 * Returns the specified tag's value as a java.util.Date.  If the value is unset or cannot be converted, <code>null</code> is returned. <p/> If the underlying value is a   {@link String}, then attempts will be made to parse the string as though it is in the   {@link TimeZone} represented by the {@code timeZone} parameter (if it is non-null).  Note that this parameteris only considered if the underlying value is a string and parsing occurs, otherwise it has no effect.
 */
@Nullable public java.util.Date getDate(int tagType,@Nullable TimeZone timeZone){
  Object o=getObject(tagType);
  if (o == null)   return null;
  if (o instanceof java.util.Date)   return (java.util.Date)o;
  if (o instanceof String) {
    String datePatterns[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    String dateString=(String)o;
    for (    String datePattern : datePatterns) {
      try {
        DateFormat parser=new SimpleDateFormat(datePattern);
        if (timeZone != null)         parser.setTimeZone(timeZone);
        return parser.parse(dateString);
      }
 catch (      ParseException ex) {
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the specified tag's value as a java.util.Date.  If the value is unset or cannot be converted, <code>null</code> is returned. <p> If the underlying value is a   {@link String}, then attempts will be made to parse the string as though it is in the   {@link TimeZone} represented by the {@code timeZone} parameter (if it is non-null).  Note that this parameteris only considered if the underlying value is a string and parsing occurs, otherwise it has no effect.
 */
@Nullable public java.util.Date getDate(int tagType,@Nullable TimeZone timeZone){
  Object o=getObject(tagType);
  if (o == null)   return null;
  if (o instanceof java.util.Date)   return (java.util.Date)o;
  if (o instanceof String) {
    String datePatterns[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    String dateString=(String)o;
    for (    String datePattern : datePatterns) {
      try {
        DateFormat parser=new SimpleDateFormat(datePattern);
        if (timeZone != null)         parser.setTimeZone(timeZone);
        return parser.parse(dateString);
      }
 catch (      ParseException ex) {
      }
    }
  }
  return null;
}
Program: 92906
Project: 92906
Buggy source:
/** 
 * Takes a series of 4 bytes from the specified offset, and converts these to a well-known version number, where possible. <p/> Two different formats are processed: <ul> <li>[30 32 31 30] -&gt; 2.10</li> <li>[0 1 0 0] -&gt; 1.00</li> </ul>
 * @param components  the four version values
 * @param majorDigits the number of components to be
 * @return the version as a string of form "2.10" or null if the argument cannot be converted
 */
@Nullable public static String convertBytesToVersionString(@Nullable int[] components,final int majorDigits){
  if (components == null)   return null;
  StringBuilder version=new StringBuilder();
  for (int i=0; i < 4 && i < components.length; i++) {
    if (i == majorDigits)     version.append('.');
    char c=(char)components[i];
    if (c < '0')     c+='0';
    if (i == 0 && c == '0')     continue;
    version.append(c);
  }
  return version.toString();
}

Fixed version (ground truth):
/** 
 * Takes a series of 4 bytes from the specified offset, and converts these to a well-known version number, where possible. <p> Two different formats are processed: <ul> <li>[30 32 31 30] -&gt; 2.10</li> <li>[0 1 0 0] -&gt; 1.00</li> </ul>
 * @param components  the four version values
 * @param majorDigits the number of components to be
 * @return the version as a string of form "2.10" or null if the argument cannot be converted
 */
@Nullable public static String convertBytesToVersionString(@Nullable int[] components,final int majorDigits){
  if (components == null)   return null;
  StringBuilder version=new StringBuilder();
  for (int i=0; i < 4 && i < components.length; i++) {
    if (i == majorDigits)     version.append('.');
    char c=(char)components[i];
    if (c < '0')     c+='0';
    if (i == 0 && c == '0')     continue;
    version.append(c);
  }
  return version.toString();
}
Program: 92907
Project: 92907
Buggy source:
@Nullable public String getCompressionDescription(){
  try {
    Integer value=_directory.getInt(BmpHeaderDirectory.TAG_COMPRESSION);
    if (value == null)     return null;
    Integer headerSize=_directory.getInt(BmpHeaderDirectory.TAG_HEADER_SIZE);
    if (headerSize == null)     return null;
switch (value) {
case 0:
      return "String_Node_Str";
case 1:
    return "String_Node_Str";
case 2:
  return "String_Node_Str";
case 3:
return headerSize == 64 ? "String_Node_Str" : "String_Node_Str";
case 4:
return headerSize == 64 ? "String_Node_Str" : "String_Node_Str";
case 5:
return "String_Node_Str";
case 6:
return "String_Node_Str";
default :
return super.getDescription(BmpHeaderDirectory.TAG_COMPRESSION);
}
}
 catch (Exception e) {
return null;
}
}

Fixed version (ground truth):
@Nullable public String getCompressionDescription(){
  try {
    Integer value=_directory.getInteger(BmpHeaderDirectory.TAG_COMPRESSION);
    if (value == null)     return null;
    Integer headerSize=_directory.getInteger(BmpHeaderDirectory.TAG_HEADER_SIZE);
    if (headerSize == null)     return null;
switch (value) {
case 0:
      return "String_Node_Str";
case 1:
    return "String_Node_Str";
case 2:
  return "String_Node_Str";
case 3:
return headerSize == 64 ? "String_Node_Str" : "String_Node_Str";
case 4:
return headerSize == 64 ? "String_Node_Str" : "String_Node_Str";
case 5:
return "String_Node_Str";
case 6:
return "String_Node_Str";
default :
return super.getDescription(BmpHeaderDirectory.TAG_COMPRESSION);
}
}
 catch (Exception e) {
return null;
}
}
Program: 92908
Project: 92908
Buggy source:
@Nullable public String getImageWidthDescription(){
  try {
    Integer value=_directory.getInt(PsdHeaderDirectory.TAG_IMAGE_WIDTH);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public String getImageWidthDescription(){
  try {
    Integer value=_directory.getInteger(PsdHeaderDirectory.TAG_IMAGE_WIDTH);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 92909
Project: 92909
Buggy source:
@Nullable public String getColorModeDescription(){
  try {
    Integer value=_directory.getInt(PsdHeaderDirectory.TAG_COLOR_MODE);
    if (value == null)     return null;
switch (value) {
case 0:
      return "String_Node_Str";
case 1:
    return "String_Node_Str";
case 2:
  return "String_Node_Str";
case 3:
return "String_Node_Str";
case 4:
return "String_Node_Str";
case 7:
return "String_Node_Str";
case 8:
return "String_Node_Str";
case 9:
return "String_Node_Str";
default :
return "String_Node_Str" + value + "String_Node_Str";
}
}
 catch (Exception e) {
return null;
}
}

Fixed version (ground truth):
@Nullable public String getColorModeDescription(){
  try {
    Integer value=_directory.getInteger(PsdHeaderDirectory.TAG_COLOR_MODE);
    if (value == null)     return null;
switch (value) {
case 0:
      return "String_Node_Str";
case 1:
    return "String_Node_Str";
case 2:
  return "String_Node_Str";
case 3:
return "String_Node_Str";
case 4:
return "String_Node_Str";
case 7:
return "String_Node_Str";
case 8:
return "String_Node_Str";
case 9:
return "String_Node_Str";
default :
return "String_Node_Str" + value + "String_Node_Str";
}
}
 catch (Exception e) {
return null;
}
}
Program: 92910
Project: 92910
Buggy source:
@Nullable public String getImageHeightDescription(){
  try {
    Integer value=_directory.getInt(PsdHeaderDirectory.TAG_IMAGE_HEIGHT);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public String getImageHeightDescription(){
  try {
    Integer value=_directory.getInteger(PsdHeaderDirectory.TAG_IMAGE_HEIGHT);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 92911
Project: 92911
Buggy source:
@Nullable public String getChannelCountDescription(){
  try {
    Integer value=_directory.getInt(PsdHeaderDirectory.TAG_CHANNEL_COUNT);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public String getChannelCountDescription(){
  try {
    Integer value=_directory.getInteger(PsdHeaderDirectory.TAG_CHANNEL_COUNT);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 92912
Project: 92912
Buggy source:
@Nullable public String getBitsPerChannelDescription(){
  try {
    Integer value=_directory.getInt(PsdHeaderDirectory.TAG_BITS_PER_CHANNEL);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str";
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public String getBitsPerChannelDescription(){
  try {
    Integer value=_directory.getInteger(PsdHeaderDirectory.TAG_BITS_PER_CHANNEL);
    if (value == null)     return null;
    return value + "String_Node_Str" + (value == 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str";
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 92913
Project: 92913
Buggy source:
@After public void deleteTempFile() throws IOException {
  if (_tempFile == null && _randomAccessFile == null)   return;
  _randomAccessFile.close();
  assertTrue("String_Node_Str" + _tempFile.getAbsolutePath(),_tempFile.delete());
  _tempFile=null;
  _randomAccessFile=null;
}

Fixed version (ground truth):
@After public void deleteTempFile() throws IOException {
  if (_randomAccessFile == null)   return;
  _randomAccessFile.close();
  if (_tempFile == null)   return;
  assertTrue("String_Node_Str" + _tempFile.getAbsolutePath(),_tempFile.delete());
  _tempFile=null;
  _randomAccessFile=null;
}
Program: 92914
Project: 92914
Buggy source:
@Test public void testSetAndGetIntArray() throws Exception {
  int[] inputValues={1,2,3,4,5,6,7,8,9,10};
  int tagType=123;
  _directory.setIntArray(tagType,inputValues);
  int[] outputValues=_directory.getIntArray(tagType);
  assertNotNull(outputValues);
  assertEquals(inputValues.length,outputValues.length);
  for (int i=0; i < inputValues.length; i++) {
    int inputValue=inputValues[i];
    int outputValue=outputValues[i];
    assertEquals(inputValue,outputValue);
  }
  assertEquals(inputValues,_directory.getIntArray(tagType));
  StringBuilder outputString=new StringBuilder();
  for (int i=0; i < inputValues.length; i++) {
    int inputValue=inputValues[i];
    if (i > 0) {
      outputString.append(' ');
    }
    outputString.append(inputValue);
  }
  assertEquals(outputString.toString(),_directory.getString(tagType));
}

Fixed version (ground truth):
@Test public void testSetAndGetIntArray() throws Exception {
  int[] inputValues={1,2,3,4,5,6,7,8,9,10};
  int tagType=123;
  _directory.setIntArray(tagType,inputValues);
  int[] outputValues=_directory.getIntArray(tagType);
  assertNotNull(outputValues);
  assertEquals(inputValues.length,outputValues.length);
  for (int i=0; i < inputValues.length; i++) {
    int inputValue=inputValues[i];
    int outputValue=outputValues[i];
    assertEquals(inputValue,outputValue);
  }
  assertArrayEquals(inputValues,_directory.getIntArray(tagType));
  StringBuilder outputString=new StringBuilder();
  for (int i=0; i < inputValues.length; i++) {
    int inputValue=inputValues[i];
    if (i > 0) {
      outputString.append(' ');
    }
    outputString.append(inputValue);
  }
  assertEquals(outputString.toString(),_directory.getString(tagType));
}
Program: 92915
Project: 92915
Buggy source:
@Nullable public String getCaptureModeDescription(){
  return getIndexedDescription(TAG_CAPTURE_MODE,1,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Nullable public String getCaptureModeDescription(){
  return getIndexedDescription(TAG_CAPTURE_MODE,"String_Node_Str","String_Node_Str","String_Node_Str",null,"String_Node_Str");
}
Program: 92916
Project: 92916
Buggy source:
/** 
 * Returns a descriptive value of the the specified tag for this image. Where possible, known values will be substituted here in place of the raw tokens actually kept in the metadata segment.  If no substitution is available, the value provided by <code>getString(tagType)</code> will be returned.
 * @param tagType the tag to find a description for
 * @return a description of the image's value for the specified tag, or<code>null</code> if the tag hasn't been defined.
 */
@Nullable public String getDescription(int tagType){
  Object object=_directory.getObject(tagType);
  if (object == null)   return null;
  if (object.getClass().isArray()) {
    final int length=Array.getLength(object);
    if (length > 16) {
      final String componentTypeName=object.getClass().getComponentType().getName();
      return String.format("String_Node_Str",length,componentTypeName,length == 1 ? "String_Node_Str" : "String_Node_Str");
    }
  }
  return _directory.getString(tagType);
}

Fixed version (ground truth):
/** 
 * Returns a descriptive value of the specified tag for this image. Where possible, known values will be substituted here in place of the raw tokens actually kept in the metadata segment.  If no substitution is available, the value provided by <code>getString(tagType)</code> will be returned.
 * @param tagType the tag to find a description for
 * @return a description of the image's value for the specified tag, or<code>null</code> if the tag hasn't been defined.
 */
@Nullable public String getDescription(int tagType){
  Object object=_directory.getObject(tagType);
  if (object == null)   return null;
  if (object.getClass().isArray()) {
    final int length=Array.getLength(object);
    if (length > 16) {
      final String componentTypeName=object.getClass().getComponentType().getName();
      return String.format("String_Node_Str",length,componentTypeName,length == 1 ? "String_Node_Str" : "String_Node_Str");
    }
  }
  return _directory.getString(tagType);
}
Program: 92917
Project: 92917
Buggy source:
/** 
 * Returns a descriptive value of the the specified tag for this image. Where possible, known values will be substituted here in place of the raw tokens actually kept in the Exif segment.  If no substitution is available, the value provided by getString(int) will be returned.
 * @param tagType the tag to find a description for
 * @return a description of the image's value for the specified tag, or<code>null</code> if the tag hasn't been defined.
 */
@Nullable public String getDescription(int tagType){
switch (tagType) {
case TAG_RESOLUTION_UNIT:
    return getResolutionDescription();
case TAG_YCBCR_POSITIONING:
  return getYCbCrPositioningDescription();
case TAG_X_RESOLUTION:
return getXResolutionDescription();
case TAG_Y_RESOLUTION:
return getYResolutionDescription();
case TAG_REFERENCE_BLACK_WHITE:
return getReferenceBlackWhiteDescription();
case TAG_ORIENTATION:
return getOrientationDescription();
case TAG_WIN_AUTHOR:
return getWindowsAuthorDescription();
case TAG_WIN_COMMENT:
return getWindowsCommentDescription();
case TAG_WIN_KEYWORDS:
return getWindowsKeywordsDescription();
case TAG_WIN_SUBJECT:
return getWindowsSubjectDescription();
case TAG_WIN_TITLE:
return getWindowsTitleDescription();
default :
return super.getDescription(tagType);
}
}

Fixed version (ground truth):
/** 
 * Returns a descriptive value of the specified tag for this image. Where possible, known values will be substituted here in place of the raw tokens actually kept in the Exif segment.  If no substitution is available, the value provided by getString(int) will be returned.
 * @param tagType the tag to find a description for
 * @return a description of the image's value for the specified tag, or<code>null</code> if the tag hasn't been defined.
 */
@Nullable public String getDescription(int tagType){
switch (tagType) {
case TAG_RESOLUTION_UNIT:
    return getResolutionDescription();
case TAG_YCBCR_POSITIONING:
  return getYCbCrPositioningDescription();
case TAG_X_RESOLUTION:
return getXResolutionDescription();
case TAG_Y_RESOLUTION:
return getYResolutionDescription();
case TAG_REFERENCE_BLACK_WHITE:
return getReferenceBlackWhiteDescription();
case TAG_ORIENTATION:
return getOrientationDescription();
case TAG_WIN_AUTHOR:
return getWindowsAuthorDescription();
case TAG_WIN_COMMENT:
return getWindowsCommentDescription();
case TAG_WIN_KEYWORDS:
return getWindowsKeywordsDescription();
case TAG_WIN_SUBJECT:
return getWindowsSubjectDescription();
case TAG_WIN_TITLE:
return getWindowsTitleDescription();
default :
return super.getDescription(tagType);
}
}
Program: 92920
Project: 92920
Buggy source:
@Nullable public String getFlashExposureValueDescription(){
  Rational value=_directory.getRational(FujifilmMakernoteDirectory.TAG_FLASH_EV);
  if (value == null)   return null;
  return value.toSimpleString(false) + "String_Node_Str";
}

Fixed version (ground truth):
@Nullable public String getFlashExposureValueDescription(){
  Rational value=_directory.getRational(FujifilmMakernoteDirectory.TAG_FLASH_EV);
  return value == null ? null : value.toSimpleString(false) + "String_Node_Str";
}
Program: 92921
Project: 92921
Buggy source:
@Nullable public String getDynamicRangeDescription(){
  return getIndexedDescription(FujifilmMakernoteDirectory.TAG_DYNAMIC_RANGE,"String_Node_Str",null,"String_Node_Str");
}

Fixed version (ground truth):
@Nullable public String getDynamicRangeDescription(){
  return getIndexedDescription(FujifilmMakernoteDirectory.TAG_DYNAMIC_RANGE,1,"String_Node_Str",null,"String_Node_Str");
}
Program: 92923
Project: 92923
Buggy source:
@Nullable public String getPaletteHasTransparencyDescription(){
  return getIndexedDescription(PngDirectory.TAG_INTERLACE_METHOD,null,"String_Node_Str");
}

Fixed version (ground truth):
@Nullable public String getPaletteHasTransparencyDescription(){
  return getIndexedDescription(PngDirectory.TAG_PALETTE_HAS_TRANSPARENCY,null,"String_Node_Str");
}
Program: 92925
Project: 92925
Buggy source:
@Override protected boolean isValidIndex(int index,int bytesRequested) throws BufferBoundsException {
  if (index < 0 || bytesRequested < 0) {
    return false;
  }
  long endIndexLong=(long)index + bytesRequested - 1;
  if (endIndexLong > Integer.MAX_VALUE) {
    return false;
  }
  int endIndex=(int)endIndexLong;
  if (_isStreamFinished) {
    return endIndex < _streamLength;
  }
  int chunkIndex=endIndex / _chunkLength;
  while (chunkIndex >= _chunks.size()) {
    assert(!_isStreamFinished);
    byte[] chunk=new byte[_chunkLength];
    int totalBytesRead=0;
    while (!_isStreamFinished && totalBytesRead != _chunkLength) {
      int bytesRead;
      try {
        bytesRead=_stream.read(chunk,totalBytesRead,_chunkLength - totalBytesRead);
      }
 catch (      IOException e) {
        throw new BufferBoundsException("String_Node_Str",e);
      }
      if (bytesRead == -1) {
        _isStreamFinished=true;
        _streamLength=_chunks.size() * _chunkLength + totalBytesRead;
        if (endIndex >= _streamLength) {
          return false;
        }
      }
 else {
        totalBytesRead+=bytesRead;
      }
    }
    _chunks.add(chunk);
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean isValidIndex(int index,int bytesRequested) throws BufferBoundsException {
  if (index < 0 || bytesRequested < 0) {
    return false;
  }
  long endIndexLong=(long)index + bytesRequested - 1;
  if (endIndexLong > Integer.MAX_VALUE) {
    return false;
  }
  int endIndex=(int)endIndexLong;
  if (_isStreamFinished) {
    return endIndex < _streamLength;
  }
  int chunkIndex=endIndex / _chunkLength;
  while (chunkIndex >= _chunks.size()) {
    assert(!_isStreamFinished);
    byte[] chunk=new byte[_chunkLength];
    int totalBytesRead=0;
    while (!_isStreamFinished && totalBytesRead != _chunkLength) {
      int bytesRead;
      try {
        bytesRead=_stream.read(chunk,totalBytesRead,_chunkLength - totalBytesRead);
      }
 catch (      IOException e) {
        throw new BufferBoundsException("String_Node_Str",e);
      }
      if (bytesRead == -1) {
        _isStreamFinished=true;
        _streamLength=_chunks.size() * _chunkLength + totalBytesRead;
        if (endIndex >= _streamLength) {
          _chunks.add(chunk);
          return false;
        }
      }
 else {
        totalBytesRead+=bytesRead;
      }
    }
    _chunks.add(chunk);
  }
  return true;
}
Program: 92926
Project: 92926
Buggy source:
@Nullable public String getFlashDetailsDescription(){
  Integer value=_directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_DETAILS);
  if (value == null)   return null;
  if (((value << 14) & 1) > 0) {
    return "String_Node_Str";
  }
  if (((value << 13) & 1) > 0) {
    return "String_Node_Str";
  }
  if (((value << 11) & 1) > 0) {
    return "String_Node_Str";
  }
  if (((value << 4) & 1) > 0) {
    return "String_Node_Str";
  }
  return "String_Node_Str" + value + "String_Node_Str";
}

Fixed version (ground truth):
@Nullable public String getFlashDetailsDescription(){
  Integer value=_directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_DETAILS);
  if (value == null)   return null;
  if (((value >> 14) & 1) > 0) {
    return "String_Node_Str";
  }
  if (((value >> 13) & 1) > 0) {
    return "String_Node_Str";
  }
  if (((value >> 11) & 1) > 0) {
    return "String_Node_Str";
  }
  if (((value >> 4) & 1) > 0) {
    return "String_Node_Str";
  }
  return "String_Node_Str" + value + "String_Node_Str";
}
Program: 92927
Project: 92927
Buggy source:
@NotNull public static Metadata readMetadata(@NotNull InputStream inputStream) throws IOException {
  Metadata metadata=new Metadata();
  byte[] headerBytes=new byte[26];
  inputStream.read(headerBytes,0,26);
  new PsdReader().extract(new ByteArrayReader(headerBytes),metadata);
  return metadata;
}

Fixed version (ground truth):
@NotNull public static Metadata readMetadata(@NotNull InputStream inputStream) throws IOException {
  Metadata metadata=new Metadata();
  final int headerLength=26;
  byte[] bytes=new byte[headerLength];
  int totalBytesRead=0;
  while (totalBytesRead != headerLength) {
    int bytesRead=inputStream.read(bytes,totalBytesRead,headerLength - totalBytesRead);
    if (bytesRead == -1)     throw new EOFException("String_Node_Str");
    totalBytesRead+=bytesRead;
  }
  new PsdReader().extract(new ByteArrayReader(bytes),metadata);
  return metadata;
}
Program: 92928
Project: 92928
Buggy source:
@Nullable public Face[] getRecognizedFaces(){
  byte[] bytes=getByteArray(PanasonicMakernoteDirectory.TAG_FACE_RECOGNITION_INFO);
  if (bytes == null)   return null;
  BufferReader reader=new BufferReader(bytes);
  try {
    int faceCount=reader.getUInt16(0);
    if (faceCount == 0)     return null;
    Face[] faces=new Face[faceCount];
    for (int i=0; i < faceCount; i++) {
      int offset=4 + i * 44;
      String name=reader.getString(offset,20,"String_Node_Str").trim();
      String age=reader.getString(offset + 28,20,"String_Node_Str").trim();
      faces[i]=new Face(reader.getUInt16(offset + 20),reader.getUInt16(offset + 22),reader.getUInt16(offset + 24),reader.getUInt16(offset + 26),name,age);
    }
    return faces;
  }
 catch (  BufferBoundsException e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public Face[] getRecognizedFaces(){
  byte[] bytes=getByteArray(PanasonicMakernoteDirectory.TAG_FACE_RECOGNITION_INFO);
  if (bytes == null)   return null;
  BufferReader reader=new BufferReader(bytes);
  reader.setMotorolaByteOrder(false);
  try {
    int faceCount=reader.getUInt16(0);
    if (faceCount == 0)     return null;
    Face[] faces=new Face[faceCount];
    for (int i=0; i < faceCount; i++) {
      int offset=4 + i * 44;
      String name=reader.getString(offset,20,"String_Node_Str").trim();
      String age=reader.getString(offset + 28,20,"String_Node_Str").trim();
      faces[i]=new Face(reader.getUInt16(offset + 20),reader.getUInt16(offset + 22),reader.getUInt16(offset + 24),reader.getUInt16(offset + 26),name,age);
    }
    return faces;
  }
 catch (  BufferBoundsException e) {
    return null;
  }
}
Program: 92929
Project: 92929
Buggy source:
@Nullable public Face[] getDetectedFaces(){
  byte[] bytes=getByteArray(PanasonicMakernoteDirectory.TAG_FACE_DETECTION_INFO);
  if (bytes == null)   return null;
  BufferReader reader=new BufferReader(bytes);
  try {
    int faceCount=reader.getUInt16(0);
    if (faceCount == 0)     return null;
    Face[] faces=new Face[faceCount];
    for (int i=0; i < faceCount; i++) {
      int offset=2 + i * 8;
      faces[i]=new Face(reader.getUInt16(offset),reader.getUInt16(offset + 2),reader.getUInt16(offset + 4),reader.getUInt16(offset + 6),null,null);
    }
    return faces;
  }
 catch (  BufferBoundsException e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public Face[] getDetectedFaces(){
  byte[] bytes=getByteArray(PanasonicMakernoteDirectory.TAG_FACE_DETECTION_INFO);
  if (bytes == null)   return null;
  BufferReader reader=new BufferReader(bytes);
  reader.setMotorolaByteOrder(false);
  try {
    int faceCount=reader.getUInt16(0);
    if (faceCount == 0)     return null;
    Face[] faces=new Face[faceCount];
    for (int i=0; i < faceCount; i++) {
      int offset=2 + i * 8;
      faces[i]=new Face(reader.getUInt16(offset),reader.getUInt16(offset + 2),reader.getUInt16(offset + 4),reader.getUInt16(offset + 6),null,null);
    }
    return faces;
  }
 catch (  BufferBoundsException e) {
    return null;
  }
}
Program: 92930
Project: 92930
Buggy source:
@Test @Ignore(value="String_Node_Str") public void testGetRecognizedFaces() throws Exception {
  Face expResult=new Face(142,120,76,76,"String_Node_Str","String_Node_Str");
  Face[] result=_panasonicDirectory.getRecognizedFaces();
  Assert.assertNotNull(result);
  Assert.assertEquals(expResult,result[0]);
}

Fixed version (ground truth):
@Test public void testGetRecognizedFaces() throws Exception {
  Face expResult=new Face(142,120,76,76,"String_Node_Str","String_Node_Str");
  Face[] result=_panasonicDirectory.getRecognizedFaces();
  Assert.assertNotNull(result);
  Assert.assertEquals(expResult,result[0]);
}
Program: 92931
Project: 92931
Buggy source:
@Test @Ignore(value="String_Node_Str") public void testGetDetectedFaces() throws Exception {
  Face expResult=new Face(142,120,76,76,null,null);
  Face[] result=_panasonicDirectory.getDetectedFaces();
  Assert.assertNotNull(result);
  Assert.assertEquals(expResult,result[0]);
}

Fixed version (ground truth):
@Test public void testGetDetectedFaces() throws Exception {
  Face expResult=new Face(142,120,76,76,null,null);
  Face[] result=_panasonicDirectory.getDetectedFaces();
  Assert.assertNotNull(result);
  Assert.assertEquals(expResult,result[0]);
}
Program: 92932
Project: 92932
Buggy source:
private void CheckBounds(final int index,final int bytesRequested) throws BufferBoundsException {
  if (bytesRequested < 0 || index < 0 || index + bytesRequested - 1 >= _buffer.length)   throw new BufferBoundsException(_buffer,index,bytesRequested);
}

Fixed version (ground truth):
private void CheckBounds(final int index,final int bytesRequested) throws BufferBoundsException {
  if (bytesRequested < 0 || index < 0 || (long)index + (long)bytesRequested - 1L >= (long)_buffer.length)   throw new BufferBoundsException(_buffer,index,bytesRequested);
}
Program: 92934
Project: 92934
Buggy source:
/** 
 * Get a 32-bit integer from the buffer.
 * @param index position within the data buffer to read first byte
 * @return the 32 bit int value, between 0x00000000 and 0xFFFFFFFF
 * @throws BufferBoundsException the buffer does not contain enough bytes to service the request, or index is negative
 */
public int getInt32(int index) throws BufferBoundsException {
  CheckBounds(index,4);
  if (_isMotorolaByteOrder) {
    return (_buffer[index] << 24 & 0xFF000000) | (_buffer[index + 1] << 16 & 0xFF0000) | (_buffer[index + 2] << 8 & 0xFF00)| (_buffer[index + 3] & 0xFF);
  }
 else {
    return (_buffer[index + 3] << 24 & 0xFF000000) | (_buffer[index + 2] << 16 & 0xFF0000) | (_buffer[index + 1] << 8 & 0xFF00)| (_buffer[index] & 0xFF);
  }
}

Fixed version (ground truth):
/** 
 * Get a 32-bit signed integer from the buffer.
 * @param index position within the data buffer to read first byte
 * @return the signed 32 bit int value, between 0x00000000 and 0xFFFFFFFF
 * @throws BufferBoundsException the buffer does not contain enough bytes to service the request, or index is negative
 */
public int getInt32(int index) throws BufferBoundsException {
  CheckBounds(index,4);
  if (_isMotorolaByteOrder) {
    return (_buffer[index] << 24 & 0xFF000000) | (_buffer[index + 1] << 16 & 0xFF0000) | (_buffer[index + 2] << 8 & 0xFF00)| (_buffer[index + 3] & 0xFF);
  }
 else {
    return (_buffer[index + 3] << 24 & 0xFF000000) | (_buffer[index + 2] << 16 & 0xFF0000) | (_buffer[index + 1] << 8 & 0xFF00)| (_buffer[index] & 0xFF);
  }
}
Program: 92936
Project: 92936
Buggy source:
/** 
 * Performs the Jfif data extraction, adding found values to the specified instance of <code>Metadata</code>.
 */
public void extract(@NotNull final byte[] data,@NotNull final Metadata metadata){
  JfifDirectory directory=metadata.getOrCreateDirectory(JfifDirectory.class);
  BufferReader reader=new BufferReader(data);
  try {
    int ver=reader.getInt32(JfifDirectory.TAG_JFIF_VERSION);
    directory.setInt(JfifDirectory.TAG_JFIF_VERSION,ver);
    int units=reader.getUInt16(JfifDirectory.TAG_JFIF_UNITS);
    directory.setInt(JfifDirectory.TAG_JFIF_UNITS,units);
    int height=reader.getInt32(JfifDirectory.TAG_JFIF_RESX);
    directory.setInt(JfifDirectory.TAG_JFIF_RESX,height);
    int width=reader.getInt32(JfifDirectory.TAG_JFIF_RESY);
    directory.setInt(JfifDirectory.TAG_JFIF_RESY,width);
  }
 catch (  BufferBoundsException me) {
    directory.addError(me.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Performs the Jfif data extraction, adding found values to the specified instance of <code>Metadata</code>.
 */
public void extract(@NotNull final byte[] data,@NotNull final Metadata metadata){
  JfifDirectory directory=metadata.getOrCreateDirectory(JfifDirectory.class);
  BufferReader reader=new BufferReader(data);
  try {
    int ver=reader.getUInt16(JfifDirectory.TAG_JFIF_VERSION);
    directory.setInt(JfifDirectory.TAG_JFIF_VERSION,ver);
    int units=reader.getUInt8(JfifDirectory.TAG_JFIF_UNITS);
    directory.setInt(JfifDirectory.TAG_JFIF_UNITS,units);
    int height=reader.getUInt16(JfifDirectory.TAG_JFIF_RESX);
    directory.setInt(JfifDirectory.TAG_JFIF_RESX,height);
    int width=reader.getUInt16(JfifDirectory.TAG_JFIF_RESY);
    directory.setInt(JfifDirectory.TAG_JFIF_RESY,width);
  }
 catch (  BufferBoundsException me) {
    directory.addError(me.getMessage());
  }
}
Program: 92938
Project: 92938
Buggy source:
/** 
 * Registers an error message with this directory.
 * @param message an error message.
 */
public void addError(String message){
  if (_errorList == null) {
    _errorList=new ArrayList<String>();
  }
  _errorList.add(message);
}

Fixed version (ground truth):
/** 
 * Registers an error message with this directory.
 * @param message an error message.
 */
public void addError(String message){
  _errorList.add(message);
}
Program: 92939
Project: 92939
Buggy source:
/** 
 * Gets a value indicating whether this directory has any error messages.
 * @return true if the directory contains errors, otherwise false
 */
public boolean hasErrors(){
  return (_errorList != null && _errorList.size() > 0);
}

Fixed version (ground truth):
/** 
 * Gets a value indicating whether this directory has any error messages.
 * @return true if the directory contains errors, otherwise false
 */
public boolean hasErrors(){
  return _errorList.size() > 0;
}
Program: 92941
Project: 92941
Buggy source:
/** 
 * This code is from ExifDescriptor.java 
 */
public String getExposureProgramDescription() throws MetadataException {
  if (!_directory.containsTag(XmpDirectory.TAG_EXPOSURE_PROG))   return null;
switch (_directory.getInt(XmpDirectory.TAG_EXPOSURE_PROG)) {
case 1:
    return "String_Node_Str";
case 2:
  return "String_Node_Str";
case 3:
return "String_Node_Str";
case 4:
return "String_Node_Str";
case 5:
return "String_Node_Str";
case 6:
return "String_Node_Str";
case 7:
return "String_Node_Str";
case 8:
return "String_Node_Str";
default :
return "String_Node_Str" + _directory.getInt(ExifDirectory.TAG_EXPOSURE_PROGRAM) + "String_Node_Str";
}
}

Fixed version (ground truth):
/** 
 * This code is from ExifDescriptor.java 
 */
public String getExposureProgramDescription() throws MetadataException {
  if (!_directory.containsTag(XmpDirectory.TAG_EXPOSURE_PROG))   return null;
switch (_directory.getInt(XmpDirectory.TAG_EXPOSURE_PROG)) {
case 1:
    return "String_Node_Str";
case 2:
  return "String_Node_Str";
case 3:
return "String_Node_Str";
case 4:
return "String_Node_Str";
case 5:
return "String_Node_Str";
case 6:
return "String_Node_Str";
case 7:
return "String_Node_Str";
case 8:
return "String_Node_Str";
default :
return "String_Node_Str" + _directory.getInt(XmpDirectory.TAG_EXPOSURE_PROG) + "String_Node_Str";
}
}
Program: 92942
Project: 92942
Buggy source:
@NotNull public static Metadata readMetadata(@NotNull File file) throws JpegProcessingException {
  JpegSegmentReader segmentReader=new JpegSegmentReader(file);
  return extractMetadataFromJpegSegmentReader(segmentReader);
}

Fixed version (ground truth):
@NotNull public static Metadata readMetadata(@NotNull File file) throws JpegProcessingException, IOException {
  JpegSegmentReader segmentReader=new JpegSegmentReader(file);
  return extractMetadataFromJpegSegmentReader(segmentReader);
}
Program: 92943
Project: 92943
Buggy source:
/** 
 * Creates a JpegSegmentReader for an InputStream.
 * @param inputStream the InputStream containing Jpeg data
 */
public JpegSegmentReader(@NotNull InputStream inputStream,boolean waitForBytes) throws JpegProcessingException {
  BufferedInputStream bufferedInputStream=inputStream instanceof BufferedInputStream ? (BufferedInputStream)inputStream : new BufferedInputStream(inputStream);
  _segmentData=readSegments(bufferedInputStream,waitForBytes);
}

Fixed version (ground truth):
/** 
 * Creates a JpegSegmentReader for an InputStream.
 * @param inputStream the InputStream containing Jpeg data
 */
public JpegSegmentReader(@NotNull InputStream inputStream,boolean waitForBytes) throws JpegProcessingException {
  if (inputStream == null)   throw new NullPointerException();
  BufferedInputStream bufferedInputStream=inputStream instanceof BufferedInputStream ? (BufferedInputStream)inputStream : new BufferedInputStream(inputStream);
  _segmentData=readSegments(bufferedInputStream,waitForBytes);
}
Program: 92944
Project: 92944
Buggy source:
@Before public void setUp() throws JpegProcessingException, FileNotFoundException {
  File jpegFile=new File("String_Node_Str");
  JpegReader reader=new JpegReader(new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_SOF0));
  Metadata metadata=new Metadata();
  reader.extract(metadata);
  Assert.assertTrue(metadata.containsDirectory(JpegDirectory.class));
  _directory=metadata.getOrCreateDirectory(JpegDirectory.class);
}

Fixed version (ground truth):
@Before public void setUp() throws JpegProcessingException, IOException {
  File jpegFile=new File("String_Node_Str");
  JpegReader reader=new JpegReader(new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_SOF0));
  Metadata metadata=new Metadata();
  reader.extract(metadata);
  Assert.assertTrue(metadata.containsDirectory(JpegDirectory.class));
  _directory=metadata.getOrCreateDirectory(JpegDirectory.class);
}
Program: 92945
Project: 92945
Buggy source:
/** 
 * Constructor which executes multiple sample usages, each of which return the same output.  This class showcases multiple usages of this metadata class library.
 * @param fileName path to a file upon which to operate
 */
public SampleUsage(String fileName){
  File file=new File(fileName);
  try {
    Metadata metadata=ImageMetadataReader.readMetadata(file);
    printImageTags(1,metadata);
  }
 catch (  ImageProcessingException e) {
    System.err.println("String_Node_Str" + e);
  }
catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
  }
  try {
    Metadata metadata=JpegMetadataReader.readMetadata(file);
    printImageTags(1,metadata);
  }
 catch (  JpegProcessingException e) {
    System.err.println("String_Node_Str" + e);
  }
  try {
    JpegSegmentReader segmentReader=new JpegSegmentReader(file);
    byte[] exifSegment=segmentReader.readSegment(JpegSegmentReader.SEGMENT_APP1);
    byte[] iptcSegment=segmentReader.readSegment(JpegSegmentReader.SEGMENT_APPD);
    Metadata metadata=new Metadata();
    new ExifReader(exifSegment).extract(metadata);
    new IptcReader(iptcSegment).extract(metadata);
    printImageTags(3,metadata);
  }
 catch (  JpegProcessingException e) {
    System.err.println("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Constructor which executes multiple sample usages, each of which return the same output.  This class showcases multiple usages of this metadata class library.
 * @param fileName path to a file upon which to operate
 */
public SampleUsage(String fileName){
  File file=new File(fileName);
  try {
    Metadata metadata=ImageMetadataReader.readMetadata(file);
    printImageTags(1,metadata);
  }
 catch (  ImageProcessingException e) {
    System.err.println("String_Node_Str" + e);
  }
catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
  }
  try {
    Metadata metadata=JpegMetadataReader.readMetadata(file);
    printImageTags(1,metadata);
  }
 catch (  JpegProcessingException e) {
    System.err.println("String_Node_Str" + e);
  }
catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
  }
  try {
    JpegSegmentReader segmentReader=new JpegSegmentReader(file);
    byte[] exifSegment=segmentReader.readSegment(JpegSegmentReader.SEGMENT_APP1);
    byte[] iptcSegment=segmentReader.readSegment(JpegSegmentReader.SEGMENT_APPD);
    Metadata metadata=new Metadata();
    if (exifSegment != null)     new ExifReader(exifSegment).extract(metadata);
    if (iptcSegment != null)     new IptcReader(iptcSegment).extract(metadata);
    printImageTags(3,metadata);
  }
 catch (  JpegProcessingException e) {
    System.err.println("String_Node_Str" + e);
  }
catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
  }
}
Program: 92946
Project: 92946
Buggy source:
private void storeThumbnailBytes(ExifDirectory exifDirectory,int tiffHeaderOffset){
  if (!exifDirectory.containsTag(ExifDirectory.TAG_COMPRESSION))   return;
  if (!exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_LENGTH) || !exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_OFFSET))   return;
  try {
    int offset=exifDirectory.getInt(ExifDirectory.TAG_THUMBNAIL_OFFSET);
    int length=exifDirectory.getInt(ExifDirectory.TAG_THUMBNAIL_LENGTH);
    byte[] result=new byte[length];
    System.arraycopy(_data,tiffHeaderOffset + offset,result,0,result.length);
    exifDirectory.setByteArray(ExifDirectory.TAG_THUMBNAIL_DATA,result);
  }
 catch (  Throwable e) {
    exifDirectory.addError("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
private void storeThumbnailBytes(ExifDirectory exifDirectory,int tiffHeaderOffset){
  if (!exifDirectory.containsTag(ExifDirectory.TAG_COMPRESSION))   return;
  if (!exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_LENGTH) || !exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_OFFSET))   return;
  try {
    int offset=exifDirectory.getInt(ExifDirectory.TAG_THUMBNAIL_OFFSET);
    int length=exifDirectory.getInt(ExifDirectory.TAG_THUMBNAIL_LENGTH);
    if (length < 1 || (tiffHeaderOffset + offset + length) > _data.length) {
      exifDirectory.addError("String_Node_Str");
      return;
    }
    byte[] result=new byte[length];
    System.arraycopy(_data,tiffHeaderOffset + offset,result,0,result.length);
    exifDirectory.setByteArray(ExifDirectory.TAG_THUMBNAIL_DATA,result);
  }
 catch (  Throwable e) {
    exifDirectory.addError("String_Node_Str" + e.getMessage());
  }
}
Program: 92948
Project: 92948
Buggy source:
@Override public void waitOn(Object on,long ms) throws InterruptedException {
  currentMs+=ms;
}

Fixed version (ground truth):
@Override public void waitOn(Object on,long ms) throws InterruptedException {
synchronized (on) {
    on.wait(ms);
  }
  currentMs+=ms;
}
Program: 92950
Project: 92950
Buggy source:
public AvroRestProducer(KafkaProducer<Object,Object> producer,KafkaAvroSerializer keySerializer,KafkaAvroSerializer valueSerializer){
  this.producer=producer;
  this.keySerializer=keySerializer;
  this.valueSerializer=valueSerializer;
}

Fixed version (ground truth):
public AvroRestProducer(KafkaProducer<Object,Object> producer,KafkaAvroSerializer keySerializer,KafkaAvroSerializer valueSerializer){
  this.producer=producer;
  this.keySerializer=keySerializer;
  this.valueSerializer=valueSerializer;
  this.schemaIdCache=new HashMap<>();
}
Program: 92952
Project: 92952
Buggy source:
@Override public long milliseconds(){
  return currentMs;
}

Fixed version (ground truth):
@Override public long milliseconds(){
  currentMs++;
  return currentMs;
}
Program: 92953
Project: 92953
Buggy source:
@Override public void waitOn(Object on,long ms) throws InterruptedException {
  currentMs+=ms;
}

Fixed version (ground truth):
@Override public void waitOn(Object on,long ms) throws InterruptedException {
  Thread.sleep(1);
  currentMs+=ms;
}