Program: 161018
Project: 161018
Buggy source:
@Override public void messageReceived(final ChannelHandlerContext ctx,final MessageEvent e){
  if (isKeepAlive()) {
    return;
  }
  final String queryString=e.getMessage().toString().trim();
  nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()),queryString);
  LOGGER.debug("String_Node_Str",queryString);
  final Query query=parseQueryString(queryString);
  final Channel channel=ctx.getChannel();
  if (query.isMirrorQuery()) {
    SerialRange range=serialDao.getSerials();
    if (query.getSerialEnd() == -1 || query.isKeepalive()) {
      query.setSerialEnd(range.getEnd());
    }
    if (!isRequestedSerialInRange(query,range)) {
      throw new IllegalArgumentException("String_Node_Str" + range.getBegin() + "String_Node_Str"+ range.getEnd());
    }
    if (serialDao.getSerialAge(query.getSerialBegin()) > HISTORY_AGE_LIMIT) {
      throw new IllegalArgumentException(String.format("String_Node_Str",HISTORY_AGE_LIMIT / SECONDS_PER_DAY));
    }
    final int version=query.getVersion();
    writeMessage(channel,String.format("String_Node_Str",version,source,query.getSerialBegin(),query.getSerialEnd()));
    if (version < NrtmServer.NRTM_VERSION) {
      writeMessage(channel,String.format("String_Node_Str",version,NrtmServer.NRTM_VERSION));
    }
    if (query.isKeepalive()) {
      handleMirrorQueryWithKeepalive(query,channel);
      return;
    }
 else {
      handleMirrorQuery(query,channel);
    }
  }
 else   if (query.isInfoQuery()) {
switch (query.getQueryOption()) {
case SOURCES:
      handleSourcesQuery(channel);
    break;
case VERSION:
  handleVersionQuery(channel);
break;
}
}
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}

Fixed version (ground truth):
@Override public void messageReceived(final ChannelHandlerContext ctx,final MessageEvent e){
  if (isKeepAlive()) {
    return;
  }
  final String queryString=e.getMessage().toString().trim();
  nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()),queryString);
  LOGGER.debug("String_Node_Str",queryString);
  final Query query=parseQueryString(queryString);
  final Channel channel=ctx.getChannel();
  if (query.isMirrorQuery()) {
    SerialRange range=serialDao.getSerials();
    if (query.getSerialEnd() == -1 || query.isKeepalive()) {
      query.setSerialEnd(range.getEnd());
    }
    if (!isRequestedSerialInRange(query,range)) {
      throw new IllegalArgumentException("String_Node_Str" + range.getBegin() + "String_Node_Str"+ range.getEnd());
    }
    final Integer serialAge=serialDao.getAgeOfExactOrNextExistingSerial(query.getSerialBegin());
    if (serialAge == null || serialAge > HISTORY_AGE_LIMIT) {
      throw new IllegalArgumentException(String.format("String_Node_Str",HISTORY_AGE_LIMIT / SECONDS_PER_DAY));
    }
    final int version=query.getVersion();
    writeMessage(channel,String.format("String_Node_Str",version,source,query.getSerialBegin(),query.getSerialEnd()));
    if (version < NrtmServer.NRTM_VERSION) {
      writeMessage(channel,String.format("String_Node_Str",version,NrtmServer.NRTM_VERSION));
    }
    if (query.isKeepalive()) {
      handleMirrorQueryWithKeepalive(query,channel);
      return;
    }
 else {
      handleMirrorQuery(query,channel);
    }
  }
 else   if (query.isInfoQuery()) {
switch (query.getQueryOption()) {
case SOURCES:
      handleSourcesQuery(channel);
    break;
case VERSION:
  handleVersionQuery(channel);
break;
}
}
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}