nus-yam/ex-repair huggingface dataset:
Program: 92852
Project: 92852
Buggy source:
/** 
 * This test shows how to use a input and output parameters and return a result set from a stored procedure. This test shows using a Map parameter. Currently this test will fail without clearing the cache because of a MyBatis cache issue.
 */
@Test @Ignore("String_Node_Str") public void testCallWithResultSet4(){
  SqlSession sqlSession=sqlSessionFactory.openSession();
  try {
    SPMapper spMapper=sqlSession.getMapper(SPMapper.class);
    Map<String,Object> parms=new HashMap<String,Object>();
    parms.put("String_Node_Str",2);
    List<Name> names=spMapper.getNames(parms);
    assertEquals(2,parms.get("String_Node_Str"));
    assertEquals(2,names.size());
    sqlSession.clearCache();
    parms=new HashMap<String,Object>();
    parms.put("String_Node_Str",2);
    names=spMapper.getNames(parms);
    assertEquals(2,names.size());
    assertEquals(2,parms.get("String_Node_Str"));
  }
  finally {
    sqlSession.close();
  }
}

Fixed version (ground truth):
/** 
 * This test shows how to use a input and output parameters and return a result set from a stored procedure. This test shows using a Map parameter. Currently this test will fail without clearing the cache because of a MyBatis cache issue.
 */
@Test @Ignore("String_Node_Str") public void testCallWithResultSet4(){
  SqlSession sqlSession=sqlSessionFactory.openSession();
  try {
    SPMapper spMapper=sqlSession.getMapper(SPMapper.class);
    Map<String,Object> parms=new HashMap<String,Object>();
    parms.put("String_Node_Str",2);
    List<Name> names=spMapper.getNames(parms);
    assertEquals(2,parms.get("String_Node_Str"));
    assertEquals(2,names.size());
    parms=new HashMap<String,Object>();
    parms.put("String_Node_Str",2);
    names=spMapper.getNames(parms);
    assertEquals(2,names.size());
    assertEquals(2,parms.get("String_Node_Str"));
  }
  finally {
    sqlSession.close();
  }
}
Program: 92853
Project: 92853
Buggy source:
/** 
 * This test shows how to use input and output parameters in a stored procedure. This procedure does not return a result set. Currently this test will fail without clearing the cache because of a MyBatis cache issue. This test shows using a multi-property parameter.
 */
@Test public void testAdderAsSelectDoubleCall1(){
  SqlSession sqlSession=sqlSessionFactory.openSession();
  try {
    Parameter parameter=new Parameter();
    parameter.setAddend1(2);
    parameter.setAddend2(3);
    SPMapper spMapper=sqlSession.getMapper(SPMapper.class);
    spMapper.adder(parameter);
    assertEquals((Integer)5,parameter.getSum());
    sqlSession.clearCache();
    parameter=new Parameter();
    parameter.setAddend1(2);
    parameter.setAddend2(3);
    spMapper.adder(parameter);
    assertEquals((Integer)5,parameter.getSum());
  }
  finally {
    sqlSession.close();
  }
}

Fixed version (ground truth):
/** 
 * This test shows how to use input and output parameters in a stored procedure. This procedure does not return a result set. Currently this test will fail without clearing the cache because of a MyBatis cache issue. This test shows using a multi-property parameter.
 */
@Test public void testAdderAsSelectDoubleCall1(){
  SqlSession sqlSession=sqlSessionFactory.openSession();
  try {
    Parameter parameter=new Parameter();
    parameter.setAddend1(2);
    parameter.setAddend2(3);
    SPMapper spMapper=sqlSession.getMapper(SPMapper.class);
    spMapper.adder(parameter);
    assertEquals((Integer)5,parameter.getSum());
    parameter=new Parameter();
    parameter.setAddend1(2);
    parameter.setAddend2(3);
    spMapper.adder(parameter);
    assertEquals((Integer)5,parameter.getSum());
  }
  finally {
    sqlSession.close();
  }
}
Program: 92854
Project: 92854
Buggy source:
public void rollback(boolean required) throws SQLException {
  if (!closed) {
    clearLocalCache();
    if (required) {
      transaction.rollback();
    }
  }
}

Fixed version (ground truth):
public void rollback(boolean required) throws SQLException {
  if (!closed) {
    clearLocalCache();
    flushStatements();
    if (required) {
      transaction.rollback();
    }
  }
}
Program: 92855
Project: 92855
Buggy source:
public List doQuery(MappedStatement ms,Object parameterObject,RowBounds rowBounds,ResultHandler resultHandler) throws SQLException {
  flushStatements();
  Configuration configuration=ms.getConfiguration();
  StatementHandler handler=configuration.newStatementHandler(this,ms,parameterObject,rowBounds,resultHandler);
  Connection connection=transaction.getConnection();
  Statement stmt=handler.prepare(connection);
  handler.parameterize(stmt);
  return handler.query(stmt,resultHandler);
}

Fixed version (ground truth):
public List doQuery(MappedStatement ms,Object parameterObject,RowBounds rowBounds,ResultHandler resultHandler) throws SQLException {
  try {
    flushStatements();
    Configuration configuration=ms.getConfiguration();
    StatementHandler handler=configuration.newStatementHandler(this,ms,parameterObject,rowBounds,resultHandler);
    Connection connection=transaction.getConnection();
    Statement stmt=handler.prepare(connection);
    handler.parameterize(stmt);
    return handler.query(stmt,resultHandler);
  }
  finally {
    flushStatements();
  }
}
Program: 92856
Project: 92856
Buggy source:
@Override public String getDescription(int tagType){
switch (tagType) {
case TAG_MAJOR_BRAND:
    return getMajorBrandDescription();
case TAG_COMPATIBLE_BRANDS:
  return getCompatibleBrandsDescription();
case TAG_DURATION:
return getDurationDescription();
default :
return super.getDescription(tagType);
}
}

Fixed version (ground truth):
@Override public String getDescription(int tagType){
switch (tagType) {
case TAG_MAJOR_BRAND:
    return getMajorBrandDescription();
case TAG_COMPATIBLE_BRANDS:
  return getCompatibleBrandsDescription();
case TAG_DURATION_SECONDS:
return getDurationDescription();
default :
return super.getDescription(tagType);
}
}
Program: 92857
Project: 92857
Buggy source:
private String getDurationDescription(){
  Long value=_directory.getLongObject(TAG_DURATION);
  if (value == null)   return null;
  Integer hours=(int)(value / (Math.pow(60,2)));
  Integer minutes=(int)((value / (Math.pow(60,1))) - (hours * 60));
  Integer seconds=(int)Math.ceil((value / (Math.pow(60,0))) - (minutes * 60));
  return String.format("String_Node_Str",hours,minutes,seconds);
}

Fixed version (ground truth):
private String getDurationDescription(){
  Rational duration=_directory.getRational(TAG_DURATION_SECONDS);
  if (duration == null)   return null;
  double value=duration.doubleValue();
  Integer hours=(int)(value / (Math.pow(60,2)));
  Integer minutes=(int)((value / (Math.pow(60,1))) - (hours * 60));
  Integer seconds=(int)Math.ceil((value / (Math.pow(60,0))) - (minutes * 60));
  return String.format("String_Node_Str",hours,minutes,seconds);
}
Program: 92858
Project: 92858
Buggy source:
public void addMetadata(QuickTimeSoundDirectory directory){
  SoundSampleDescription description=sampleDescriptions.get(0);
  directory.setString(QuickTimeSoundDirectory.TAG_AUDIO_FORMAT,QuickTimeDictionary.lookup(QuickTimeSoundDirectory.TAG_AUDIO_FORMAT,description.dataFormat));
  directory.setInt(QuickTimeSoundDirectory.TAG_NUMBER_OF_CHANNELS,description.numberOfChannels);
  directory.setInt(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_SIZE,description.sampleSize);
}

Fixed version (ground truth):
public void addMetadata(QuickTimeSoundDirectory directory){
  SoundSampleDescription description=sampleDescriptions.get(0);
  QuickTimeDictionary.setLookup(QuickTimeSoundDirectory.TAG_AUDIO_FORMAT,description.dataFormat,directory);
  directory.setInt(QuickTimeSoundDirectory.TAG_NUMBER_OF_CHANNELS,description.numberOfChannels);
  directory.setInt(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_SIZE,description.sampleSize);
}
Program: 92859
Project: 92859
Buggy source:
public TimeToSampleAtom(SequentialReader reader,Atom atom) throws IOException {
  super(reader,atom);
  numberOfEntries=reader.getUInt32();
  entries=new ArrayList<Entry>();
  for (int i=0; i < numberOfEntries; i++) {
    entries.add(new Entry(reader));
  }
  sampleCount=reader.getUInt32();
  sampleDuration=reader.getUInt32();
}

Fixed version (ground truth):
public TimeToSampleAtom(SequentialReader reader,Atom atom) throws IOException {
  super(reader,atom);
  numberOfEntries=reader.getUInt32();
  entries=new ArrayList<Entry>();
  for (int i=0; i < numberOfEntries; i++) {
    entries.add(new Entry(reader));
  }
}
Program: 92860
Project: 92860
Buggy source:
public void addMetadata(QuickTimeVideoDirectory directory){
  float frameRate=(float)QuickTimeHandlerFactory.HANDLER_PARAM_TIME_SCALE / (float)sampleDuration;
  directory.setFloat(QuickTimeVideoDirectory.TAG_FRAME_RATE,frameRate);
}

Fixed version (ground truth):
public void addMetadata(QuickTimeVideoDirectory directory){
  float frameRate=(float)QuickTimeHandlerFactory.HANDLER_PARAM_TIME_SCALE / (float)entries.get(0).sampleDuration;
  directory.setFloat(QuickTimeVideoDirectory.TAG_FRAME_RATE,frameRate);
}
Program: 92861
Project: 92861
Buggy source:
public VideoSampleDescription(SequentialReader reader) throws IOException {
  super(reader);
  version=reader.getUInt16();
  revisionLevel=reader.getUInt16();
  vendor=reader.getString(4);
  temporalQuality=reader.getUInt32();
  spatialQuality=reader.getUInt32();
  width=reader.getUInt16();
  height=reader.getUInt16();
  horizontalResolution=reader.getUInt32();
  verticalResolution=reader.getUInt32();
  dataSize=reader.getUInt32();
  frameCount=reader.getUInt16();
  compressorName=reader.getString(reader.getUInt8());
  depth=reader.getUInt16();
  colorTableID=reader.getInt16();
}

Fixed version (ground truth):
public VideoSampleDescription(SequentialReader reader) throws IOException {
  super(reader);
  version=reader.getUInt16();
  revisionLevel=reader.getUInt16();
  vendor=reader.getString(4);
  temporalQuality=reader.getUInt32();
  spatialQuality=reader.getUInt32();
  width=reader.getUInt16();
  height=reader.getUInt16();
  horizontalResolution=reader.getUInt32();
  verticalResolution=reader.getUInt32();
  dataSize=reader.getUInt32();
  frameCount=reader.getUInt16();
  compressorName=reader.getString(32);
  depth=reader.getUInt16();
  colorTableID=reader.getInt16();
}
Program: 92863
Project: 92863
Buggy source:
private String getDepthDescription(int tagType){
  Integer value=_directory.getInteger(tagType);
  if (value == null)   return null;
switch (value) {
case (40):
case (36):
case (34):
    return (value - 32) + "String_Node_Str";
default :
  return "String_Node_Str" + value + "String_Node_Str";
}
}

Fixed version (ground truth):
private String getDepthDescription(int tagType){
  Integer value=_directory.getInteger(tagType);
  if (value == null)   return null;
switch (value) {
case (1):
case (2):
case (4):
case (8):
case (16):
case (24):
case (32):
    return value + "String_Node_Str";
case (40):
case (36):
case (34):
  return (value - 32) + "String_Node_Str";
default :
return "String_Node_Str" + value + "String_Node_Str";
}
}
Program: 92864
Project: 92864
Buggy source:
@Override public String getDescription(int tagType){
switch (tagType) {
case TAG_MAJOR_BRAND:
    return getMajorBrandDescription();
case TAG_COMPATIBLE_BRANDS:
  return getCompatibleBrandsDescription();
case TAG_DURATION:
return getDurationDescription();
default :
return _directory.getString(tagType);
}
}

Fixed version (ground truth):
@Override public String getDescription(int tagType){
switch (tagType) {
case TAG_MAJOR_BRAND:
    return getMajorBrandDescription();
case TAG_COMPATIBLE_BRANDS:
  return getCompatibleBrandsDescription();
case TAG_DURATION_SECONDS:
return getDurationDescription();
default :
return _directory.getString(tagType);
}
}
Program: 92865
Project: 92865
Buggy source:
private String getDurationDescription(){
  Long value=_directory.getLongObject(TAG_DURATION);
  if (value == null)   return null;
  Integer hours=(int)(value / (Math.pow(60,2)));
  Integer minutes=(int)((value / (Math.pow(60,1))) - (hours * 60));
  Integer seconds=(int)Math.ceil((value / (Math.pow(60,0))) - (minutes * 60));
  return String.format("String_Node_Str",hours,minutes,seconds);
}

Fixed version (ground truth):
private String getDurationDescription(){
  Rational duration=_directory.getRational(TAG_DURATION_SECONDS);
  if (duration == null)   return null;
  double value=duration.doubleValue();
  Integer hours=(int)(value / (Math.pow(60,2)));
  Integer minutes=(int)((value / (Math.pow(60,1))) - (hours * 60));
  Integer seconds=(int)Math.ceil((value / (Math.pow(60,0))) - (minutes * 60));
  return String.format("String_Node_Str",hours,minutes,seconds);
}
Program: 92866
Project: 92866
Buggy source:
public void addMetadata(Mp4SoundDirectory directory){
  directory.setInt(Mp4SoundDirectory.TAG_NUMBER_OF_CHANNELS,channelcount);
  directory.setInt(Mp4SoundDirectory.TAG_AUDIO_SAMPLE_SIZE,samplesize);
  directory.setLong(Mp4SoundDirectory.TAG_AUDIO_SAMPLE_RATE,samplerate);
}

Fixed version (ground truth):
public void addMetadata(Mp4SoundDirectory directory){
  Mp4Dictionary.setLookup(Mp4SoundDirectory.TAG_AUDIO_FORMAT,format,directory);
  directory.setInt(Mp4SoundDirectory.TAG_NUMBER_OF_CHANNELS,channelcount);
  directory.setInt(Mp4SoundDirectory.TAG_AUDIO_SAMPLE_SIZE,samplesize);
}
Program: 92867
Project: 92867
Buggy source:
public void addMetadata(Mp4VideoDirectory directory){
  directory.setInt(Mp4VideoDirectory.TAG_WIDTH,width);
  directory.setInt(Mp4VideoDirectory.TAG_HEIGHT,height);
  directory.setString(Mp4VideoDirectory.TAG_COMPRESSION_TYPE,compressorname.trim());
  directory.setInt(Mp4VideoDirectory.TAG_DEPTH,depth);
  double horizontalInteger=(horizresolution & 0xFFFF0000) >> 16;
  double horizontalFraction=(horizresolution & 0xFFFF) / Math.pow(2,4);
  directory.setDouble(Mp4VideoDirectory.TAG_HORIZONTAL_RESOLUTION,horizontalInteger + horizontalFraction);
  double verticalInteger=(vertresolution & 0xFFFF0000) >> 16;
  double verticalFraction=(vertresolution & 0xFFFF) / Math.pow(2,4);
  directory.setDouble(Mp4VideoDirectory.TAG_VERTICAL_RESOLUTION,verticalInteger + verticalFraction);
}

Fixed version (ground truth):
public void addMetadata(Mp4VideoDirectory directory){
  Mp4Dictionary.setLookup(Mp4VideoDirectory.TAG_COMPRESSION_TYPE,format,directory);
  directory.setInt(Mp4VideoDirectory.TAG_WIDTH,width);
  directory.setInt(Mp4VideoDirectory.TAG_HEIGHT,height);
  String compressorName=compressorname.trim();
  if (!compressorName.isEmpty()) {
    directory.setString(Mp4VideoDirectory.TAG_COMPRESSOR_NAME,compressorName);
  }
  directory.setInt(Mp4VideoDirectory.TAG_DEPTH,depth);
  double horizontalInteger=(horizresolution & 0xFFFF0000) >> 16;
  double horizontalFraction=(horizresolution & 0xFFFF) / Math.pow(2,4);
  directory.setDouble(Mp4VideoDirectory.TAG_HORIZONTAL_RESOLUTION,horizontalInteger + horizontalFraction);
  double verticalInteger=(vertresolution & 0xFFFF0000) >> 16;
  double verticalFraction=(vertresolution & 0xFFFF) / Math.pow(2,4);
  directory.setDouble(Mp4VideoDirectory.TAG_VERTICAL_RESOLUTION,verticalInteger + verticalFraction);
}
Program: 92868
Project: 92868
Buggy source:
private String getDepthDescription(){
  Integer value=_directory.getInteger(TAG_DEPTH);
  if (value == null)   return null;
switch (value) {
case (40):
case (36):
case (34):
    return (value - 32) + "String_Node_Str";
default :
  return "String_Node_Str" + value + "String_Node_Str";
}
}

Fixed version (ground truth):
private String getDepthDescription(){
  Integer value=_directory.getInteger(TAG_DEPTH);
  if (value == null)   return null;
switch (value) {
case (1):
case (2):
case (4):
case (8):
case (16):
case (24):
case (32):
    return value + "String_Node_Str";
case (40):
case (36):
case (34):
  return (value - 32) + "String_Node_Str";
default :
return "String_Node_Str" + value + "String_Node_Str";
}
}
Program: 92869
Project: 92869
Buggy source:
@Nullable private double getDistanceInMeters(int val){
  return 0.01 * Math.pow(10,val / 40.0f);
}

Fixed version (ground truth):
@Nullable private double getDistanceInMeters(int val){
  if (val < 0)   val+=256;
  return 0.01 * Math.pow(10,val / 40.0f);
}
Program: 92870
Project: 92870
Buggy source:
@Override protected QtHandler processAtom(@NotNull Atom atom,@Nullable byte[] payload) throws IOException {
  if (payload != null) {
    SequentialByteArrayReader reader=new SequentialByteArrayReader(payload);
    if (atom.type.equals(QtAtomTypes.ATOM_DATA) && currentData != null) {
      processData(payload,reader);
    }
 else {
      currentData=new String(reader.getBytes(4));
    }
  }
 else {
    if (QtMetadataDirectory._tagIntegerMap.containsKey(atom)) {
      currentData=atom.type;
    }
 else {
      currentData=null;
    }
  }
  return this;
}

Fixed version (ground truth):
@Override protected QtHandler processAtom(@NotNull Atom atom,@Nullable byte[] payload) throws IOException {
  if (payload != null) {
    SequentialByteArrayReader reader=new SequentialByteArrayReader(payload);
    if (atom.type.equals(QtAtomTypes.ATOM_DATA) && currentData != null) {
      processData(payload,reader);
    }
 else {
      currentData=new String(reader.getBytes(4));
    }
  }
 else {
    if (QtMetadataDirectory._tagIntegerMap.containsKey(atom.type)) {
      currentData=atom.type;
    }
 else {
      currentData=null;
    }
  }
  return this;
}
Program: 92871
Project: 92871
Buggy source:
@Override protected boolean shouldAcceptContainer(@NotNull Atom atom){
  return QtMetadataDirectory._tagIntegerMap.containsKey(atom) || atom.type.equals(QtContainerTypes.ATOM_METADATA_LIST);
}

Fixed version (ground truth):
@Override protected boolean shouldAcceptContainer(@NotNull Atom atom){
  return QtMetadataDirectory._tagIntegerMap.containsKey(atom.type) || atom.type.equals(QtContainerTypes.ATOM_METADATA_LIST);
}
Program: 92873
Project: 92873
Buggy source:
private static GifImageDirectory readImageBlock(SequentialReader reader) throws IOException {
  GifImageDirectory imageDirectory=new GifImageDirectory();
  imageDirectory.setInt(GifImageDirectory.TAG_LEFT,reader.getUInt16());
  imageDirectory.setInt(GifImageDirectory.TAG_TOP,reader.getUInt16());
  imageDirectory.setInt(GifImageDirectory.TAG_WIDTH,reader.getUInt16());
  imageDirectory.setInt(GifImageDirectory.TAG_HEIGHT,reader.getUInt16());
  byte flags=reader.getByte();
  boolean hasColorTable=(flags & 0x7) != 0;
  boolean isInterlaced=(flags & 0x40) != 0;
  boolean isColorTableSorted=(flags & 0x20) != 0;
  imageDirectory.setBoolean(GifImageDirectory.TAG_HAS_LOCAL_COLOUR_TABLE,hasColorTable);
  imageDirectory.setBoolean(GifImageDirectory.TAG_IS_INTERLACED,isInterlaced);
  if (hasColorTable) {
    imageDirectory.setBoolean(GifImageDirectory.TAG_IS_COLOR_TABLE_SORTED,isColorTableSorted);
    int bitsPerPixel=(flags & 0x7) + 1;
    imageDirectory.setInt(GifImageDirectory.TAG_LOCAL_COLOUR_TABLE_BITS_PER_PIXEL,bitsPerPixel);
    reader.skip(3 * (2 << (flags & 0x7)));
  }
  reader.getByte();
  return imageDirectory;
}

Fixed version (ground truth):
private static GifImageDirectory readImageBlock(SequentialReader reader) throws IOException {
  GifImageDirectory imageDirectory=new GifImageDirectory();
  imageDirectory.setInt(GifImageDirectory.TAG_LEFT,reader.getUInt16());
  imageDirectory.setInt(GifImageDirectory.TAG_TOP,reader.getUInt16());
  imageDirectory.setInt(GifImageDirectory.TAG_WIDTH,reader.getUInt16());
  imageDirectory.setInt(GifImageDirectory.TAG_HEIGHT,reader.getUInt16());
  byte flags=reader.getByte();
  boolean hasColorTable=(flags >> 7) != 0;
  boolean isInterlaced=(flags & 0x40) != 0;
  imageDirectory.setBoolean(GifImageDirectory.TAG_HAS_LOCAL_COLOUR_TABLE,hasColorTable);
  imageDirectory.setBoolean(GifImageDirectory.TAG_IS_INTERLACED,isInterlaced);
  if (hasColorTable) {
    boolean isColorTableSorted=(flags & 0x20) != 0;
    imageDirectory.setBoolean(GifImageDirectory.TAG_IS_COLOR_TABLE_SORTED,isColorTableSorted);
    int bitsPerPixel=(flags & 0x7) + 1;
    imageDirectory.setInt(GifImageDirectory.TAG_LOCAL_COLOUR_TABLE_BITS_PER_PIXEL,bitsPerPixel);
    reader.skip(3 * (2 << (flags & 0x7)));
  }
  reader.getByte();
  return imageDirectory;
}
Program: 92874
Project: 92874
Buggy source:
private static byte[] gatherBytes(SequentialReader reader,int firstLength) throws IOException {
  ByteArrayOutputStream buffer=new ByteArrayOutputStream();
  int length=firstLength;
  while (length > 0) {
    buffer.write(reader.getBytes(length),0,length);
    length=reader.getByte();
  }
  return buffer.toByteArray();
}

Fixed version (ground truth):
private static byte[] gatherBytes(SequentialReader reader,int firstLength) throws IOException {
  ByteArrayOutputStream buffer=new ByteArrayOutputStream();
  int length=firstLength;
  while (length > 0) {
    buffer.write(reader.getBytes(length),0,length);
    length=reader.getByte() & 0xff;
  }
  return buffer.toByteArray();
}
Program: 92875
Project: 92875
Buggy source:
private static void readApplicationExtensionBlock(SequentialReader reader,int blockSizeBytes,Metadata metadata) throws IOException {
  if (blockSizeBytes != 11) {
    metadata.addDirectory(new ErrorDirectory(String.format("String_Node_Str",blockSizeBytes)));
    return;
  }
  String extensionType=reader.getString(blockSizeBytes,Charsets.UTF_8);
  if (extensionType.equals("String_Node_Str")) {
    byte[] xmpBytes=gatherBytes(reader);
    new XmpReader().extract(xmpBytes,0,xmpBytes.length - 257,metadata,null);
  }
 else   if (extensionType.equals("String_Node_Str")) {
    byte[] iccBytes=gatherBytes(reader,reader.getByte());
    if (iccBytes.length != 0)     new IccReader().extract(new ByteArrayReader(iccBytes),metadata);
  }
 else   if (extensionType.equals("String_Node_Str")) {
    reader.skip(2);
    int iterationCount=reader.getUInt16();
    reader.skip(1);
    GifAnimationDirectory animationDirectory=new GifAnimationDirectory();
    animationDirectory.setInt(GifAnimationDirectory.TAG_ITERATION_COUNT,iterationCount);
    metadata.addDirectory(animationDirectory);
  }
 else {
    skipBlocks(reader);
  }
}

Fixed version (ground truth):
private static void readApplicationExtensionBlock(SequentialReader reader,int blockSizeBytes,Metadata metadata) throws IOException {
  if (blockSizeBytes != 11) {
    metadata.addDirectory(new ErrorDirectory(String.format("String_Node_Str",blockSizeBytes)));
    return;
  }
  String extensionType=reader.getString(blockSizeBytes,Charsets.UTF_8);
  if (extensionType.equals("String_Node_Str")) {
    byte[] xmpBytes=gatherBytes(reader);
    new XmpReader().extract(xmpBytes,0,xmpBytes.length - 257,metadata,null);
  }
 else   if (extensionType.equals("String_Node_Str")) {
    byte[] iccBytes=gatherBytes(reader,((int)reader.getByte()) & 0xff);
    if (iccBytes.length != 0)     new IccReader().extract(new ByteArrayReader(iccBytes),metadata);
  }
 else   if (extensionType.equals("String_Node_Str")) {
    reader.skip(2);
    int iterationCount=reader.getUInt16();
    reader.skip(1);
    GifAnimationDirectory animationDirectory=new GifAnimationDirectory();
    animationDirectory.setInt(GifAnimationDirectory.TAG_ITERATION_COUNT,iterationCount);
    metadata.addDirectory(animationDirectory);
  }
 else {
    skipBlocks(reader);
  }
}
Program: 92876
Project: 92876
Buggy source:
/** 
 * Performs the DHT tables extraction, adding found tables to the specified instance of   {@link Metadata}.
 */
public void extract(@NotNull final SequentialReader reader,@NotNull final Metadata metadata){
  HuffmanTablesDirectory directory=metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
  if (directory == null) {
    directory=new HuffmanTablesDirectory();
    metadata.addDirectory(directory);
  }
  try {
    while (reader.available() > 0) {
      byte header=reader.getByte();
      HuffmanTableClass tableClass=HuffmanTableClass.typeOf((header & 0xF0) >> 4);
      int tableDestinationId=header & 0xF;
      byte[] lBytes=getBytes(reader,16);
      int vCount=0;
      for (      byte b : lBytes) {
        vCount+=b;
      }
      byte[] vBytes=getBytes(reader,vCount);
      directory.getTables().add(new HuffmanTable(tableClass,tableDestinationId,lBytes,vBytes));
    }
  }
 catch (  IOException me) {
    directory.addError(me.getMessage());
  }
  directory.setInt(HuffmanTablesDirectory.TAG_NUMBER_OF_TABLES,directory.getTables().size());
}

Fixed version (ground truth):
/** 
 * Performs the DHT tables extraction, adding found tables to the specified instance of   {@link Metadata}.
 */
public void extract(@NotNull final SequentialReader reader,@NotNull final Metadata metadata){
  HuffmanTablesDirectory directory=metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
  if (directory == null) {
    directory=new HuffmanTablesDirectory();
    metadata.addDirectory(directory);
  }
  try {
    while (reader.available() > 0) {
      byte header=reader.getByte();
      HuffmanTableClass tableClass=HuffmanTableClass.typeOf((header & 0xF0) >> 4);
      int tableDestinationId=header & 0xF;
      byte[] lBytes=getBytes(reader,16);
      int vCount=0;
      for (      byte b : lBytes) {
        vCount+=(b & 0xFF);
      }
      byte[] vBytes=getBytes(reader,vCount);
      directory.getTables().add(new HuffmanTable(tableClass,tableDestinationId,lBytes,vBytes));
    }
  }
 catch (  IOException me) {
    directory.addError(me.getMessage());
  }
  directory.setInt(HuffmanTablesDirectory.TAG_NUMBER_OF_TABLES,directory.getTables().size());
}
Program: 92877
Project: 92877
Buggy source:
/** 
 * @param tableNumber The zero-based index of the table. This number is normally between 0 and 3.Use  {@link #getNumberOfComponents} for bounds-checking.
 * @return The {@link HuffmanTable} having the specified number.
 */
@NotNull public HuffmanTable getTable(int tableNumber){
  return tables.get(tableNumber);
}

Fixed version (ground truth):
/** 
 * @param tableNumber The zero-based index of the table. This number is normally between 0 and 3.Use  {@link #getNumberOfTables} for bounds-checking.
 * @return The {@link HuffmanTable} having the specified number.
 */
@NotNull public HuffmanTable getTable(int tableNumber){
  return tables.get(tableNumber);
}
Program: 92878
Project: 92878
Buggy source:
/** 
 * Performs the DHT tables extraction, adding found tables to the specified instance of   {@link Metadata}.
 */
public void extract(@NotNull final SequentialReader reader,@NotNull final Metadata metadata){
  HuffmanTablesDirectory directory=metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
  if (directory == null) {
    directory=new HuffmanTablesDirectory();
    metadata.addDirectory(directory);
  }
  try {
    while (reader.available() > 0) {
      byte header=reader.getByte();
      HuffmanTableClass tableClass=HuffmanTableClass.typeOf((header & 0xF0) >> 4);
      int tableDestinationId=header & 0xF;
      byte[] lBytes=getBytes(reader,16);
      int vCount=0;
      for (      byte b : lBytes) {
        vCount+=b;
      }
      byte[] vBytes=getBytes(reader,vCount);
      directory.getTables().add(new HuffmanTable(tableClass,tableDestinationId,lBytes,vBytes));
    }
  }
 catch (  IOException me) {
    directory.addError(me.getMessage());
  }
  directory.setInt(HuffmanTablesDirectory.TAG_NUMBER_OF_TABLES,directory.getTables().size());
}

Fixed version (ground truth):
/** 
 * Performs the DHT tables extraction, adding found tables to the specified instance of   {@link Metadata}.
 */
public void extract(@NotNull final SequentialReader reader,@NotNull final Metadata metadata){
  HuffmanTablesDirectory directory=metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
  if (directory == null) {
    directory=new HuffmanTablesDirectory();
    metadata.addDirectory(directory);
  }
  try {
    while (reader.available() > 0) {
      byte header=reader.getByte();
      HuffmanTableClass tableClass=HuffmanTableClass.typeOf((header & 0xF0) >> 4);
      int tableDestinationId=header & 0xF;
      byte[] lBytes=getBytes(reader,16);
      int vCount=0;
      for (      byte b : lBytes) {
        vCount+=(b & 0xFF);
      }
      byte[] vBytes=getBytes(reader,vCount);
      directory.getTables().add(new HuffmanTable(tableClass,tableDestinationId,lBytes,vBytes));
    }
  }
 catch (  IOException me) {
    directory.addError(me.getMessage());
  }
  directory.setInt(HuffmanTablesDirectory.TAG_NUMBER_OF_TABLES,directory.getTables().size());
}
Program: 92879
Project: 92879
Buggy source:
private byte[] getBytes(@NotNull final SequentialReader reader,int count) throws IOException {
  byte[] bytes=new byte[count];
  for (int i=0; i < count; i++) {
    byte b=reader.getByte();
    if (b == 0xFF) {
      byte stuffing=reader.getByte();
      if (stuffing != 0x00) {
        throw new IOException("String_Node_Str" + JpegSegmentType.fromByte(stuffing) + "String_Node_Str");
      }
    }
    bytes[i]=b;
  }
  return bytes;
}

Fixed version (ground truth):
private byte[] getBytes(@NotNull final SequentialReader reader,int count) throws IOException {
  byte[] bytes=new byte[count];
  for (int i=0; i < count; i++) {
    byte b=reader.getByte();
    if ((b & 0xFF) == 0xFF) {
      byte stuffing=reader.getByte();
      if (stuffing != 0x00) {
        throw new IOException("String_Node_Str" + JpegSegmentType.fromByte(stuffing) + "String_Node_Str");
      }
    }
    bytes[i]=b;
  }
  return bytes;
}
Program: 92880
Project: 92880
Buggy source:
private byte[] getBytes(@NotNull final SequentialReader reader,int count) throws IOException {
  byte[] bytes=new byte[count];
  for (int i=0; i < count; i++) {
    byte b=reader.getByte();
    if (b == 0xFF) {
      byte stuffing=reader.getByte();
      if (stuffing != 0x00) {
        throw new IOException("String_Node_Str" + JpegSegmentType.fromByte(stuffing) + "String_Node_Str");
      }
    }
    bytes[i]=b;
  }
  return bytes;
}

Fixed version (ground truth):
private byte[] getBytes(@NotNull final SequentialReader reader,int count) throws IOException {
  byte[] bytes=new byte[count];
  for (int i=0; i < count; i++) {
    byte b=reader.getByte();
    if ((b & 0xFF) == 0xFF) {
      byte stuffing=reader.getByte();
      if (stuffing != 0x00) {
        throw new IOException("String_Node_Str" + JpegSegmentType.fromByte(stuffing) + "String_Node_Str");
      }
    }
    bytes[i]=b;
  }
  return bytes;
}
Program: 92881
Project: 92881
Buggy source:
public void error(@NotNull String message){
  _currentDirectory.addError(message);
}

Fixed version (ground truth):
public void error(@NotNull String message){
  getCurrentOrErrorDirectory().addError(message);
}
Program: 92882
Project: 92882
Buggy source:
public void warn(@NotNull String message){
  _currentDirectory.addError(message);
}

Fixed version (ground truth):
public void warn(@NotNull String message){
  getCurrentOrErrorDirectory().addError(message);
}
Program: 92884
Project: 92884
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void setDate(@NotNull final IccDirectory directory,final int tagType,@NotNull RandomAccessReader reader) throws IOException {
  final int y=reader.getUInt16(tagType);
  final int m=reader.getUInt16(tagType + 2);
  final int d=reader.getUInt16(tagType + 4);
  final int h=reader.getUInt16(tagType + 6);
  final int M=reader.getUInt16(tagType + 8);
  final int s=reader.getUInt16(tagType + 10);
  if (DateUtil.isValidDate(y,m,d) && DateUtil.isValidTime(h,M,s)) {
    Calendar calendar=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
    calendar.set(y,m,d,h,M,s);
    directory.setDate(tagType,calendar.getTime());
  }
 else {
    directory.addError(String.format("String_Node_Str",y,m,d,h,M,s));
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void setDate(@NotNull final IccDirectory directory,final int tagType,@NotNull RandomAccessReader reader) throws IOException {
  final int y=reader.getUInt16(tagType);
  final int m=reader.getUInt16(tagType + 2);
  final int d=reader.getUInt16(tagType + 4);
  final int h=reader.getUInt16(tagType + 6);
  final int M=reader.getUInt16(tagType + 8);
  final int s=reader.getUInt16(tagType + 10);
  if (DateUtil.isValidDate(y,m - 1,d) && DateUtil.isValidTime(h,M,s)) {
    Calendar calendar=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
    calendar.set(y,m - 1,d,h,M,s);
    directory.setDate(tagType,calendar.getTime());
  }
 else {
    directory.addError(String.format("String_Node_Str",y,m,d,h,M,s));
  }
}
Program: 92885
Project: 92885
Buggy source:
@Nullable private String getDctEncodeVersionDescription(){
  Integer value=_directory.getInteger(AdobeJpegDirectory.TAG_COLOR_TRANSFORM);
  return value == null ? null : value == 0x64 ? "String_Node_Str" : Integer.toString(value);
}

Fixed version (ground truth):
@Nullable private String getDctEncodeVersionDescription(){
  Integer value=_directory.getInteger(AdobeJpegDirectory.TAG_DCT_ENCODE_VERSION);
  return value == null ? null : value == 0x64 ? "String_Node_Str" : Integer.toString(value);
}
Program: 92888
Project: 92888
Buggy source:
@Nullable public String getApertureValueDescription(){
  Double aperture=_directory.getDoubleObject(TAG_APERTURE);
  if (aperture == null)   return null;
  double fStop=PhotographicConversions.apertureToFStop(aperture);
  return "String_Node_Str" + SimpleDecimalFormatter.format(fStop);
}

Fixed version (ground truth):
@Nullable public String getApertureValueDescription(){
  Double aperture=_directory.getDoubleObject(TAG_APERTURE);
  if (aperture == null)   return null;
  double fStop=PhotographicConversions.apertureToFStop(aperture);
  return "String_Node_Str" + SimpleDecimalFormatterWithPrecision.format(fStop);
}
Program: 92889
Project: 92889
Buggy source:
@Nullable public String getMaxApertureValueDescription(){
  Double aperture=_directory.getDoubleObject(TAG_MAX_APERTURE);
  if (aperture == null)   return null;
  double fStop=PhotographicConversions.apertureToFStop(aperture);
  return "String_Node_Str" + SimpleDecimalFormatter.format(fStop);
}

Fixed version (ground truth):
@Nullable public String getMaxApertureValueDescription(){
  Double aperture=_directory.getDoubleObject(TAG_MAX_APERTURE);
  if (aperture == null)   return null;
  double fStop=PhotographicConversions.apertureToFStop(aperture);
  return "String_Node_Str" + SimpleDecimalFormatterWithPrecision.format(fStop);
}
Program: 92890
Project: 92890
Buggy source:
@Nullable public String getWhiteBalanceDescription(){
  final Integer value=_directory.getInteger(TAG_WHITE_BALANCE);
  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 10:
return "String_Node_Str";
case 17:
return "String_Node_Str";
case 18:
return "String_Node_Str";
case 19:
return "String_Node_Str";
case 20:
return "String_Node_Str";
case 21:
return "String_Node_Str";
case 22:
return "String_Node_Str";
case 255:
return "String_Node_Str";
default :
return "String_Node_Str" + value + "String_Node_Str";
}
}

Fixed version (ground truth):
@Nullable public String getWhiteBalanceDescription(){
  final Integer value=_directory.getInteger(TAG_WHITE_BALANCE);
  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 9:
return "String_Node_Str";
case 10:
return "String_Node_Str";
case 11:
return "String_Node_Str";
case 12:
return "String_Node_Str";
case 13:
return "String_Node_Str";
case 14:
return "String_Node_Str";
case 15:
return "String_Node_Str";
case 16:
return "String_Node_Str";
case 17:
return "String_Node_Str";
case 18:
return "String_Node_Str";
case 19:
return "String_Node_Str";
case 20:
return "String_Node_Str";
case 21:
return "String_Node_Str";
case 22:
return "String_Node_Str";
case 23:
return "String_Node_Str";
case 24:
return "String_Node_Str";
case 255:
return "String_Node_Str";
default :
return "String_Node_Str" + value + "String_Node_Str";
}
}
Program: 92891
Project: 92891
Buggy source:
@Nullable public String getImageTypeDescription(){
  Integer type=_directory.getInteger(IcoDirectory.TAG_IMAGE_TYPE);
  if (type == null)   return null;
  return getIndexedDescription(type,1,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Nullable public String getImageTypeDescription(){
  return getIndexedDescription(IcoDirectory.TAG_IMAGE_TYPE,1,"String_Node_Str","String_Node_Str");
}
Program: 92892
Project: 92892
Buggy source:
public void extract(@NotNull final RandomAccessReader reader,@NotNull final Metadata metadata){
  PhotoshopDirectory directory=new PhotoshopDirectory();
  metadata.addDirectory(directory);
  final int preambleLength=PREAMBLE.length();
  int pos;
  try {
    pos=reader.getString(0,preambleLength).equals(PREAMBLE) ? preambleLength + 1 : 0;
  }
 catch (  IOException e) {
    directory.addError("String_Node_Str");
    return;
  }
  long length;
  try {
    length=reader.getLength();
  }
 catch (  IOException e) {
    directory.addError("String_Node_Str" + e.getMessage());
    return;
  }
  while (pos < length) {
    try {
      pos+=4;
      int tagType=reader.getUInt16(pos);
      pos+=2;
      int descriptionLength=reader.getUInt16(pos);
      pos+=2;
      if (descriptionLength < 0 || descriptionLength + pos > length)       return;
      pos+=descriptionLength;
      if (pos % 2 != 0)       pos++;
      int byteCount=reader.getInt32(pos);
      pos+=4;
      byte[] tagBytes=reader.getBytes(pos,byteCount);
      pos+=byteCount;
      if (pos % 2 != 0)       pos++;
      directory.setByteArray(tagType,tagBytes);
      if (tagType == PhotoshopDirectory.TAG_IPTC)       new IptcReader().extract(new SequentialByteArrayReader(tagBytes),metadata,tagBytes.length);
      if (tagType >= 0x0fa0 && tagType <= 0x1387)       PhotoshopDirectory._tagNameMap.put(tagType,String.format("String_Node_Str",tagType - 0x0fa0 + 1));
    }
 catch (    IOException ex) {
      directory.addError(ex.getMessage());
      return;
    }
  }
}

Fixed version (ground truth):
public void extract(@NotNull final RandomAccessReader reader,@NotNull final Metadata metadata){
  PhotoshopDirectory directory=new PhotoshopDirectory();
  metadata.addDirectory(directory);
  final int preambleLength=PREAMBLE.length();
  int pos;
  try {
    pos=reader.getString(0,preambleLength).equals(PREAMBLE) ? preambleLength + 1 : 0;
  }
 catch (  IOException e) {
    directory.addError("String_Node_Str");
    return;
  }
  long length;
  try {
    length=reader.getLength();
  }
 catch (  IOException e) {
    directory.addError("String_Node_Str" + e.getMessage());
    return;
  }
  while (pos < length) {
    try {
      pos+=4;
      int tagType=reader.getUInt16(pos);
      pos+=2;
      short descriptionLength=reader.getUInt8();
      pos+=1;
      if (descriptionLength < 0 || descriptionLength + pos > length)       return;
      pos+=descriptionLength;
      if (pos % 2 != 0)       pos++;
      int byteCount=reader.getInt32(pos);
      pos+=4;
      byte[] tagBytes=reader.getBytes(pos,byteCount);
      pos+=byteCount;
      if (pos % 2 != 0)       pos++;
      directory.setByteArray(tagType,tagBytes);
      if (tagType == PhotoshopDirectory.TAG_IPTC)       new IptcReader().extract(new SequentialByteArrayReader(tagBytes),metadata,tagBytes.length);
      if (tagType >= 0x0fa0 && tagType <= 0x1387)       PhotoshopDirectory._tagNameMap.put(tagType,String.format("String_Node_Str",tagType - 0x0fa0 + 1));
    }
 catch (    IOException ex) {
      directory.addError(ex.getMessage());
      return;
    }
  }
}
Program: 92893
Project: 92893
Buggy source:
/** 
 * Reads   {@link Metadata} from a {@link File} object.<p/> The file type is determined by inspecting the leading bytes of the stream, and parsing of the file is delegated to one of: <ul> <li> {@link JpegMetadataReader} for JPEG files</li><li> {@link TiffMetadataReader} for TIFF and (most) RAW files</li><li> {@link PsdMetadataReader} for Photoshop files</li><li> {@link PngMetadataReader} for PNG files</li><li> {@link BmpMetadataReader} for BMP files</li><li> {@link GifMetadataReader} for GIF files</li></ul>
 * @param file a file from which the image data may be read.
 * @return a populated {@link Metadata} object containing directories of tags with values and any processing errors.
 * @throws ImageProcessingException for general processing errors.
 */
@NotNull public static Metadata readMetadata(@NotNull final File file) throws ImageProcessingException, IOException {
  InputStream inputStream=new FileInputStream(file);
  try {
    return readMetadata(inputStream);
  }
  finally {
    inputStream.close();
  }
}

Fixed version (ground truth):
/** 
 * Reads   {@link Metadata} from a {@link File} object.<p> The file type is determined by inspecting the leading bytes of the stream, and parsing of the file is delegated to one of: <ul> <li> {@link JpegMetadataReader} for JPEG files</li><li> {@link TiffMetadataReader} for TIFF and (most) RAW files</li><li> {@link PsdMetadataReader} for Photoshop files</li><li> {@link PngMetadataReader} for PNG files</li><li> {@link BmpMetadataReader} for BMP files</li><li> {@link GifMetadataReader} for GIF files</li></ul>
 * @param file a file from which the image data may be read.
 * @return a populated {@link Metadata} object containing directories of tags with values and any processing errors.
 * @throws ImageProcessingException for general processing errors.
 */
@NotNull public static Metadata readMetadata(@NotNull final File file) throws ImageProcessingException, IOException {
  InputStream inputStream=new FileInputStream(file);
  try {
    return readMetadata(inputStream);
  }
  finally {
    inputStream.close();
  }
}
Program: 92895
Project: 92895
Buggy source:
/** 
 * Gets segment data for a specific occurrence and type.  Use this method when more than one occurrence of segment data for a given type exists.
 * @param segmentType identifies the required segment
 * @param occurrence  the zero-based index of the occurrence
 * @return the segment data as a byte[], or null if no segment exists for the type & occurrence
 */
@Nullable public byte[] getSegment(byte segmentType,int occurrence){
  final List<byte[]> segmentList=getSegmentList(segmentType);
  return segmentList != null && segmentList.size() > occurrence ? segmentList.get(occurrence) : null;
}

Fixed version (ground truth):
/** 
 * Gets segment data for a specific occurrence and type.  Use this method when more than one occurrence of segment data for a given type exists.
 * @param segmentType identifies the required segment
 * @param occurrence  the zero-based index of the occurrence
 * @return the segment data as a byte[], or null if no segment exists for the type &amp; occurrence
 */
@Nullable public byte[] getSegment(byte segmentType,int occurrence){
  final List<byte[]> segmentList=getSegmentList(segmentType);
  return segmentList != null && segmentList.size() > occurrence ? segmentList.get(occurrence) : null;
}
Program: 92897
Project: 92897
Buggy source:
/** 
 * Receives the 2-byte marker found in the TIFF header. <p/> Implementations are not obligated to use this information for any purpose, though it may be useful for validation or perhaps differentiating the type of mapping to use for observed tags and IFDs.
 * @param marker the 2-byte value found at position 2 of the TIFF header
 */
void setTiffMarker(int marker) throws TiffProcessingException ;

Fixed version (ground truth):
/** 
 * Receives the 2-byte marker found in the TIFF header. <p> Implementations are not obligated to use this information for any purpose, though it may be useful for validation or perhaps differentiating the type of mapping to use for observed tags and IFDs.
 * @param marker the 2-byte value found at position 2 of the TIFF header
 */
void setTiffMarker(int marker) throws TiffProcessingException ;
Program: 92899
Project: 92899
Buggy source:
/** 
 * Gets the byte value at the specified byte <code>index</code>. <p/> Implementations should not perform any bounds checking in this method. That should be performed in <code>validateIndex</code> and <code>isValidIndex</code>.
 * @param index The index from which to read the byte
 * @return The read byte value
 * @throws IllegalArgumentException <code>index</code> or <code>count</code> are negative
 * @throws BufferBoundsException if the requested byte is beyond the end of the underlying data source
 * @throws IOException if the byte is unable to be read
 */
protected abstract byte getByte(int index) throws IOException ;

Fixed version (ground truth):
/** 
 * Gets the byte value at the specified byte <code>index</code>. <p> Implementations should not perform any bounds checking in this method. That should be performed in <code>validateIndex</code> and <code>isValidIndex</code>.
 * @param index The index from which to read the byte
 * @return The read byte value
 * @throws IllegalArgumentException <code>index</code> or <code>count</code> are negative
 * @throws BufferBoundsException if the requested byte is beyond the end of the underlying data source
 * @throws IOException if the byte is unable to be read
 */
protected abstract byte getByte(int index) throws IOException ;
Program: 92900
Project: 92900
Buggy source:
/** 
 * Returns the length of the data source in bytes. <p/> This is a simple operation for implementations (such as   {@link RandomAccessFileReader} and{@link ByteArrayReader}) that have the entire data source available. <p/> Users of this method must be aware that sequentially accessed implementations such as  {@link RandomAccessStreamReader} will have to read and buffer the entire data source inorder to determine the length.
 * @return the length of the data source, in bytes.
 */
public abstract long getLength() throws IOException ;

Fixed version (ground truth):
/** 
 * Returns the length of the data source in bytes. <p> This is a simple operation for implementations (such as   {@link RandomAccessFileReader} and{@link ByteArrayReader}) that have the entire data source available. <p> Users of this method must be aware that sequentially accessed implementations such as  {@link RandomAccessStreamReader} will have to read and buffer the entire data source inorder to determine the length.
 * @return the length of the data source, in bytes.
 */
public abstract long getLength() throws IOException ;
Program: 92901
Project: 92901
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, or index is negative
 */
public float getS15Fixed16(int index) throws IOException {
  validateIndex(index,4);
  if (_isMotorolaByteOrder) {
    float res=(getByte(index) & 0xFF) << 8 | (getByte(index + 1) & 0xFF);
    int d=(getByte(index + 2) & 0xFF) << 8 | (getByte(index + 3) & 0xFF);
    return (float)(res + d / 65536.0);
  }
 else {
    float res=(getByte(index + 3) & 0xFF) << 8 | (getByte(index + 2) & 0xFF);
    int d=(getByte(index + 1) & 0xFF) << 8 | (getByte(index) & 0xFF);
    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, or index is negative
 */
public float getS15Fixed16(int index) throws IOException {
  validateIndex(index,4);
  if (_isMotorolaByteOrder) {
    float res=(getByte(index) & 0xFF) << 8 | (getByte(index + 1) & 0xFF);
    int d=(getByte(index + 2) & 0xFF) << 8 | (getByte(index + 3) & 0xFF);
    return (float)(res + d / 65536.0);
  }
 else {
    float res=(getByte(index + 3) & 0xFF) << 8 | (getByte(index + 2) & 0xFF);
    int d=(getByte(index + 1) & 0xFF) << 8 | (getByte(index) & 0xFF);
    return (float)(res + d / 65536.0);
  }
}