Program: 7901
Project: 7901
Buggy source:
/** 
 * Configures the metrics collection server and registers the address and port the server is running on.
 * @param args command line arguments
 * @param conf configuration object.
 * @return instance of server info to be used for service registration.
 */
@Override protected RegisteredServerInfo configure(String[] args,CConfiguration conf){
  try {
    if (handler == null) {
      handler=new MetricsCollectionServerIoHandler(conf);
    }
    int serverPort=conf.getInt(Constants.CFG_METRICS_COLLECTOR_SERVER_PORT,Constants.DEFAULT_METRICS_COLLECTOR_SERVER_PORT);
    InetAddress serverAddress=getServerInetAddress(conf.get(Constants.CFG_METRICS_COLLECTOR_SERVER_ADDRESS,Constants.DEFAULT_METRICS_COLLECTOR_SERVER_ADDRESS));
    MBeanServer mBeanServer=handler.getmBeanServer();
    acceptor=new NioSocketAcceptor();
    acceptor.setReuseAddress(true);
    acceptor.getSessionConfig().setKeepAlive(true);
    acceptor.getSessionConfig().setTcpNoDelay(true);
    IoServiceMBean acceptorMBean=new IoServiceMBean(acceptor);
    if (mBeanServer != null) {
      ObjectName acceptorName=new ObjectName(acceptor.getClass().getPackage().getName() + "String_Node_Str" + acceptor.getClass().getSimpleName());
      mBeanServer.registerMBean(acceptorMBean,acceptorName);
    }
    ProtocolCodecFilter protocolFilter=new ProtocolCodecFilter(new MetricCodecFactory(false));
    IoFilterMBean protocolFilterMBean=new IoFilterMBean(protocolFilter);
    if (mBeanServer != null) {
      ObjectName protocolFilterName=new ObjectName(protocolFilter.getClass().getPackage().getName() + "String_Node_Str" + protocolFilter.getClass().getSimpleName());
      mBeanServer.registerMBean(protocolFilterMBean,protocolFilterName);
    }
    acceptor.getFilterChain().addLast("String_Node_Str",protocolFilter);
    DefaultIoFilterChainBuilder filterChainBuilder=acceptor.getFilterChain();
    filterChainBuilder.addLast("String_Node_Str",new ExecutorFilter(new ThreadPoolExecutor(IDLE_THREAD_POOL_SIZE,THREAD_POOL_SIZE,5 * 60,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(WORKER_QUEUE_LENGTH))));
    acceptor.setHandler(handler);
    acceptor.bind(new InetSocketAddress(serverAddress,serverPort));
    setServerName(Constants.SERVICE_METRICS_COLLECTION_SERVER);
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
      @Override public void run(){
        try {
          Log.info("String_Node_Str");
          handler.close();
        }
 catch (        IOException e) {
          Log.error("String_Node_Str",e.getMessage());
        }
      }
    }
));
    RegisteredServerInfo registrationInfo=new RegisteredServerInfo(serverAddress.getHostAddress(),serverPort);
    return registrationInfo;
  }
 catch (  Exception e) {
    Log.debug(StackTraceUtil.toStringStackTrace(e));
    Log.error("String_Node_Str",e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Configures the metrics collection server and registers the address and port the server is running on.
 * @param args command line arguments
 * @param conf configuration object.
 * @return instance of server info to be used for service registration.
 */
@Override protected RegisteredServerInfo configure(String[] args,CConfiguration conf){
  try {
    if (handler == null) {
      handler=new MetricsCollectionServerIoHandler(conf);
    }
    int serverPort=conf.getInt(Constants.CFG_METRICS_COLLECTOR_SERVER_PORT,Constants.DEFAULT_METRICS_COLLECTOR_SERVER_PORT);
    InetAddress serverAddress=getServerInetAddress(conf.get(Constants.CFG_METRICS_COLLECTOR_SERVER_ADDRESS,Constants.DEFAULT_METRICS_COLLECTOR_SERVER_ADDRESS));
    MBeanServer mBeanServer=handler.getmBeanServer();
    acceptor=new NioSocketAcceptor();
    acceptor.setReuseAddress(true);
    acceptor.getSessionConfig().setKeepAlive(true);
    acceptor.getSessionConfig().setTcpNoDelay(true);
    IoServiceMBean acceptorMBean=new IoServiceMBean(acceptor);
    if (mBeanServer != null) {
      ObjectName acceptorName=new ObjectName(acceptor.getClass().getPackage().getName() + "String_Node_Str" + acceptor.getClass().getSimpleName());
      mBeanServer.registerMBean(acceptorMBean,acceptorName);
    }
    ProtocolCodecFilter protocolFilter=new ProtocolCodecFilter(new MetricCodecFactory(false));
    IoFilterMBean protocolFilterMBean=new IoFilterMBean(protocolFilter);
    if (mBeanServer != null) {
      ObjectName protocolFilterName=new ObjectName(protocolFilter.getClass().getPackage().getName() + "String_Node_Str" + protocolFilter.getClass().getSimpleName());
      mBeanServer.registerMBean(protocolFilterMBean,protocolFilterName);
    }
    acceptor.getFilterChain().addLast("String_Node_Str",protocolFilter);
    DefaultIoFilterChainBuilder filterChainBuilder=acceptor.getFilterChain();
    filterChainBuilder.addLast("String_Node_Str",new ExecutorFilter(new ThreadPoolExecutor(IDLE_THREAD_POOL_SIZE,THREAD_POOL_SIZE,5 * 60,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(WORKER_QUEUE_LENGTH))));
    acceptor.setHandler(handler);
    acceptor.bind(new InetSocketAddress(serverAddress,serverPort));
    setServerName(Constants.SERVICE_METRICS_COLLECTION_SERVER);
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
      @Override public void run(){
        try {
          Log.info("String_Node_Str");
          handler.close();
        }
 catch (        IOException e) {
          Log.error("String_Node_Str",e.getMessage());
        }
      }
    }
));
    RegisteredServerInfo registrationInfo=new RegisteredServerInfo(serverAddress.getHostAddress(),serverPort);
    return registrationInfo;
  }
 catch (  Exception e) {
    Log.error("String_Node_Str",e.getMessage(),e);
  }
  return null;
}