Program: 113616
Project: 113616
Buggy source:
public void run(){
  notifyStarted();
  try {
    final DatagramSocket dsock=new DatagramSocket(DIRInterface.DEFAULT_ONCRPC_PORT);
    final byte[] data=new byte[2048];
    Logging.logMessage(Logging.LEVEL_INFO,Logging.Category.lifecycle,me,"String_Node_Str");
    do {
      DatagramPacket p=new DatagramPacket(data,data.length);
      dsock.receive(p);
      try {
        ReusableBuffer b=ReusableBuffer.wrap(p.getData(),0,p.getLength());
        b.position(Integer.SIZE / 8);
        ONCRPCRequestHeader hdr=new ONCRPCRequestHeader();
        hdr.deserialize(b);
        xtreemfs_discover_dirRequest rq=new xtreemfs_discover_dirRequest();
        rq.deserialize(b);
        xtreemfs_discover_dirResponse resp=new xtreemfs_discover_dirResponse(me);
        ONCRPCResponseHeader respHdr=new ONCRPCResponseHeader(hdr.getXID(),ONCRPCResponseHeader.REPLY_STAT_MSG_ACCEPTED,ONCRPCResponseHeader.ACCEPT_STAT_SUCCESS);
        ONCRPCBufferWriter wr=new ONCRPCBufferWriter(2048);
        wr.putInt(ONCRPCRecordFragmentHeader.getFragmentHeader(respHdr.calculateSize() + resp.calculateSize(),true));
        respHdr.serialize(wr);
        resp.serialize(wr);
        wr.flip();
        byte[] rdata=wr.getBuffers().get(0).array();
        wr.freeBuffers();
        DatagramPacket rp=new DatagramPacket(rdata,0,rdata.length,p.getSocketAddress());
        dsock.send(rp);
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Logging.Category.net,this,"String_Node_Str",p.getSocketAddress());
      }
 catch (      Exception ex) {
        continue;
      }
    }
 while (!quit);
    dsock.close();
  }
 catch (  Exception ex) {
    notifyCrashed(ex);
  }
  notifyStopped();
  Logging.logMessage(Logging.LEVEL_INFO,Logging.Category.lifecycle,me,"String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  notifyStarted();
  try {
    final DatagramChannel channel=DatagramChannel.open();
    channel.socket().bind(new InetSocketAddress(DIRInterface.DEFAULT_ONCRPC_PORT));
    channel.configureBlocking(true);
    Logging.logMessage(Logging.LEVEL_INFO,Logging.Category.lifecycle,me,"String_Node_Str");
    final ReusableBuffer data=BufferPool.allocate(2048);
    do {
      data.position(0);
      data.limit(data.capacity());
      InetSocketAddress sender=(InetSocketAddress)channel.receive(data.getBuffer());
      try {
        data.position(Integer.SIZE / 8);
        ONCRPCRequestHeader hdr=new ONCRPCRequestHeader();
        hdr.deserialize(data);
        xtreemfs_discover_dirRequest rq=new xtreemfs_discover_dirRequest();
        rq.deserialize(data);
        xtreemfs_discover_dirResponse resp=new xtreemfs_discover_dirResponse(me);
        ONCRPCResponseHeader respHdr=new ONCRPCResponseHeader(hdr.getXID(),ONCRPCResponseHeader.REPLY_STAT_MSG_ACCEPTED,ONCRPCResponseHeader.ACCEPT_STAT_SUCCESS);
        ONCRPCBufferWriter wr=new ONCRPCBufferWriter(2048);
        wr.putInt(ONCRPCRecordFragmentHeader.getFragmentHeader(respHdr.calculateSize() + resp.calculateSize(),true));
        respHdr.serialize(wr);
        resp.serialize(wr);
        wr.flip();
        channel.send(wr.getBuffers().get(0).getBuffer(),sender);
        wr.freeBuffers();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Logging.Category.net,this,"String_Node_Str",sender);
      }
 catch (      Exception ex) {
        continue;
      }
    }
 while (!quit);
    channel.close();
  }
 catch (  Exception ex) {
    if (!quit)     notifyCrashed(ex);
  }
  notifyStopped();
  Logging.logMessage(Logging.LEVEL_INFO,Logging.Category.lifecycle,me,"String_Node_Str");
}