nus-yam/ex-repair huggingface dataset:
Program: 92406
Project: 92406
Buggy source:
public CtfTmfEvent getCurrentEvent(){
  final StreamInputReader top=super.prio.peek();
  if (top != null)   return new CtfTmfEvent(top.getCurrentEvent(),top.getFilename(),ctfTmfTrace);
  return null;
}

Fixed version (ground truth):
public CtfTmfEvent getCurrentEvent(){
  final StreamInputReader top=super.prio.peek();
  if (top != null) {
    return new CtfTmfEvent(top.getCurrentEvent(),top.getFilename(),ctfTmfTrace);
  }
  return null;
}
Program: 92407
Project: 92407
Buggy source:
@Override public int compareTo(final CtfIterator o){
  if (this.getRank() < o.getRank())   return -1;
 else   if (this.getRank() > o.getRank())   return 1;
  return 0;
}

Fixed version (ground truth):
@Override public int compareTo(final CtfIterator o){
  if (this.getRank() < o.getRank()) {
    return -1;
  }
 else   if (this.getRank() > o.getRank()) {
    return 1;
  }
  return 0;
}
Program: 92408
Project: 92408
Buggy source:
@Override public boolean seek(final long timestamp){
  boolean ret=false;
  final long offsetTimestamp=timestamp - this.getCtfTmfTrace().getCTFTrace().getOffset();
  if (offsetTimestamp < 0)   ret=super.seek(timestamp);
 else   ret=super.seek(offsetTimestamp);
  if (ret)   curLocation.setLocation(getCurrentEvent().getTimestampValue());
  return ret;
}

Fixed version (ground truth):
@Override public boolean seek(final long timestamp){
  boolean ret=false;
  final long offsetTimestamp=timestamp - this.getCtfTmfTrace().getCTFTrace().getOffset();
  if (offsetTimestamp < 0) {
    ret=super.seek(timestamp);
  }
 else {
    ret=super.seek(offsetTimestamp);
  }
  if (ret) {
    curLocation.setLocation(getCurrentEvent().getTimestampValue());
  }
  return ret;
}
Program: 92409
Project: 92409
Buggy source:
public CtfIterator(final CtfTmfTrace trace,final long timestampValue,final long rank){
  super(trace.getCTFTrace());
  this.ctfTmfTrace=trace;
  this.curLocation=(new CtfLocation(this.getCurrentEvent().getTimestampValue()));
  if (this.getCurrentEvent().getTimestampValue() != timestampValue)   this.seek(timestampValue);
  this.curRank=rank;
}

Fixed version (ground truth):
public CtfIterator(final CtfTmfTrace trace,final long timestampValue,final long rank){
  super(trace.getCTFTrace());
  this.ctfTmfTrace=trace;
  if (this.hasMoreEvents()) {
    this.curLocation=(new CtfLocation(this.getCurrentEvent().getTimestampValue()));
    if (this.getCurrentEvent().getTimestampValue() != timestampValue) {
      this.seek(timestampValue);
      this.curRank=rank;
    }
  }
 else {
    setUnknownLocation();
  }
}
Program: 92410
Project: 92410
Buggy source:
@Override public void initTrace(final IResource resource,final String path,final Class<CtfTmfEvent> eventType) throws TmfTraceException {
  this.fResource=resource;
  try {
    this.fTrace=new CTFTrace(path);
  }
 catch (  final CTFReaderException e) {
    throw new TmfTraceException(e.getMessage());
  }
  this.iterator=new CtfIterator(this,0,0);
  setStartTime(iterator.getCurrentEvent().getTimestamp());
  TmfSignalManager.register(this);
  buildStateSystem();
  if (resource != null) {
    try {
      resource.getProject().refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      throw new TmfTraceException(e.getMessage());
    }
  }
}

Fixed version (ground truth):
@Override public void initTrace(final IResource resource,final String path,final Class<CtfTmfEvent> eventType) throws TmfTraceException {
  this.fResource=resource;
  try {
    this.fTrace=new CTFTrace(path);
  }
 catch (  final CTFReaderException e) {
    throw new TmfTraceException(e.getMessage());
  }
  this.iterator=new CtfIterator(this,0,0);
  setStartTime(TmfTimestamp.BIG_BANG);
  if (!this.iterator.getLocation().equals(CtfIterator.nullLocation)) {
    setStartTime(iterator.getCurrentEvent().getTimestamp());
  }
  TmfSignalManager.register(this);
  buildStateSystem();
  if (resource != null) {
    try {
      resource.getProject().refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      throw new TmfTraceException(e.getMessage());
    }
  }
}
Program: 92411
Project: 92411
Buggy source:
@Override public void read(BitBuffer input){
  integerValue.read(input);
  long val=integerValue.getValue();
  value=declaration.query(val);
}

Fixed version (ground truth):
@Override public void read(BitBuffer input){
  int align=(int)declaration.getAlignment();
  int pos=input.position() + ((align - (input.position() % align)) % align);
  input.position(pos);
  integerValue.read(input);
  long val=integerValue.getValue();
  value=declaration.query(val);
}
Program: 92412
Project: 92412
Buggy source:
@Override public void read(BitBuffer input){
  boolean signed=declaration.isSigned();
  int length=declaration.getLength();
  long bits=0;
  if (length == 64) {
    long low=input.getInt(32,false);
    low=low & 0x00000000FFFFFFFFL;
    long high=input.getInt(32,false);
    high=high & 0x00000000FFFFFFFFL;
    bits=(high << 32) | low;
  }
 else {
    bits=input.getInt(length,signed);
    bits=bits & 0x00000000FFFFFFFFL;
  }
  value=bits;
}

Fixed version (ground truth):
@Override public void read(BitBuffer input){
  int align=(int)declaration.getAlignment();
  int pos=input.position() + ((align - (input.position() % align)) % align);
  input.position(pos);
  boolean signed=declaration.isSigned();
  int length=declaration.getLength();
  long bits=0;
  if (length == 64) {
    long low=input.getInt(32,false);
    low=low & 0x00000000FFFFFFFFL;
    long high=input.getInt(32,false);
    high=high & 0x00000000FFFFFFFFL;
    bits=(high << 32) | low;
  }
 else {
    bits=input.getInt(length,signed);
    bits=bits & 0x00000000FFFFFFFFL;
  }
  value=bits;
}
Program: 92413
Project: 92413
Buggy source:
@Override public long getAlignment(){
  return getMinAlign();
}

Fixed version (ground truth):
@Override public long getAlignment(){
  return this.maxAlign;
}
Program: 92414
Project: 92414
Buggy source:
public void addField(String name,IDeclaration declaration){
  this.fields.put(name,declaration);
  this.fieldsList.add(name);
}

Fixed version (ground truth):
public void addField(String name,IDeclaration declaration){
  this.fields.put(name,declaration);
  this.fieldsList.add(name);
  maxAlign=Math.max(maxAlign,declaration.getAlignment());
  if (maxAlign == 1) {
    maxAlign=1;
  }
}
Program: 92415
Project: 92415
Buggy source:
public StructDeclaration(long minAlign){
  this.minAlign=minAlign;
}

Fixed version (ground truth):
public StructDeclaration(long align){
  this.maxAlign=Math.max(align,1);
}
Program: 92416
Project: 92416
Buggy source:
@Override public void read(BitBuffer input){
  for (  String fName : declaration.getFieldsList()) {
    Definition def=definitions.get(fName);
    assert(def != null);
    def.read(input);
  }
}

Fixed version (ground truth):
@Override public void read(BitBuffer input){
  final int align=(int)declaration.getAlignment();
  int pos=input.position() + ((align - (input.position() % align)) % align);
  input.position(pos);
  final List<String> fieldList=declaration.getFieldsList();
  for (  String fName : fieldList) {
    Definition def=definitions.get(fName);
    assert(def != null);
    def.read(input);
  }
}
Program: 92417
Project: 92417
Buggy source:
public void addField(String fieldTag,IDeclaration declaration){
  fields.put(fieldTag,declaration);
  alignment=Math.max(alignment,declaration.getAlignment());
}

Fixed version (ground truth):
public void addField(String fieldTag,IDeclaration declaration){
  fields.put(fieldTag,declaration);
}
Program: 92418
Project: 92418
Buggy source:
public boolean seekIndex(long index){
  this.prio.clear();
  long tempIndex=Long.MIN_VALUE;
  long tempTimestamp=Long.MIN_VALUE;
  try {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      final long streamIndex=streamInputReader.seekIndex(index);
      tempIndex=Math.max(tempIndex,streamIndex);
      tempTimestamp=Math.max(tempTimestamp,streamInputReader.getCurrentEvent().timestamp);
    }
  }
 catch (  CTFReaderException e) {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      streamInputReader.seek(0);
    }
    tempIndex=0;
  }
  for (  StreamInputReader streamInputReader : this.streamInputReaders) {
    if (streamInputReader.getCurrentEvent() != null) {
      this.prio.add(streamInputReader);
    }
  }
  if (tempIndex == Long.MAX_VALUE) {
    tempIndex=0;
  }
  long pos=tempIndex;
  if (index > tempIndex) {
    while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp) && hasMoreEvents()) {
      this.advance();
    }
    for (pos=tempIndex; (pos < index) && hasMoreEvents(); pos++) {
      this.advance();
    }
  }
  this.fIndex=pos;
  return hasMoreEvents();
}

Fixed version (ground truth):
public boolean seekIndex(long index){
  this.prio.clear();
  long tempIndex=Long.MIN_VALUE;
  long tempTimestamp=Long.MIN_VALUE;
  try {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      final long streamIndex=streamInputReader.seekIndex(index);
      tempIndex=Math.max(tempIndex,streamIndex);
      EventDefinition currentEvent=streamInputReader.getCurrentEvent();
      if (currentEvent == null) {
        streamInputReader.readNextEvent();
        currentEvent=streamInputReader.getCurrentEvent();
      }
      if (currentEvent != null) {
        tempTimestamp=Math.max(tempTimestamp,currentEvent.timestamp);
      }
 else {
        tempIndex=goToZero();
      }
    }
  }
 catch (  CTFReaderException e) {
    tempIndex=goToZero();
  }
  for (  StreamInputReader streamInputReader : this.streamInputReaders) {
    if (streamInputReader.getCurrentEvent() != null) {
      this.prio.add(streamInputReader);
    }
  }
  if (tempIndex == Long.MAX_VALUE) {
    tempIndex=0;
  }
  long pos=tempIndex;
  if (index > tempIndex) {
    while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp) && hasMoreEvents()) {
      this.advance();
    }
    for (pos=tempIndex; (pos < index) && hasMoreEvents(); pos++) {
      this.advance();
    }
  }
  this.fIndex=pos;
  return hasMoreEvents();
}
Program: 92421
Project: 92421
Buggy source:
/** 
 * Creates a "lost" event. This is a synthetic event that is there to show that there should be something there.
 * @return
 */
public static EventDeclaration getLostEventDeclaration(){
  if (lostEvent == null) {
    lostEvent=new EventDeclaration();
    lostEvent.fields=new StructDeclaration(1);
    lostEvent.id=(long)-1;
    lostEvent.name="String_Node_Str";
  }
  return lostEvent;
}

Fixed version (ground truth):
/** 
 * Creates a "lost" event. This is a synthetic event that is there to show that there should be something there.
 * @return
 */
public synchronized static EventDeclaration getLostEventDeclaration(){
  EventDeclaration lostEvent=new EventDeclaration();
  lostEvent.fields=new StructDeclaration(1);
  lostEvent.id=(long)-1;
  lostEvent.name="String_Node_Str";
  return lostEvent;
}
Program: 92422
Project: 92422
Buggy source:
/** 
 * Run the long getMinAlign() method test.
 */
@Test public void testGetMinAlign(){
  long result=fixture.getMinAlign();
  assertEquals(1L,result);
}

Fixed version (ground truth):
/** 
 * Run the long getMinAlign() method test.
 */
@Test public void testGetMinAlign(){
  long result=fixture.getMaxAlign();
  assertEquals(1L,result);
}
Program: 92423
Project: 92423
Buggy source:
/** 
 * Run the StructDeclaration(long) constructor test.
 */
@Test public void testStructDeclaration(){
  assertNotNull(fixture);
  assertEquals(1L,fixture.getMinAlign());
  String regex="String_Node_Str";
  assertTrue(fixture.toString().matches(regex));
}

Fixed version (ground truth):
/** 
 * Run the StructDeclaration(long) constructor test.
 */
@Test public void testStructDeclaration(){
  assertNotNull(fixture);
  assertEquals(1L,fixture.getMaxAlign());
  String regex="String_Node_Str";
  assertTrue(fixture.toString().matches(regex));
}
Program: 92424
Project: 92424
Buggy source:
public boolean seekIndex(long index){
  this.prio.clear();
  long tempIndex=Long.MIN_VALUE;
  long tempTimestamp=Long.MIN_VALUE;
  try {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      final long streamIndex=streamInputReader.seekIndex(index);
      tempIndex=Math.max(tempIndex,streamIndex);
      EventDefinition currentEvent=streamInputReader.getCurrentEvent();
      if (currentEvent == null) {
        streamInputReader.readNextEvent();
        currentEvent=streamInputReader.getCurrentEvent();
      }
      if (currentEvent != null) {
        tempTimestamp=Math.max(tempTimestamp,currentEvent.timestamp);
      }
 else {
        tempIndex=goToZero();
      }
    }
  }
 catch (  CTFReaderException e) {
    tempIndex=goToZero();
  }
  for (  StreamInputReader streamInputReader : this.streamInputReaders) {
    if (streamInputReader.getCurrentEvent() != null) {
      this.prio.add(streamInputReader);
    }
  }
  if (tempIndex == Long.MAX_VALUE) {
    tempIndex=0;
  }
  long pos=tempIndex;
  if (index > tempIndex) {
    while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp) && hasMoreEvents()) {
      this.advance();
    }
    for (pos=tempIndex; (pos < index) && hasMoreEvents(); pos++) {
      this.advance();
    }
  }
  this.fIndex=pos;
  return hasMoreEvents();
}

Fixed version (ground truth):
public boolean seekIndex(long index){
  this.prio.clear();
  long tempIndex=Long.MIN_VALUE;
  long tempTimestamp=Long.MIN_VALUE;
  try {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      final long streamIndex=streamInputReader.seekIndex(index);
      if (streamIndex != -1) {
        tempIndex=Math.max(tempIndex,streamIndex);
        EventDefinition currentEvent=streamInputReader.getCurrentEvent();
        if (currentEvent == null) {
          streamInputReader.readNextEvent();
          currentEvent=streamInputReader.getCurrentEvent();
        }
        if (currentEvent != null) {
          tempTimestamp=Math.max(tempTimestamp,currentEvent.timestamp);
        }
 else {
          tempIndex=goToZero();
        }
      }
    }
  }
 catch (  CTFReaderException e) {
    tempIndex=goToZero();
  }
  for (  StreamInputReader streamInputReader : this.streamInputReaders) {
    if (streamInputReader.getCurrentEvent() != null) {
      this.prio.add(streamInputReader);
    }
  }
  if (tempIndex == Long.MAX_VALUE) {
    tempIndex=0;
  }
  long pos=tempIndex;
  if (index > tempIndex) {
    while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp) && hasMoreEvents()) {
      this.advance();
    }
    for (pos=tempIndex; (pos < index) && hasMoreEvents(); pos++) {
      this.advance();
    }
  }
  this.fIndex=pos;
  return hasMoreEvents();
}
Program: 92425
Project: 92425
Buggy source:
public long seekIndex(long index) throws CTFReaderException {
  this.packetIndexIt=this.streamInput.getIndex().searchIndex(index);
  goToNextPacket();
  readNextEvent();
  if (this.packetReader.getCurrentPacket() == null) {
    throw new CTFReaderException("String_Node_Str");
  }
  return this.packetReader.getCurrentPacket().getIndexBegin();
}

Fixed version (ground truth):
public long seekIndex(long index) throws CTFReaderException {
  StreamInputPacketIndexEntry sipie=null;
  this.packetIndexIt=this.streamInput.getIndex().searchIndex(index);
  goToNextPacket();
  sipie=this.packetReader.getCurrentPacket();
  readNextEvent();
  if (this.packetReader.getCurrentPacket() == null) {
    if (!((sipie.getIndexBegin() == 0) && (sipie.getIndexEnd() == Long.MAX_VALUE))) {
      throw new CTFReaderException("String_Node_Str");
    }
    return -1;
  }
  return this.packetReader.getCurrentPacket().getIndexBegin();
}
Program: 92426
Project: 92426
Buggy source:
public boolean seekIndex(long index){
  this.prio.clear();
  long tempIndex=Long.MIN_VALUE;
  long tempTimestamp=Long.MIN_VALUE;
  try {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      final long streamIndex=streamInputReader.seekIndex(index);
      if (streamIndex != -1) {
        tempIndex=Math.max(tempIndex,streamIndex);
        EventDefinition currentEvent=streamInputReader.getCurrentEvent();
        if (currentEvent == null) {
          streamInputReader.readNextEvent();
          currentEvent=streamInputReader.getCurrentEvent();
        }
        if (currentEvent != null) {
          tempTimestamp=Math.max(tempTimestamp,currentEvent.timestamp);
        }
 else {
          tempIndex=goToZero();
        }
      }
    }
  }
 catch (  CTFReaderException e) {
    tempIndex=goToZero();
  }
  for (  StreamInputReader streamInputReader : this.streamInputReaders) {
    if (streamInputReader.getCurrentEvent() != null) {
      this.prio.add(streamInputReader);
    }
  }
  if (tempIndex == Long.MAX_VALUE) {
    tempIndex=0;
  }
  long pos=tempIndex;
  if (index > tempIndex) {
    while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp) && hasMoreEvents()) {
      this.advance();
    }
    for (pos=tempIndex; (pos < index) && hasMoreEvents(); pos++) {
      this.advance();
    }
  }
  this.fIndex=pos;
  return hasMoreEvents();
}

Fixed version (ground truth):
public boolean seekIndex(long index){
  this.prio.clear();
  long tempIndex=Long.MIN_VALUE;
  long tempTimestamp=Long.MIN_VALUE;
  try {
    for (    StreamInputReader streamInputReader : this.streamInputReaders) {
      final long streamIndex=streamInputReader.seekIndex(index);
      if (streamInputReader.getCurrentEvent() != null) {
        tempIndex=Math.max(tempIndex,streamIndex);
        EventDefinition currentEvent=streamInputReader.getCurrentEvent();
        if (currentEvent == null) {
          streamInputReader.readNextEvent();
          currentEvent=streamInputReader.getCurrentEvent();
        }
        if (currentEvent != null) {
          tempTimestamp=Math.max(tempTimestamp,currentEvent.timestamp);
        }
 else {
          tempIndex=goToZero();
        }
      }
    }
  }
 catch (  CTFReaderException e) {
    tempIndex=goToZero();
  }
  for (  StreamInputReader streamInputReader : this.streamInputReaders) {
    if (streamInputReader.getCurrentEvent() != null) {
      this.prio.add(streamInputReader);
    }
  }
  if (tempIndex == Long.MAX_VALUE) {
    tempIndex=0;
  }
  long pos=tempIndex;
  if (index > tempIndex) {
    while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp) && hasMoreEvents()) {
      this.advance();
    }
    for (pos=tempIndex; (pos < index) && hasMoreEvents(); pos++) {
      this.advance();
    }
  }
  this.fIndex=pos;
  return hasMoreEvents();
}
Program: 92427
Project: 92427
Buggy source:
/** 
 * Constructs a TraceReader to read a trace.
 * @param trace The trace to read from.
 * @throws CTFReaderException
 */
public CTFTraceReader(CTFTrace trace){
  this.trace=trace;
  createStreamInputReaders();
  populateStreamInputReaderHeap();
  this.startTime=prio.peek().getCurrentEvent().timestamp;
  this.endTime=this.startTime;
  this.fIndex=0;
  startIndex=new long[prio.size()];
  for (int i=0; i < prio.size(); i++) {
    startIndex[i]=0;
  }
}

Fixed version (ground truth):
/** 
 * Constructs a TraceReader to read a trace.
 * @param trace The trace to read from.
 * @throws CTFReaderException
 */
public CTFTraceReader(CTFTrace trace){
  this.trace=trace;
  createStreamInputReaders();
  populateStreamInputReaderHeap();
  this.startTime=prio.peek().getCurrentEvent().timestamp;
  this.endTime=this.startTime;
  this.index=0;
  startIndex=new HashMap<Integer,Long>();
}
Program: 92428
Project: 92428
Buggy source:
/** 
 * Go to the next event.
 * @return True if an event was read.
 */
public boolean advance(){
  StreamInputReader top=this.prio.poll();
  if (top == null) {
    return false;
  }
  if (hasMoreEvents()) {
    StreamInputPacketReader packetReader=top.getPacketReader();
    boolean packetHasMoreEvents=packetReader.hasMoreEvents();
    StreamInputPacketIndexEntry currentPacket=packetReader.getCurrentPacket();
    if (!packetHasMoreEvents) {
      int n=this.streamInputReaders.indexOf(top);
      currentPacket.setIndexBegin(startIndex[n]);
      currentPacket.setIndexEnd(fIndex);
      startIndex[n]=fIndex + 1;
    }
  }
  if (top.readNextEvent()) {
    this.prio.add(top);
    final long topEnd=top.getCurrentEvent().timestamp;
    this.endTime=Math.max(topEnd,this.endTime);
    this.eventCountPerTraceFile[top.getName()]++;
    fIndex++;
  }
  boolean hasMoreEvents=hasMoreEvents();
  return hasMoreEvents;
}

Fixed version (ground truth):
/** 
 * Go to the next event.
 * @return True if an event was read.
 */
public boolean advance(){
  StreamInputReader top=this.prio.poll();
  if (top == null) {
    return false;
  }
  if (hasMoreEvents()) {
    StreamInputPacketReader packetReader=top.getPacketReader();
    boolean packetHasMoreEvents=packetReader.hasMoreEvents();
    StreamInputPacketIndexEntry currentPacket=packetReader.getCurrentPacket();
    if (!packetHasMoreEvents) {
      int n=this.streamInputReaders.indexOf(top);
      if (!startIndex.containsKey(n)) {
        startIndex.put(n,0L);
      }
      currentPacket.setIndexBegin(startIndex.get(n));
      currentPacket.setIndexEnd(index);
      startIndex.put(n,index + 1);
    }
  }
  if (top.readNextEvent()) {
    this.prio.add(top);
    final long topEnd=top.getCurrentEvent().timestamp;
    this.endTime=Math.max(topEnd,this.endTime);
    this.eventCountPerTraceFile[top.getName()]++;
    fIndex++;
  }
  boolean hasMoreEvents=hasMoreEvents();
  return hasMoreEvents;
}
Program: 92429
Project: 92429
Buggy source:
public long seekIndex(long index) throws CTFReaderException {
  StreamInputPacketIndexEntry sipie=null;
  this.packetIndexIt=this.streamInput.getIndex().searchIndex(index);
  goToNextPacket();
  sipie=this.packetReader.getCurrentPacket();
  readNextEvent();
  if (this.packetReader.getCurrentPacket() == null) {
    if (!((sipie.getIndexBegin() == 0) && (sipie.getIndexEnd() == Long.MAX_VALUE))) {
      throw new CTFReaderException("String_Node_Str");
    }
    return -1;
  }
  return this.packetReader.getCurrentPacket().getIndexBegin();
}

Fixed version (ground truth):
public long seekIndex(long index) throws CTFReaderException {
  StreamInputPacketIndexEntry sipie=null;
  this.packetIndexIt=this.streamInput.getIndex().searchIndex(index);
  goToNextPacket();
  sipie=this.packetReader.getCurrentPacket();
  readNextEvent();
  if (this.packetReader.getCurrentPacket() == null) {
    if (!((sipie.getIndexBegin() == 0) && (sipie.getIndexEnd() == Long.MAX_VALUE))) {
      throw new CTFReaderException("String_Node_Str");
    }
    return 0;
  }
  return this.packetReader.getCurrentPacket().getIndexBegin();
}
Program: 92430
Project: 92430
Buggy source:
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 */
@Test public void testParseField_manual2(){
  Definition fieldDef=new ArrayDefinition(new ArrayDeclaration(12,new IntegerDeclaration(32,false,32,null,null,null)),null,fieldName);
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[0]).setValue('H');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[1]).setValue('e');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[2]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[3]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[4]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[5]).setValue(' ');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[6]).setValue('W');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[7]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[8]).setValue('r');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[9]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[10]).setValue('d');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[11]).setValue(0);
  assertNotNull(fieldDef);
  String other=fieldName + "String_Node_Str";
  assertEquals(other,fieldDef.toString());
}

Fixed version (ground truth):
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 */
@Test public void testParseField_manual2(){
  Definition fieldDef=new ArrayDefinition(new ArrayDeclaration(12,new IntegerDeclaration(32,false,32,null,null,null,8)),null,fieldName);
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[0]).setValue('H');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[1]).setValue('e');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[2]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[3]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[4]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[5]).setValue(' ');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[6]).setValue('W');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[7]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[8]).setValue('r');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[9]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[10]).setValue('d');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[11]).setValue(0);
  assertNotNull(fieldDef);
  String other=fieldName + "String_Node_Str";
  assertEquals(other,fieldDef.toString());
}
Program: 92431
Project: 92431
Buggy source:
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 */
@Test public void testParseField_manual(){
  Definition fieldDef=new ArrayDefinition(new ArrayDeclaration(20,new IntegerDeclaration(8,false,8,null,Encoding.UTF8,null)),null,fieldName);
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[0]).setValue('H');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[1]).setValue('e');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[2]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[3]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[4]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[5]).setValue(' ');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[6]).setValue('W');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[7]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[8]).setValue('r');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[9]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[10]).setValue('d');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[11]).setValue(0);
  assertNotNull(fieldDef);
}

Fixed version (ground truth):
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 */
@Test public void testParseField_manual(){
  Definition fieldDef=new ArrayDefinition(new ArrayDeclaration(20,new IntegerDeclaration(8,false,8,null,Encoding.UTF8,null,8)),null,fieldName);
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[0]).setValue('H');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[1]).setValue('e');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[2]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[3]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[4]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[5]).setValue(' ');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[6]).setValue('W');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[7]).setValue('o');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[8]).setValue('r');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[9]).setValue('l');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[10]).setValue('d');
  ((IntegerDefinition)((ArrayDefinition)fieldDef).getDefinitions()[11]).setValue(0);
  assertNotNull(fieldDef);
}
Program: 92432
Project: 92432
Buggy source:
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 * @throws CTFReaderException 
 */
@Test public void testParseField_complex() throws CTFReaderException {
  int len=32;
  IntegerDeclaration id=new IntegerDeclaration(len,false,len,ByteOrder.LITTLE_ENDIAN,Encoding.ASCII,null);
  String lengthName="String_Node_Str";
  StructDeclaration structDec=new StructDeclaration(0);
  structDec.addField(lengthName,id);
  StructDefinition structDef=new StructDefinition(structDec,null,lengthName);
  structDef.lookupInteger(lengthName).setValue(32);
  SequenceDeclaration sd=new SequenceDeclaration(lengthName,id);
  Definition fieldDef=new SequenceDefinition(sd,structDef,"String_Node_Str");
  ByteBuffer byb=ByteBuffer.allocate(1024);
  for (int i=0; i < 1024; i++) {
    byb.put((byte)i);
  }
  BitBuffer bb=new BitBuffer(byb);
  fieldDef.read(bb);
  assertNotNull(fieldDef);
}

Fixed version (ground truth):
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 * @throws CTFReaderException
 */
@Test public void testParseField_complex() throws CTFReaderException {
  int len=32;
  IntegerDeclaration id=new IntegerDeclaration(len,false,len,ByteOrder.LITTLE_ENDIAN,Encoding.ASCII,null,32);
  String lengthName="String_Node_Str";
  StructDeclaration structDec=new StructDeclaration(0);
  structDec.addField(lengthName,id);
  StructDefinition structDef=new StructDefinition(structDec,null,lengthName);
  structDef.lookupInteger(lengthName).setValue(32);
  SequenceDeclaration sd=new SequenceDeclaration(lengthName,id);
  Definition fieldDef=new SequenceDefinition(sd,structDef,"String_Node_Str");
  ByteBuffer byb=ByteBuffer.allocate(1024);
  for (int i=0; i < 1024; i++) {
    byb.put((byte)i);
  }
  BitBuffer bb=new BitBuffer(byb);
  fieldDef.read(bb);
  assertNotNull(fieldDef);
}
Program: 92433
Project: 92433
Buggy source:
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 */
@Test public void testParseField_simple2(){
  IntegerDefinition fieldDef=new IntegerDefinition(new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null),null,fieldName);
  fieldDef.setValue(1L);
  assertNotNull(fieldDef);
}

Fixed version (ground truth):
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 */
@Test public void testParseField_simple2(){
  IntegerDefinition fieldDef=new IntegerDefinition(new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8),null,fieldName);
  fieldDef.setValue(1L);
  assertNotNull(fieldDef);
}
Program: 92434
Project: 92434
Buggy source:
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 * @throws CTFReaderException 
 */
@Test public void testParseField_simple() throws CTFReaderException {
  Definition fieldDef=new SequenceDefinition(new SequenceDeclaration("String_Node_Str",new StringDeclaration()),null,fieldName);
  assertNotNull(fieldDef);
}

Fixed version (ground truth):
/** 
 * Run the CTFEventField parseField(Definition,String) method test.
 * @throws CTFReaderException
 */
@Test public void testParseField_simple() throws CTFReaderException {
  Definition fieldDef=new SequenceDefinition(new SequenceDeclaration("String_Node_Str",new StringDeclaration()),null,fieldName);
  assertNotNull(fieldDef);
}
Program: 92436
Project: 92436
Buggy source:
private ArrayDefinition createLongArray(){
  IntegerDeclaration decl=new IntegerDeclaration(32,false,10,ByteOrder.BIG_ENDIAN,Encoding.NONE,"String_Node_Str");
  IntegerDefinition[] defs=createIntDefs(10,32);
  ArrayDefinition temp=setUpDeclaration(decl,defs);
  return temp;
}

Fixed version (ground truth):
private ArrayDefinition createLongArray(){
  IntegerDeclaration decl=new IntegerDeclaration(32,false,10,ByteOrder.BIG_ENDIAN,Encoding.NONE,"String_Node_Str",8);
  IntegerDefinition[] defs=createIntDefs(10,32);
  ArrayDefinition temp=setUpDeclaration(decl,defs);
  return temp;
}
Program: 92437
Project: 92437
Buggy source:
/** 
 * Run the boolean isString() method test.
 */
@Test public void testIsString_complex(){
  final IntegerDeclaration id=new IntegerDeclaration(8,false,16,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null);
  ArrayDeclaration ad=new ArrayDeclaration(0,id);
  ArrayDefinition ownFixture=new ArrayDefinition(ad,this.trace,"String_Node_Str");
  int size=4;
  int bits=8;
  IntegerDefinition[] defs=createIntDefs(size,bits);
  ownFixture.setDefinitions(defs);
  boolean result=ownFixture.isString();
  assertTrue(result);
}

Fixed version (ground truth):
/** 
 * Run the boolean isString() method test.
 */
@Test public void testIsString_complex(){
  final IntegerDeclaration id=new IntegerDeclaration(8,false,16,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null,8);
  ArrayDeclaration ad=new ArrayDeclaration(0,id);
  ArrayDefinition ownFixture=new ArrayDefinition(ad,this.trace,"String_Node_Str");
  int size=4;
  int bits=8;
  IntegerDefinition[] defs=createIntDefs(size,bits);
  ownFixture.setDefinitions(defs);
  boolean result=ownFixture.isString();
  assertTrue(result);
}
Program: 92438
Project: 92438
Buggy source:
/** 
 * @param size
 * @param bits
 * @return
 */
private static IntegerDefinition[] createIntDefs(int size,int bits){
  IntegerDefinition[] defs=new IntegerDefinition[size];
  for (int i=0; i < size; i++) {
    String content="String_Node_Str" + i;
    defs[i]=new IntegerDefinition(new IntegerDeclaration(bits,false,16,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,content),null,content);
    defs[i].setValue(i);
  }
  return defs;
}

Fixed version (ground truth):
/** 
 * @param size
 * @param bits
 * @return
 */
private static IntegerDefinition[] createIntDefs(int size,int bits){
  IntegerDefinition[] defs=new IntegerDefinition[size];
  for (int i=0; i < size; i++) {
    String content="String_Node_Str" + i;
    defs[i]=new IntegerDefinition(new IntegerDeclaration(bits,false,16,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,content,24),null,content);
    defs[i].setValue(i);
  }
  return defs;
}
Program: 92439
Project: 92439
Buggy source:
private ArrayDefinition createCharArray(){
  IntegerDeclaration decl=new IntegerDeclaration(8,false,10,ByteOrder.BIG_ENDIAN,Encoding.UTF8,"String_Node_Str");
  IntegerDefinition[] defs=createIntDefs(4,8);
  ArrayDefinition temp=setUpDeclaration(decl,defs);
  return temp;
}

Fixed version (ground truth):
private ArrayDefinition createCharArray(){
  IntegerDeclaration decl=new IntegerDeclaration(8,false,10,ByteOrder.BIG_ENDIAN,Encoding.UTF8,"String_Node_Str",8);
  IntegerDefinition[] defs=createIntDefs(4,8);
  ArrayDefinition temp=setUpDeclaration(decl,defs);
  return temp;
}
Program: 92440
Project: 92440
Buggy source:
/** 
 * Run the EnumDeclaration(IntegerDeclaration) constructor test.
 */
@Test public void testEnumDeclaration(){
  IntegerDeclaration containerType=new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null);
  EnumDeclaration result=new EnumDeclaration(containerType);
  assertNotNull(result);
  String left="String_Node_Str";
  assertEquals(left,result.toString().substring(0,left.length()));
}

Fixed version (ground truth):
/** 
 * Run the EnumDeclaration(IntegerDeclaration) constructor test.
 */
@Test public void testEnumDeclaration(){
  IntegerDeclaration containerType=new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8);
  EnumDeclaration result=new EnumDeclaration(containerType);
  assertNotNull(result);
  String left="String_Node_Str";
  assertEquals(left,result.toString().substring(0,left.length()));
}
Program: 92441
Project: 92441
Buggy source:
/** 
 * Perform pre-test initialization.
 */
@Before public void setUp(){
  fixture=new EnumDeclaration(new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null));
}

Fixed version (ground truth):
/** 
 * Perform pre-test initialization.
 */
@Before public void setUp(){
  fixture=new EnumDeclaration(new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8));
}
Program: 92442
Project: 92442
Buggy source:
/** 
 * Perform pre-test initialization.
 */
@Before public void setUp(){
  EnumDeclaration declaration=new EnumDeclaration(new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null));
  String fieldName="String_Node_Str";
  fixture=new EnumDefinition(declaration,null,fieldName);
}

Fixed version (ground truth):
/** 
 * Perform pre-test initialization.
 */
@Before public void setUp(){
  EnumDeclaration declaration=new EnumDeclaration(new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8));
  String fieldName="String_Node_Str";
  fixture=new EnumDefinition(declaration,null,fieldName);
}
Program: 92443
Project: 92443
Buggy source:
/** 
 * Run the IntegerDeclaration(int,boolean,int,ByteOrder,Encoding) constructor test.
 */
@Test public void testIntegerDeclaration(){
  int len=1;
  boolean signed=true;
  int base=1;
  ByteOrder byteOrder=ByteOrder.BIG_ENDIAN;
  Encoding encoding=Encoding.ASCII;
  IntegerDeclaration result=new IntegerDeclaration(len,signed,base,byteOrder,encoding,null);
  assertNotNull(result);
  assertEquals(1,result.getBase());
  assertEquals(false,result.isCharacter());
  String outputValue="String_Node_Str";
  assertEquals(outputValue,result.toString().substring(0,outputValue.length()));
  assertEquals(1,result.getLength());
  assertEquals(true,result.isSigned());
}

Fixed version (ground truth):
/** 
 * Run the IntegerDeclaration(int,boolean,int,ByteOrder,Encoding) constructor test.
 */
@Test public void testIntegerDeclaration(){
  int len=1;
  boolean signed=true;
  int base=1;
  ByteOrder byteOrder=ByteOrder.BIG_ENDIAN;
  Encoding encoding=Encoding.ASCII;
  IntegerDeclaration result=new IntegerDeclaration(len,signed,base,byteOrder,encoding,null,16);
  assertNotNull(result);
  assertEquals(1,result.getBase());
  assertEquals(false,result.isCharacter());
  String outputValue="String_Node_Str";
  assertEquals(outputValue,result.toString().substring(0,outputValue.length()));
  assertEquals(1,result.getLength());
  assertEquals(true,result.isSigned());
}
Program: 92444
Project: 92444
Buggy source:
/** 
 * Run the boolean isSigned() method test.
 */
@Test public void testIsSigned_unsigned(){
  IntegerDeclaration fixture_unsigned=new IntegerDeclaration(1,false,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null);
  boolean result=fixture_unsigned.isSigned();
  assertEquals(false,result);
}

Fixed version (ground truth):
/** 
 * Run the boolean isSigned() method test.
 */
@Test public void testIsSigned_unsigned(){
  IntegerDeclaration fixture_unsigned=new IntegerDeclaration(1,false,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8);
  boolean result=fixture_unsigned.isSigned();
  assertEquals(false,result);
}
Program: 92445
Project: 92445
Buggy source:
/** 
 * Perform pre-test initialization.
 */
@Before public void setUp(){
  fixture=new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null);
}

Fixed version (ground truth):
/** 
 * Perform pre-test initialization.
 */
@Before public void setUp(){
  fixture=new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,32);
}
Program: 92446
Project: 92446
Buggy source:
/** 
 * Run the boolean isCharacter() method test.
 */
@Test public void testIsCharacter_8bytes(){
  IntegerDeclaration fixture8=new IntegerDeclaration(8,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null);
  boolean result=fixture8.isCharacter();
  assertEquals(true,result);
}

Fixed version (ground truth):
/** 
 * Run the boolean isCharacter() method test.
 */
@Test public void testIsCharacter_8bytes(){
  IntegerDeclaration fixture8=new IntegerDeclaration(8,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8);
  boolean result=fixture8.isCharacter();
  assertEquals(true,result);
}
Program: 92447
Project: 92447
Buggy source:
/** 
 * Run the IntegerDefinition(IntegerDeclaration,DefinitionScope,String) constructor test.
 */
@Test public void testIntegerDefinition(){
  IntegerDeclaration declaration=new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null);
  IDefinitionScope definitionScope=null;
  String fieldName="String_Node_Str";
  IntegerDefinition result=new IntegerDefinition(declaration,definitionScope,fieldName);
  assertNotNull(result);
}

Fixed version (ground truth):
/** 
 * Run the IntegerDefinition(IntegerDeclaration,DefinitionScope,String) constructor test.
 */
@Test public void testIntegerDefinition(){
  IntegerDeclaration declaration=new IntegerDeclaration(1,true,1,ByteOrder.BIG_ENDIAN,Encoding.ASCII,null,8);
  IDefinitionScope definitionScope=null;
  String fieldName="String_Node_Str";
  IntegerDefinition result=new IntegerDefinition(declaration,definitionScope,fieldName);
  assertNotNull(result);
}
Program: 92448
Project: 92448
Buggy source:
/** 
 * Perform pre-test initialization. We know the structDef won't be null (or else the tests will fail), so we can safely suppress the warning.
 * @throws CTFReaderException 
 */
@Before public void setUp() throws CTFReaderException {
  CTFTrace trace=TestParams.createTrace();
  CTFTraceReader tr=new CTFTraceReader(trace);
  String name="String_Node_Str";
  StructDefinition structDef=null;
  boolean found=false;
  while (tr.hasMoreEvents() && !found) {
    tr.advance();
    EventDefinition ed=tr.getCurrentEventDef();
    for (    String key : ed.fields.getDefinitions().keySet()) {
      structDef=ed.fields;
      Definition d=structDef.lookupDefinition(key);
      if (d instanceof IntegerDefinition) {
        found=true;
        name=key;
        break;
      }
    }
  }
  assert(structDef != null);
  fixture=structDef.lookupInteger(name);
}

Fixed version (ground truth):
/** 
 * Perform pre-test initialization. We know the structDef won't be null (or else the tests will fail), so we can safely suppress the warning.
 * @throws CTFReaderException
 */
@Before public void setUp() throws CTFReaderException {
  CTFTrace trace=TestParams.createTrace();
  CTFTraceReader tr=new CTFTraceReader(trace);
  String name="String_Node_Str";
  StructDefinition structDef=null;
  boolean found=false;
  while (tr.hasMoreEvents() && !found) {
    tr.advance();
    EventDefinition ed=tr.getCurrentEventDef();
    for (    String key : ed.fields.getDefinitions().keySet()) {
      structDef=ed.fields;
      Definition d=structDef.lookupDefinition(key);
      if (d instanceof IntegerDefinition) {
        found=true;
        name=key;
        break;
      }
    }
  }
  assert(structDef != null);
  fixture=structDef.lookupInteger(name);
}
Program: 92449
Project: 92449
Buggy source:
/** 
 * Run the SequenceDefinition createDefinition(DefinitionScope,String) method test.
 */
@Test public void testCreateDefinition(){
  IntegerDeclaration id=new IntegerDeclaration(8,false,8,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null);
  StructDeclaration structDec=new StructDeclaration(0);
  structDec.addField(fieldName,id);
  StructDefinition structDef=new StructDefinition(structDec,null,"String_Node_Str");
  long seqLen=10;
  structDef.lookupInteger(fieldName).setValue(seqLen);
  SequenceDefinition result=this.fixture.createDefinition(structDef,fieldName);
  assertNotNull(result);
}

Fixed version (ground truth):
/** 
 * Run the SequenceDefinition createDefinition(DefinitionScope,String) method test.
 */
@Test public void testCreateDefinition(){
  IntegerDeclaration id=new IntegerDeclaration(8,false,8,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null,32);
  StructDeclaration structDec=new StructDeclaration(0);
  structDec.addField(fieldName,id);
  StructDefinition structDef=new StructDefinition(structDec,null,"String_Node_Str");
  long seqLen=10;
  structDef.lookupInteger(fieldName).setValue(seqLen);
  SequenceDefinition result=this.fixture.createDefinition(structDef,fieldName);
  assertNotNull(result);
}
Program: 92450
Project: 92450
Buggy source:
private static SequenceDefinition initNonString() throws CTFReaderException {
  StructDeclaration structDec;
  StructDefinition structDef;
  int len=32;
  IntegerDeclaration id=new IntegerDeclaration(len,false,len,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null);
  String lengthName="String_Node_Str";
  structDec=new StructDeclaration(0);
  structDec.addField(lengthName,id);
  structDef=new StructDefinition(structDec,null,"String_Node_Str");
  structDef.lookupInteger(lengthName).setValue(seqLen);
  SequenceDeclaration sd=new SequenceDeclaration(lengthName,id);
  SequenceDefinition ret=new SequenceDefinition(sd,structDef,"String_Node_Str");
  BitBuffer input=new BitBuffer(java.nio.ByteBuffer.allocateDirect(seqLen * len));
  for (int i=0; i < seqLen; i++) {
    input.putInt(i);
  }
  ret.read(input);
  assertNotNull(ret);
  return ret;
}

Fixed version (ground truth):
private static SequenceDefinition initNonString() throws CTFReaderException {
  StructDeclaration structDec;
  StructDefinition structDef;
  int len=32;
  IntegerDeclaration id=new IntegerDeclaration(len,false,len,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null,8);
  String lengthName="String_Node_Str";
  structDec=new StructDeclaration(0);
  structDec.addField(lengthName,id);
  structDef=new StructDefinition(structDec,null,"String_Node_Str");
  structDef.lookupInteger(lengthName).setValue(seqLen);
  SequenceDeclaration sd=new SequenceDeclaration(lengthName,id);
  SequenceDefinition ret=new SequenceDefinition(sd,structDef,"String_Node_Str");
  BitBuffer input=new BitBuffer(java.nio.ByteBuffer.allocateDirect(seqLen * len));
  for (int i=0; i < seqLen; i++) {
    input.putInt(i);
  }
  ret.read(input);
  assertNotNull(ret);
  return ret;
}
Program: 92451
Project: 92451
Buggy source:
/** 
 * Perform pre-test initialization.
 * @throws CTFReaderException 
 */
@Before public void setUp() throws CTFReaderException {
  StructDeclaration structDec;
  StructDefinition structDef;
  IntegerDeclaration id=new IntegerDeclaration(8,false,8,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null);
  String lengthName="String_Node_Str";
  structDec=new StructDeclaration(0);
  structDec.addField(lengthName,id);
  structDef=new StructDefinition(structDec,null,"String_Node_Str");
  structDef.lookupInteger(lengthName).setValue(seqLen);
  SequenceDeclaration sd=new SequenceDeclaration(lengthName,id);
  fixture=new SequenceDefinition(sd,structDef,"String_Node_Str");
  BitBuffer input=new BitBuffer(java.nio.ByteBuffer.allocateDirect(seqLen * 8));
  for (int i=0; i < seqLen; i++) {
    input.putInt(i);
  }
  fixture.read(input);
  assert(fixture != null);
}

Fixed version (ground truth):
/** 
 * Perform pre-test initialization.
 * @throws CTFReaderException
 */
@Before public void setUp() throws CTFReaderException {
  StructDeclaration structDec;
  StructDefinition structDef;
  IntegerDeclaration id=new IntegerDeclaration(8,false,8,ByteOrder.LITTLE_ENDIAN,Encoding.UTF8,null,8);
  String lengthName="String_Node_Str";
  structDec=new StructDeclaration(0);
  structDec.addField(lengthName,id);
  structDef=new StructDefinition(structDec,null,"String_Node_Str");
  structDef.lookupInteger(lengthName).setValue(seqLen);
  SequenceDeclaration sd=new SequenceDeclaration(lengthName,id);
  fixture=new SequenceDefinition(sd,structDef,"String_Node_Str");
  BitBuffer input=new BitBuffer(java.nio.ByteBuffer.allocateDirect(seqLen * 8));
  for (int i=0; i < seqLen; i++) {
    input.putInt(i);
  }
  fixture.read(input);
  assert(fixture != null);
}