nus-yam/ex-repair huggingface dataset:
Program: 5246
Project: 5246
Buggy source:
@Override public void run(){
  while (true) {
    SelectionKey key=null;
    try {
      while (!this.changeQueue.isEmpty()) {
        SocketChannelWrapper wrapper=changeQueue.poll();
        if (wrapper.hasWrites()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_WRITE);
        }
 else         if (wrapper.hasReads()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_READ);
        }
 else {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(0);
        }
        if (wrapper.isClosed()) {
          continue;
        }
      }
      this.selector.select();
      Iterator<SelectionKey> selectedKeys=this.selector.selectedKeys().iterator();
      while (selectedKeys.hasNext()) {
        key=selectedKeys.next();
        selectedKeys.remove();
        if (!key.isValid()) {
          continue;
        }
        if (key.isReadable()) {
          this.read(key);
        }
 else         if (key.isWritable()) {
          this.write(key);
        }
      }
    }
 catch (    TrendrrDisconnectedException x) {
      this.channels.get((SocketChannel)key.channel()).close();
    }
catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    SelectionKey key=null;
    try {
      while (!this.registerQueue.isEmpty()) {
        SocketChannelWrapper wrapper=registerQueue.poll();
        key=wrapper.getChannel().register(this.selector,SelectionKey.OP_READ);
      }
      while (!this.changeQueue.isEmpty()) {
        SocketChannelWrapper wrapper=changeQueue.poll();
        if (wrapper.hasWrites()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_WRITE);
        }
 else         if (wrapper.hasReads()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_READ);
        }
 else {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(0);
        }
        if (wrapper.isClosed()) {
          continue;
        }
      }
      this.selector.select();
      Iterator<SelectionKey> selectedKeys=this.selector.selectedKeys().iterator();
      while (selectedKeys.hasNext()) {
        key=selectedKeys.next();
        selectedKeys.remove();
        if (!key.isValid()) {
          continue;
        }
        if (key.isReadable()) {
          this.read(key);
        }
 else         if (key.isWritable()) {
          this.write(key);
        }
      }
    }
 catch (    TrendrrDisconnectedException x) {
      this.channels.get((SocketChannel)key.channel()).close();
    }
catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
}
Program: 5247
Project: 5247
Buggy source:
public void register(SocketChannelWrapper wrapper) throws IOException {
  this.channels.put(wrapper.getChannel(),wrapper);
  wrapper.getChannel().configureBlocking(false);
  wrapper.getChannel().register(this.selector,SelectionKey.OP_READ);
}

Fixed version (ground truth):
public void register(SocketChannelWrapper wrapper) throws IOException {
  this.channels.put(wrapper.getChannel(),wrapper);
  wrapper.getChannel().configureBlocking(false);
  registerQueue.add(wrapper);
  this.selector.wakeup();
}
Program: 5248
Project: 5248
Buggy source:
private boolean process(ChannelCallback callback){
  if (this.databuffers.isEmpty()) {
    log.info("String_Node_Str");
    return false;
  }
  try {
    if (callback instanceof StringReadRequest) {
      try {
        return this.readString((StringReadRequest)callback);
      }
 catch (      CharacterCodingException e) {
        throw new TrendrrException("String_Node_Str",e);
      }
    }
 else     if (callback instanceof ByteReadRequest) {
      return this.readBytes((ByteReadRequest)callback);
    }
 else {
      throw new TrendrrException("String_Node_Str" + callback);
    }
  }
 catch (  TrendrrException x) {
    callback.onError(x);
  }
  return true;
}

Fixed version (ground truth):
private boolean process(ChannelCallback callback){
  if (this.databuffers.isEmpty()) {
    return false;
  }
  try {
    if (callback instanceof StringReadRequest) {
      try {
        return this.readString((StringReadRequest)callback);
      }
 catch (      CharacterCodingException e) {
        throw new TrendrrException("String_Node_Str",e);
      }
    }
 else     if (callback instanceof ByteReadRequest) {
      return this.readBytes((ByteReadRequest)callback);
    }
 else {
      throw new TrendrrException("String_Node_Str" + callback);
    }
  }
 catch (  TrendrrException x) {
    callback.onError(x);
  }
  this.callbacks.poll();
  return true;
}
Program: 5249
Project: 5249
Buggy source:
/** 
 * reads one buffer (or less) worth of bytes from the channel. channel settings. after calling read it is up to the caller to call process, in order to process the bytes.
 * @param channel
 * @return
 * @throws TrendrrException 
 * @throws TrendrrDisconnectedException 
 */
public synchronized int read(ReadableByteChannel channel) throws TrendrrDisconnectedException, TrendrrException {
  int numRead=this.getBytesPerRead();
  int totalRead=0;
  try {
    ByteBuffer buf=this.getBuffer();
    numRead=channel.read(buf);
    totalRead+=numRead;
    System.out.println(numRead);
    if (numRead < 0) {
      this.returnBuffer(buf);
      throw new TrendrrDisconnectedException("String_Node_Str");
    }
 else     if (numRead == 0) {
      this.returnBuffer(buf);
    }
 else {
      buf.flip();
      this.databuffers.add(buf);
    }
  }
 catch (  Exception x) {
    this.throwException(x);
  }
  return totalRead;
}

Fixed version (ground truth):
/** 
 * reads one buffer (or less) worth of bytes from the channel. channel settings. after calling read it is up to the caller to call process, in order to process the bytes.
 * @param channel
 * @return
 * @throws TrendrrException 
 * @throws TrendrrDisconnectedException 
 */
public synchronized int read(ReadableByteChannel channel) throws TrendrrDisconnectedException, TrendrrException {
  int numRead=this.getBytesPerRead();
  int totalRead=0;
  try {
    ByteBuffer buf=this.getBuffer();
    numRead=channel.read(buf);
    totalRead+=numRead;
    if (numRead < 0) {
      this.returnBuffer(buf);
      throw new TrendrrDisconnectedException("String_Node_Str");
    }
 else     if (numRead == 0) {
      this.returnBuffer(buf);
    }
 else {
      buf.flip();
      this.databuffers.add(buf);
    }
  }
 catch (  Exception x) {
    this.throwException(x);
  }
  return totalRead;
}
Program: 5251
Project: 5251
Buggy source:
/** 
 * attempts to read the requested bytes from the current buffer. callback is called if read was successfull, this request can then be  discarded.
 * @return
 */
private boolean readBytes(ByteReadRequest request){
  List<ByteBuffer> databufs=new ArrayList<ByteBuffer>();
  log.info("String_Node_Str");
  for (  ByteBuffer buf : this.databuffers) {
    if (request.getBuf().hasRemaining()) {
      try {
        request.getBuf().put(buf);
        this.returnBuffer(buf);
      }
 catch (      BufferOverflowException x) {
        while (request.getBuf().hasRemaining()) {
          request.getBuf().put(buf.get());
        }
        databufs.add(buf);
      }
    }
 else {
      databufs.add(buf);
    }
  }
  this.databuffers=databufs;
  if (!request.getBuf().hasRemaining()) {
    log.info("String_Node_Str");
    request.getCallback().byteResult(request.getBuf().array());
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * attempts to read the requested bytes from the current buffer. callback is called if read was successfull, this request can then be  discarded.
 * @return
 */
private boolean readBytes(ByteReadRequest request){
  List<ByteBuffer> databufs=new ArrayList<ByteBuffer>();
  for (  ByteBuffer buf : this.databuffers) {
    if (request.getBuf().hasRemaining()) {
      try {
        request.getBuf().put(buf);
        this.returnBuffer(buf);
      }
 catch (      BufferOverflowException x) {
        while (request.getBuf().hasRemaining()) {
          request.getBuf().put(buf.get());
        }
        databufs.add(buf);
      }
    }
 else {
      databufs.add(buf);
    }
  }
  this.databuffers=databufs;
  if (!request.getBuf().hasRemaining()) {
    this.callbacks.poll();
    request.getCallback().byteResult(request.getBuf().array());
    return true;
  }
  return false;
}
Program: 5252
Project: 5252
Buggy source:
@Override public void run(){
  while (true) {
    SelectionKey key=null;
    try {
      while (!this.changeQueue.isEmpty()) {
        SocketChannelWrapper wrapper=changeQueue.poll();
        if (wrapper.hasWrites()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_WRITE);
        }
 else         if (wrapper.hasReads()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_READ);
        }
        if (wrapper.isClosed()) {
          continue;
        }
      }
      log.info("String_Node_Str");
      this.selector.select();
      Iterator<SelectionKey> selectedKeys=this.selector.selectedKeys().iterator();
      while (selectedKeys.hasNext()) {
        key=selectedKeys.next();
        selectedKeys.remove();
        if (!key.isValid()) {
          continue;
        }
        if (key.isReadable()) {
          log.info("String_Node_Str");
          this.read(key);
        }
 else         if (key.isWritable()) {
          log.info("String_Node_Str");
          this.write(key);
        }
      }
    }
 catch (    TrendrrDisconnectedException x) {
      x.printStackTrace();
      this.channels.get((SocketChannel)key.channel()).close();
    }
catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    SelectionKey key=null;
    try {
      while (!this.changeQueue.isEmpty()) {
        SocketChannelWrapper wrapper=changeQueue.poll();
        if (wrapper.hasWrites()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_WRITE);
        }
 else         if (wrapper.hasReads()) {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(SelectionKey.OP_READ);
        }
 else {
          key=wrapper.getChannel().keyFor(this.selector);
          key.interestOps(0);
        }
        if (wrapper.isClosed()) {
          continue;
        }
      }
      this.selector.select();
      Iterator<SelectionKey> selectedKeys=this.selector.selectedKeys().iterator();
      while (selectedKeys.hasNext()) {
        key=selectedKeys.next();
        selectedKeys.remove();
        if (!key.isValid()) {
          continue;
        }
        if (key.isReadable()) {
          this.read(key);
        }
 else         if (key.isWritable()) {
          this.write(key);
        }
      }
    }
 catch (    TrendrrDisconnectedException x) {
      x.printStackTrace();
      this.channels.get((SocketChannel)key.channel()).close();
    }
catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 5253
Project: 5253
Buggy source:
public void register(SocketChannelWrapper wrapper) throws IOException {
  this.channels.put(wrapper.getChannel(),wrapper);
  wrapper.getChannel().configureBlocking(false);
  log.info("String_Node_Str");
  wrapper.getChannel().register(this.selector,SelectionKey.OP_READ);
}

Fixed version (ground truth):
public void register(SocketChannelWrapper wrapper) throws IOException {
  this.channels.put(wrapper.getChannel(),wrapper);
  wrapper.getChannel().configureBlocking(false);
  wrapper.getChannel().register(this.selector,SelectionKey.OP_READ);
}
Program: 5254
Project: 5254
Buggy source:
/** 
 * Attempts to read from the network, and process any callbacks.   does nothing if no callbacks have been registered.
 * @throws TrendrrNoCallbackException
 * @throws TrendrrDisconnectedException
 * @throws TrendrrException
 */
public void doRead() throws TrendrrNoCallbackException, TrendrrDisconnectedException, TrendrrException {
  int numRead=1;
  while (numRead > 0 && this.buffer.hasCallbacksWaiting()) {
    this.buffer.read(this.channel);
    this.buffer.process();
  }
}

Fixed version (ground truth):
/** 
 * Attempts to read from the network, and process any callbacks.   does nothing if no callbacks have been registered.
 * @throws TrendrrNoCallbackException
 * @throws TrendrrDisconnectedException
 * @throws TrendrrException
 */
public void doRead() throws TrendrrNoCallbackException, TrendrrDisconnectedException, TrendrrException {
  int numRead=1;
  while (numRead > 0 && this.buffer.hasCallbacksWaiting()) {
    numRead=this.buffer.read(this.channel);
    this.buffer.process();
  }
}
Program: 5255
Project: 5255
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args){
  SocketChannel channel;
  try {
    channel=SocketChannel.open();
    channel.connect(new InetSocketAddress("String_Node_Str",8000));
    SocketChannelWrapper wrapper=new SocketChannelWrapper(channel);
    wrapper.write("String_Node_Str".getBytes());
    wrapper.readUntil("String_Node_Str",Charset.forName("String_Node_Str"),new StringReadCallback(){
      @Override public void onError(      TrendrrException ex){
        ex.printStackTrace();
      }
      @Override public void stringResult(      String result){
        System.out.println("String_Node_Str" + result);
      }
    }
);
    byte[] bytes=wrapper.readBytes(197);
    System.out.println("String_Node_Str" + bytes.length);
    System.out.println(new String(bytes));
    wrapper.write("String_Node_Str".getBytes());
    System.out.println(wrapper.readUntil("String_Node_Str",Charset.forName("String_Node_Str")));
    System.out.println(wrapper.readUntil("String_Node_Str",Charset.forName("String_Node_Str")));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args){
  SocketChannel channel;
  try {
    channel=SocketChannel.open();
    channel.connect(new InetSocketAddress("String_Node_Str",8000));
    Sleep.seconds(30);
    SocketChannelWrapper wrapper=new SocketChannelWrapper(channel);
    wrapper.write("String_Node_Str".getBytes());
    wrapper.readUntil("String_Node_Str",Charset.forName("String_Node_Str"),new StringReadCallback(){
      @Override public void onError(      TrendrrException ex){
        ex.printStackTrace();
      }
      @Override public void stringResult(      String result){
        System.out.println("String_Node_Str" + result);
      }
    }
);
    byte[] bytes=wrapper.readBytes(197);
    System.out.println("String_Node_Str" + bytes.length);
    System.out.println(new String(bytes));
    wrapper.write("String_Node_Str".getBytes());
    System.out.println(wrapper.readUntil("String_Node_Str",Charset.forName("String_Node_Str")));
    System.out.println(wrapper.readUntil("String_Node_Str",Charset.forName("String_Node_Str")));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 5256
Project: 5256
Buggy source:
void incoming(StrestResponse response){
  String txnId=response.getHeader(StrestHeaders.Names.STREST_TXN_ID);
  String txnStatus=response.getHeader(StrestHeaders.Names.STREST_TXN_STATUS);
  StrestRequestCallback cb=this.callbacks.get(txnId);
  try {
    cb.messageRecieved(response);
  }
 catch (  Exception x) {
    log.error("String_Node_Str",x);
  }
  if (!StrestHeaders.Values.CONTINUE.equalsIgnoreCase(txnStatus)) {
    this.callbacks.remove(txnId);
    cb.txnComplete();
  }
}

Fixed version (ground truth):
void incoming(StrestResponse response){
  String txnId=response.getHeader(StrestHeaders.Names.STREST_TXN_ID);
  String txnStatus=response.getHeader(StrestHeaders.Names.STREST_TXN_STATUS);
  StrestRequestCallback cb=this.callbacks.get(txnId);
  if (cb == null) {
    log.error("String_Node_Str" + txnId + "String_Node_Str");
    return;
  }
  try {
    cb.messageRecieved(response);
  }
 catch (  Exception x) {
    log.error("String_Node_Str",x);
  }
  if (!StrestHeaders.Values.CONTINUE.equalsIgnoreCase(txnStatus)) {
    this.callbacks.remove(txnId);
    cb.txnComplete();
  }
}
Program: 5257
Project: 5257
Buggy source:
public synchronized void connect(){
  SocketChannel channel;
  try {
    channel=SocketChannel.open();
    channel.configureBlocking(true);
    channel.connect(new InetSocketAddress(this.host,this.port));
    socket=new SocketChannelWrapper(channel);
    reader=new StrestMessageReader();
    reader.start(this,socket);
    connected.set(true);
  }
 catch (  Exception x) {
    x.printStackTrace();
  }
}

Fixed version (ground truth):
public synchronized void connect(){
  SocketChannel channel;
  try {
    channel=SocketChannel.open();
    boolean connected=channel.connect(new InetSocketAddress(this.host,this.port));
    log.info("String_Node_Str" + connected);
    socket=new SocketChannelWrapper(channel);
    reader=new StrestMessageReader();
    reader.start(this,socket);
    this.connected.set(true);
  }
 catch (  Exception x) {
    x.printStackTrace();
  }
}
Program: 5258
Project: 5258
Buggy source:
@Override public void stringResult(String result){
  current=new StrestResponse();
  current.parseHeaders(result);
  String contentLength=current.getHeader(StrestHeaders.Names.CONTENT_LENGTH);
  if (contentLength == null) {
    log.warn("String_Node_Str");
    return;
  }
  int length=Integer.parseInt(contentLength);
  SocketChannelWrapper sock=this.socket.get();
  if (sock == null) {
    log.info("String_Node_Str");
  }
  sock.readBytes(length,this);
}

Fixed version (ground truth):
@Override public void stringResult(String result){
  current=new StrestResponse();
  current.parseHeaders(result);
  String contentLength=current.getHeader(StrestHeaders.Names.CONTENT_LENGTH);
  if (contentLength == null) {
    log.warn("String_Node_Str");
    this.readNextMessage();
    return;
  }
  int length=Integer.parseInt(contentLength);
  SocketChannelWrapper sock=this.socket.get();
  if (sock == null) {
    log.info("String_Node_Str");
  }
  sock.readBytes(length,this);
}
Program: 5259
Project: 5259
Buggy source:
public void start(StrestClient client,SocketChannelWrapper socket){
  this.client.set(client);
  this.socket.set(socket);
}

Fixed version (ground truth):
public void start(StrestClient client,SocketChannelWrapper socket){
  this.client.set(client);
  this.socket.set(socket);
  this.readNextMessage();
}
Program: 5260
Project: 5260
Buggy source:
/** 
 * gets the bytes prepared and ready for sending to the server.
 * @return
 * @throws UnsupportedEncodingException 
 */
public ByteBuffer getBytesAsBuffer() throws UnsupportedEncodingException {
  this.finish();
  byte[] header=this.encodeHeaders();
  ByteBuffer buf=ByteBuffer.allocate(header.length + this.content.length);
  buf.put(header);
  buf.put(content);
  return buf;
}

Fixed version (ground truth):
/** 
 * gets the bytes prepared and ready for sending to the server. buffer is flipped
 * @return
 * @throws UnsupportedEncodingException 
 */
public ByteBuffer getBytesAsBuffer() throws UnsupportedEncodingException {
  this.finish();
  byte[] header=this.encodeHeaders();
  ByteBuffer buf=ByteBuffer.allocate(header.length + this.content.length);
  buf.put(header);
  buf.put(content);
  buf.flip();
  return buf;
}
Program: 5261
Project: 5261
Buggy source:
public void parseHeaders(String header){
  String[] lines=header.split(StrestUtil.CRLF);
  String firstLine=lines[0];
  int index=firstLine.indexOf(' ');
  String protocol=firstLine.substring(0,index).trim();
  firstLine=firstLine.substring(index);
  index=firstLine.indexOf(' ');
  String code=firstLine.substring(0,index).trim();
  String message=firstLine.substring(index).trim();
  this.responseCode=Integer.parseInt(code);
  this.responseMessage=message;
  for (int i=1; i < lines.length; i++) {
    this.headers.parseHeader(lines[i]);
  }
}

Fixed version (ground truth):
public void parseHeaders(String header){
  String[] lines=header.split(StrestUtil.CRLF);
  String firstLine=lines[0];
  int index=firstLine.indexOf(' ');
  String protocol=firstLine.substring(0,index).trim();
  firstLine=firstLine.substring(index).trim();
  index=firstLine.indexOf(' ');
  String code=firstLine.substring(0,index).trim();
  String message=firstLine.substring(index).trim();
  this.responseCode=Integer.parseInt(code);
  this.responseMessage=message;
  for (int i=1; i < lines.length; i++) {
    this.headers.parseHeader(lines[i]);
  }
}
Program: 5264
Project: 5264
Buggy source:
/** 
 * creates a DynMap instance. Will convert a regular map, or any object that has a toMap method a string is assumed to be json.
 * @param obj
 * @return
 */
public static DynMap instance(Object obj){
  return TypeCast.cast(DynMap.class,obj);
}

Fixed version (ground truth):
/** 
 * creates a DynMap instance. Will convert a regular map, or any object that has a toMap method a string is assumed to be json. if obj is an instance of DynMap then that DynMap instance is returned.
 * @param obj
 * @return
 */
public static DynMap instance(Object obj){
  return TypeCast.cast(DynMap.class,obj);
}
Program: 5265
Project: 5265
Buggy source:
/** 
 * checks if the lists are equivelent, i.e. all items in both lists are the same
 * @param l1
 * @param l2
 * @return
 */
public static boolean equivalent(Object l1,Object l2){
  try {
    List list1=TypeCast.toList(l1);
    List list2=TypeCast.toList(l2);
    if (list1 == list2)     return true;
    if (l1 == null || l2 == null)     return false;
    return list1.containsAll(list2);
  }
 catch (  Exception x) {
  }
  return false;
}

Fixed version (ground truth):
/** 
 * checks if the lists are equivelent, i.e. all items in both lists are the same
 * @param l1
 * @param l2
 * @return
 */
public static boolean equivalent(Object l1,Object l2){
  try {
    if (l1 == l2)     return true;
    if (l1 == null || l2 == null)     return false;
    List list1=TypeCast.toList(l1);
    List list2=TypeCast.toList(l2);
    System.out.println("String_Node_Str" + list1);
    System.out.println("String_Node_Str" + list2);
    System.out.println("String_Node_Str");
    return list1.containsAll(list2);
  }
 catch (  Exception x) {
  }
  return false;
}
Program: 5267
Project: 5267
Buggy source:
@Test public void listTests(){
  Assert.assertNull(TypeCast.toList(null,"String_Node_Str"));
  Assert.assertNull(TypeCast.toList("String_Node_Str"));
  Assert.assertTrue(listTest(TypeCast.toList("String_Node_Str","String_Node_Str"),2));
  Assert.assertTrue(listTest(TypeCast.toList("String_Node_Str"),2));
  Assert.assertTrue(listTest(TypeCast.toList("String_Node_Str"),1));
}

Fixed version (ground truth):
@Test public void listTests(){
  Assert.assertNull(TypeCast.toList(null,"String_Node_Str"));
  Assert.assertNull(TypeCast.toList("String_Node_Str"));
  Assert.assertTrue(listTest(TypeCast.toList("String_Node_Str","String_Node_Str"),2));
  Assert.assertTrue(listTest(TypeCast.toList("String_Node_Str"),2));
  Assert.assertTrue(listTest(TypeCast.toList("String_Node_Str"),1));
  Assert.assertNull(TypeCast.toList(new ArrayList()));
}
Program: 5268
Project: 5268
Buggy source:
public void step(){
  double x0=x, y0=y, t0=t;
  x+=v * Math.cos(t) * dt;
  y+=-v * Math.sin(t) * dt;
  t+=vt * dt;
  while (t < -Math.PI)   t+=2 * Math.PI;
  while (t >= Math.PI)   t-=2 * Math.PI;
  if (playfield.collision(this)) {
    x=x0;
    y=y0;
    t=t0;
    return;
  }
  v+=a * dt;
  v-=v * r * r* CDRAG;
}

Fixed version (ground truth):
public void step(){
  double x0=x, y0=y, t0=t;
  x+=v * Math.cos(t) * dt;
  y+=-v * Math.sin(t) * dt;
  t+=vt * dt;
  while (t < -Math.PI)   t+=2 * Math.PI;
  while (t >= Math.PI)   t-=2 * Math.PI;
  if (playfield.collision(this)) {
    x=x0;
    y=y0;
    t=t0;
    return;
  }
  v+=a * dt;
  v-=v * r * r* CDRAG* dt;
}
Program: 5269
Project: 5269
Buggy source:
public void control(Agent me,Agent[] agents,Thing[] things){
  MeView meV=new MeView();
  meV.t=me.t;
  meV.vt=me.vt;
  meV.x=me.x;
  meV.y=me.y;
  meV.r=me.r;
  meV.a=me.a;
  meV.AMIN=me.AMIN;
  meV.AMAX=me.AMAX;
  meV.VTMIN=me.VTMIN;
  meV.VTMAX=me.VTMAX;
  meV.CDRAG=me.CDRAG;
  AgentView[] aVs=new AgentView[agents.length];
  for (int i=0; i < aVs.length; i++) {
    aVs[i]=new AgentView();
    aVs[i].c=agents[i].getClass();
    aVs[i].r=agents[i].r;
    aVs[i].t=agents[i].t;
    aVs[i].v=agents[i].v;
    aVs[i].x=agents[i].x;
    aVs[i].y=agents[i].y;
  }
  if (things != null)   throw new Error("String_Node_Str");
  ai.control(meV,aVs,null);
  me.a=clamp(meV.a,me.AMIN,me.AMAX);
  me.vt=clamp(meV.vt,me.VTMIN,me.VTMAX);
}

Fixed version (ground truth):
public void control(Agent[] agents,Thing[] things){
  MeView meV=new MeView();
  meV.t=t;
  meV.vt=vt;
  meV.x=x;
  meV.y=y;
  meV.r=r;
  meV.a=a;
  meV.AMIN=AMIN;
  meV.AMAX=AMAX;
  meV.VTMIN=VTMIN;
  meV.VTMAX=VTMAX;
  meV.CDRAG=CDRAG;
  AgentView[] aVs=new AgentView[agents.length];
  for (int i=0; i < aVs.length; i++) {
    aVs[i]=new AgentView();
    aVs[i].c=agents[i].getClass();
    aVs[i].r=agents[i].r;
    aVs[i].t=agents[i].t;
    aVs[i].v=agents[i].v;
    aVs[i].x=agents[i].x;
    aVs[i].y=agents[i].y;
  }
  if (things != null)   throw new Error("String_Node_Str");
  ai.control(meV,aVs,null);
  a=clamp(meV.a,AMIN,AMAX);
  vt=clamp(meV.vt,VTMIN,VTMAX);
}
Program: 5270
Project: 5270
Buggy source:
/** 
 * Move the agent's state forward by a timestep. One would not normally override this. 
 */
public void step(){
  double x0=x, y0=y, t0=t;
  x+=v * Math.cos(t) * dt;
  y+=-v * Math.sin(t) * dt;
  t+=vt * dt;
  while (t < -Math.PI)   t+=2 * Math.PI;
  while (t >= Math.PI)   t-=2 * Math.PI;
  if (playfield.collision(this)) {
    x=x0;
    y=y0;
    t=t0;
    return;
  }
  v+=a * dt;
  double drag=r * r * CDRAG;
  if (drag >= 0.95) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  v-=v * drag;
}

Fixed version (ground truth):
/** 
 * Move the agent's state forward by a timestep. One would not normally override this. 
 */
public void step(){
  double x0=x, y0=y, t0=t;
  x+=v * Math.cos(t) * dt;
  y+=-v * Math.sin(t) * dt;
  t+=vt * dt;
  while (t < -Math.PI)   t+=2 * Math.PI;
  while (t >= Math.PI)   t-=2 * Math.PI;
  if (playfield.collision(this,true)) {
    x=x0;
    y=y0;
    t=t0;
    return;
  }
  v+=a * dt;
  double drag=r * r * CDRAG;
  if (drag >= 0.95) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  v-=v * drag;
}
Program: 5271
Project: 5271
Buggy source:
/** 
 * When the bug collides, its velocity and acceleration go to zero. 
 */
public synchronized void thump(){
  v=0;
  a=0;
  if (!thumped)   System.out.println(this.name + "String_Node_Str");
  this.thumped=true;
}

Fixed version (ground truth):
/** 
 * When the bug collides, its velocity and acceleration go to zero. 
 */
public void thump(){
  v=0;
  a=0;
}
Program: 5272
Project: 5272
Buggy source:
/** 
 * Make a playfield.
 * @param nagents   Number of agents to put on the field.
 * @param dt   Simulation timestep.
 * @param ddt  Display timestep multiplier.
 */
public Playfield(int nagents,double dt,int ddt){
  DT=dt;
  DDT=ddt;
  agents=new Agent[nagents];
  for (int i=0; i < nagents; i++)   do   agents[i]=new Bug(this,"String_Node_Str" + i);
 while (collision(agents[i]));
}

Fixed version (ground truth):
/** 
 * Make a playfield.
 * @param nagents   Number of agents to put on the field.
 * @param dt   Simulation timestep.
 * @param ddt  Display timestep multiplier.
 */
public Playfield(int nagents,double dt,int ddt){
  DT=dt;
  DDT=ddt;
  agents=new Agent[nagents];
  for (int i=0; i < nagents; i++)   do   agents[i]=new Bug(this,"String_Node_Str" + i);
 while (collision(agents[i],false));
}
Program: 5273
Project: 5273
Buggy source:
/** 
 * Returns True iff the given agent has collided with something: another agent, a thing, a wall.
 */
public boolean collision(Agent b){
  boolean result=false;
  if (b.wallCollision()) {
    result=true;
    b.thump();
  }
  for (int i=0; i < agents.length; i++) {
    if (agents[i] != null && agents[i].id != b.id && agents[i].thingCollision(b)) {
      result=true;
      b.thump();
      agents[i].thump();
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns True iff the given agent has collided with something: another agent, a thing, a wall.
 */
public boolean collision(Agent b,boolean thump){
  boolean result=false;
  if (b.wallCollision()) {
    result=true;
    if (thump)     b.thump();
  }
  for (int i=0; i < agents.length; i++) {
    if (agents[i] != null && agents[i].id != b.id && agents[i].thingCollision(b)) {
      result=true;
      if (thump) {
        b.thump();
        agents[i].thump();
      }
    }
  }
  return result;
}
Program: 5274
Project: 5274
Buggy source:
/** 
 * Atribui um valor de segundo ao indicador temporal.
 * @param second integer que determina o valor da parte de segundo. Deve ser um inteiro no intervalo [0,59], caso hava um valor de minuto, ou um inteiro positivo, caso contrário.
 * @throws java.lang.IllegalArgumentException se o valor não estiver no formato definido pela norma.
 */
public void setSecond(Integer second) throws IllegalArgumentException {
  if (second != null && !(second >= 0 && (absoluteSecond() || second <= 59)))   throw new IllegalArgumentException("String_Node_Str");
  this.second=second.doubleValue();
}

Fixed version (ground truth):
/** 
 * Atribui um valor de segundo ao indicador temporal.
 * @param second integer que determina o valor da parte de segundo. Deve ser um inteiro no intervalo [0,59], caso hava um valor de minuto, ou um inteiro positivo, caso contrário.
 * @throws java.lang.IllegalArgumentException se o valor não estiver no formato definido pela norma.
 */
public void setSecond(Integer second) throws IllegalArgumentException {
  if (second == null && !(second >= 0 && (absoluteSecond() || second <= 59)))   throw new IllegalArgumentException("String_Node_Str");
  this.second=second.doubleValue();
}
Program: 5275
Project: 5275
Buggy source:
/** 
 * Returns the value of the parameter defined by a connector or <i>null</i> if the attribute is not defined.
 * @return string representing the value to be set to the connector parameter or <i>null</i> if the attribute is not defined.
 */
public String getValue(){
  if (value != null)   return value.toString();
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns the value of the parameter defined by a connector or <i>null</i> if the attribute is not defined.
 * @return value to be set to the connector parameter or <i>null</i> if the attribute is not defined.
 */
public Object getValue(){
  return value;
}
Program: 5276
Project: 5276
Buggy source:
protected String parseValue(){
  String aux=getValue();
  if (aux != null)   return "String_Node_Str" + aux + "String_Node_Str";
 else   return "String_Node_Str";
}

Fixed version (ground truth):
protected String parseValue(){
  Object aux=getValue();
  if (aux != null)   return "String_Node_Str" + aux.toString() + "String_Node_Str";
 else   return "String_Node_Str";
}
Program: 5277
Project: 5277
Buggy source:
@Override public Ei findInterface(String id) throws XMLException {
  Ei result;
  Object aux;
  if ((aux=getRefer()) != null) {
    if (aux instanceof NCLMedia)     return (Ei)((En)aux).findInterface(id);
 else     return (Ei)((En)((ExternalReferenceType)aux).getTarget()).findInterface(id);
  }
  for (  Ep p : properties) {
    if (p.getName().toString().equals(id))     return (Ei)p;
  }
  result=(Ei)areas.get(id);
  if (result != null)   return result;
  return null;
}

Fixed version (ground truth):
@Override public Ei findInterface(String id) throws XMLException {
  Ei result;
  Object aux;
  if ((aux=getRefer()) != null) {
    if (aux instanceof NCLMedia)     return (Ei)((En)aux).findInterface(id);
 else     return (Ei)((En)((ExternalReferenceType)aux).getTarget()).findInterface(id);
  }
  result=(Ei)properties.get(id);
  if (result != null)   return result;
  result=(Ei)areas.get(id);
  if (result != null)   return result;
  return null;
}
Program: 5278
Project: 5278
Buggy source:
/** 
 * Returns the element with an specific identification. The element identification can be its id, name or alias.
 * @param ident identification of the element to be retrieved.
 * @return element of the list with the identification. Return <i>null</i> if the element was not found or the element type does not have an identification.
 * @throws XMLException if the string is null or empty.
 */
public T get(String ident) throws XMLException {
  if (ident == null)   throw new XMLException("String_Node_Str");
  if ("String_Node_Str".equals(ident.trim()))   throw new XMLException("String_Node_Str");
  if (elements.isEmpty())   return null;
  T aux=elements.get(0);
  if (aux instanceof NCLIdentifiableElementPrototype) {
    for (    T el : elements) {
      if (((NCLIdentifiableElementPrototype)el).getId().equals(ident))       return el;
    }
  }
 else   if (aux instanceof NCLNamedElementPrototype) {
    for (    T el : elements) {
      if (((NCLNamedElementPrototype)el).getName().equals(ident))       return el;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the element with an specific identification. The element identification can be its id, name or alias.
 * @param ident identification of the element to be retrieved.
 * @return element of the list with the identification. Return <i>null</i> if the element was not found or the element type does not have an identification.
 * @throws XMLException if the string is null or empty.
 */
public T get(String ident) throws XMLException {
  if (ident == null)   throw new XMLException("String_Node_Str");
  if ("String_Node_Str".equals(ident.trim()))   throw new XMLException("String_Node_Str");
  if (elements.isEmpty())   return null;
  T aux=elements.get(0);
  if (aux instanceof NCLIdentifiableElementPrototype) {
    for (    T el : elements) {
      if (((NCLIdentifiableElementPrototype)el).getId().equals(ident))       return el;
    }
  }
 else   if (aux instanceof NCLNamedElementPrototype) {
    for (    T el : elements) {
      if (((NCLNamedElementPrototype)el).getName().toString().equals(ident))       return el;
    }
  }
  return null;
}
Program: 5279
Project: 5279
Buggy source:
@Override protected String parseIdent(){
switch ((NCLElementAttributes)getTargetAtt()) {
case ID:
    return getTarget().getId();
case FOCUSINDEX:
  return ((NCLDescriptorPrototype)getTarget()).getFocusIndex().toString();
}
return null;
}

Fixed version (ground truth):
@Override protected String parseIdent(){
switch ((NCLElementAttributes)getTargetAtt()) {
case ID:
    return getTarget().getId();
case FOCUSINDEX:
  return ((NCLDescriptorPrototype)getTarget()).getFocusIndex().parse();
}
return null;
}
Program: 5280
Project: 5280
Buggy source:
@Override public void setName(NCLAttributes name) throws XMLException {
  if (name == null)   throw new XMLException("String_Node_Str");
  if (!name.equals(NCLAttributes.STYLE) && !name.equals(NCLAttributes.FONT_FAMILY))   throw new XMLException("String_Node_Str");
  super.setName(name);
}

Fixed version (ground truth):
@Override public void setName(NCLAttributes name) throws XMLException {
  if (name == null)   throw new XMLException("String_Node_Str");
  super.setName(name);
}
Program: 5281
Project: 5281
Buggy source:
/** 
 * Return the name of the property element or <i>null</i> if the attribute is not defined. <br/> A property element may represent an attribute or group of attributes of a node element. <br/> If the property element is a child of a media element with type <i>settings</i>, than it indicates the use of a global variable in the list defined by the document.
 * @return string representing the name of property element or <i>null</i> if the attribute is not defined.
 */
public String getName(){
  if (varName != null)   return varName.parse();
  if (attName != null)   return attName.toString();
 else   return null;
}

Fixed version (ground truth):
/** 
 * Return the name of the property element or <i>null</i> if the attribute is not defined. <br/> A property element may represent an attribute or group of attributes of a node element. <br/> If the property element is a child of a media element with type <i>settings</i>, than it indicates the use of a global variable in the list defined by the document.
 * @return string representing the name of property element or <i>null</i> if the attribute is not defined.
 */
public String getName(){
  if (varName != null)   return varName.parse();
  if (attName != null)   return attName.getName();
 else   return null;
}
Program: 5283
Project: 5283
Buggy source:
public NCLPercentDescriptorParamPrototype() throws XMLException {
  super();
}

Fixed version (ground truth):
public NCLPercentDescriptorParamPrototype() throws XMLException {
  super();
  relative=false;
}
Program: 5284
Project: 5284
Buggy source:
public void load(Element element) throws NCLParsingException {
  String att_name, att_var;
  try {
    att_name=NCLElementAttributes.ALIAS.toString();
    if (!(att_var=element.getAttribute(att_name)).isEmpty())     setAlias(att_var);
 else     throw new NCLParsingException("String_Node_Str" + att_name + "String_Node_Str");
    att_name=NCLElementAttributes.DOCUMENTURI.toString();
    if (!(att_var=element.getAttribute(att_name)).isEmpty())     setDocumentURI(new SrcType(att_var));
 else     throw new NCLParsingException("String_Node_Str" + att_name + "String_Node_Str");
    att_name=NCLElementAttributes.REGION.toString();
    if (!(att_var=element.getAttribute(att_name)).isEmpty()) {
      setRegion((Er)NCLReferenceManager.getInstance().findRegionReference(impl.getDoc(),att_var));
    }
    Ed aux=createDoc();
    String path=impl.getDoc().getLocation() + File.separator + getDocumentURI().parse();
    aux.loadXML(new File(path));
    setImportedDoc(aux);
  }
 catch (  XMLException ex) {
    String aux=getAlias();
    if (aux != null)     aux="String_Node_Str" + aux + "String_Node_Str";
 else     aux="String_Node_Str";
    throw new NCLParsingException(type.toString() + aux + "String_Node_Str"+ ex.getMessage());
  }
}

Fixed version (ground truth):
public void load(Element element) throws NCLParsingException {
  String att_name, att_var;
  try {
    att_name=NCLElementAttributes.ALIAS.toString();
    if (!(att_var=element.getAttribute(att_name)).isEmpty())     setAlias(att_var);
 else     throw new NCLParsingException("String_Node_Str" + att_name + "String_Node_Str");
    att_name=NCLElementAttributes.DOCUMENTURI.toString();
    if (!(att_var=element.getAttribute(att_name)).isEmpty())     setDocumentURI(new SrcType(att_var));
 else     throw new NCLParsingException("String_Node_Str" + att_name + "String_Node_Str");
    att_name=NCLElementAttributes.REGION.toString();
    if (!(att_var=element.getAttribute(att_name)).isEmpty()) {
      setRegion((Er)NCLReferenceManager.getInstance().findRegionReference(impl.getDoc(),att_var));
    }
    try {
      Ed aux=createDoc();
      URI base=new URI(impl.getDoc().getLocation() + File.separator);
      URI path=base.resolve(getDocumentURI().parse());
      aux.loadXML(new File(path.getPath()));
      setImportedDoc(aux);
    }
 catch (    Exception e) {
      throw new NCLParsingException("String_Node_Str" + getDocumentURI().parse());
    }
  }
 catch (  XMLException ex) {
    String aux=getAlias();
    if (aux != null)     aux="String_Node_Str" + aux + "String_Node_Str";
 else     aux="String_Node_Str";
    throw new NCLParsingException(type.toString() + aux + "String_Node_Str"+ ex.getMessage());
  }
}
Program: 5285
Project: 5285
Buggy source:
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse() + "String_Node_Str";
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse();
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}
Program: 5286
Project: 5286
Buggy source:
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse() + "String_Node_Str";
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse();
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}
Program: 5287
Project: 5287
Buggy source:
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse() + "String_Node_Str";
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse();
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}
Program: 5288
Project: 5288
Buggy source:
protected String parseDuration(){
  DoubleParamType aux=getDuration();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse() + "String_Node_Str";
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
protected String parseDuration(){
  DoubleParamType aux=getDuration();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse();
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}
Program: 5289
Project: 5289
Buggy source:
protected String parseRepeatDelay(){
  DoubleParamType aux=getRepeatDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse() + "String_Node_Str";
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
protected String parseRepeatDelay(){
  DoubleParamType aux=getRepeatDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse();
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}
Program: 5290
Project: 5290
Buggy source:
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse() + "String_Node_Str";
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
protected String parseDelay(){
  DoubleParamType aux=getDelay();
  if (aux == null)   return "String_Node_Str";
  String content="String_Node_Str" + aux.parse();
  if (aux.getValue() != null)   content+="String_Node_Str";
 else   content+="String_Node_Str";
  return content;
}
Program: 5291
Project: 5291
Buggy source:
protected String parseDefaultDescriptor(int ident){
  El aux=getDefaultDescriptor();
  if (aux != null)   return "String_Node_Str";
  String space="String_Node_Str";
  if (ident < 0)   ident=0;
  for (int i=0; i < ident; i++)   space+="String_Node_Str";
  return space + "String_Node_Str" + aux.getId()+ "String_Node_Str";
}

Fixed version (ground truth):
protected String parseDefaultDescriptor(int ident){
  El aux=getDefaultDescriptor();
  if (aux == null)   return "String_Node_Str";
  String space="String_Node_Str";
  if (ident < 0)   ident=0;
  for (int i=0; i < ident; i++)   space+="String_Node_Str";
  return space + "String_Node_Str" + aux.getId()+ "String_Node_Str";
}
Program: 5292
Project: 5292
Buggy source:
public String parse(int ident){
  String space, content;
  if (ident < 0)   ident=0;
  space="String_Node_Str";
  for (int i=0; i < ident; i++)   space+="String_Node_Str";
  content=space + "String_Node_Str";
  content+=parseAttributes();
  if ((getValue() != null) || (this instanceof NCLColorDescriptorParamPrototype && ((NCLColorDescriptorParamPrototype)this).getIsTransparent() != null))   content+="String_Node_Str" + getParamValue() + "String_Node_Str";
  content+="String_Node_Str";
  return content;
}

Fixed version (ground truth):
public String parse(int ident){
  String space, content;
  if (ident < 0)   ident=0;
  space="String_Node_Str";
  for (int i=0; i < ident; i++)   space+="String_Node_Str";
  content=space + "String_Node_Str";
  content+=parseAttributes();
  content+="String_Node_Str";
  return content;
}
Program: 5293
Project: 5293
Buggy source:
protected String parseDefaultComponent(int ident){
  En aux=getDefaultComponent();
  if (aux != null)   return "String_Node_Str";
  String space="String_Node_Str";
  if (ident < 0)   ident=0;
  for (int i=0; i < ident; i++)   space+="String_Node_Str";
  return space + "String_Node_Str" + aux.getId()+ "String_Node_Str";
}

Fixed version (ground truth):
protected String parseDefaultComponent(int ident){
  En aux=getDefaultComponent();
  if (aux == null)   return "String_Node_Str";
  String space="String_Node_Str";
  if (ident < 0)   ident=0;
  for (int i=0; i < ident; i++)   space+="String_Node_Str";
  return space + "String_Node_Str" + aux.getId()+ "String_Node_Str";
}
Program: 5294
Project: 5294
Buggy source:
public void load(Element element) throws NCLParsingException {
  try {
    setRDFTree(element.getTextContent());
  }
 catch (  XMLException ex) {
    throw new NCLParsingException("String_Node_Str" + ex.getMessage());
  }
}

Fixed version (ground truth):
public void load(Element element) throws NCLParsingException {
  try {
    String aux=element.getTextContent();
    aux=aux.substring(1,aux.length() - 2);
    setRDFTree(aux);
  }
 catch (  XMLException ex) {
    throw new NCLParsingException("String_Node_Str" + ex.getMessage());
  }
}
Program: 5295
Project: 5295
Buggy source:
public boolean compare(T other){
  boolean comp=true;
  comp&=getComponent().compare(other.getComponent());
  comp&=getInterface().compare(other.getInterface());
  return comp;
}

Fixed version (ground truth):
public boolean compare(T other){
  boolean comp=true;
  En thisComp=getComponent();
  En otherComp=(En)other.getComponent();
  if (thisComp != null && otherComp != null)   comp&=thisComp.compare(otherComp);
 else   comp&=!(thisComp != null || otherComp != null);
  Ei thisInt=getInterface();
  Ei otherInt=(Ei)other.getInterface();
  if (thisInt != null && otherInt != null)   comp&=thisInt.compare(otherInt);
 else   comp&=!(thisInt != null || otherInt != null);
  return comp;
}
Program: 5296
Project: 5296
Buggy source:
/** 
 * Function to create the child element <i>port</i>. This function must be overwritten in classes that extends this one.
 * @return element representing the child <i>port</i>.
 */
protected Ept createPort(Element element) throws XMLException {
  return (Ept)new NCLPort(element);
}

Fixed version (ground truth):
/** 
 * Function to create the child element <i>port</i>. This function must be overwritten in classes that extends this one.
 * @return element representing the child <i>port</i>.
 */
protected Ept createPort() throws XMLException {
  return (Ept)new NCLPort();
}
Program: 5297
Project: 5297
Buggy source:
/** 
 * Function to create the child element <i>context</i>. This function must be overwritten in classes that extends this one.
 * @return element representing the child <i>context</i>.
 */
protected En createContext(Element element) throws XMLException {
  return (En)new NCLContext(element);
}

Fixed version (ground truth):
/** 
 * Function to create the child element <i>context</i>. This function must be overwritten in classes that extends this one.
 * @return element representing the child <i>context</i>.
 */
protected En createContext() throws XMLException {
  return (En)new NCLContext();
}