Program: 113587
Project: 113587
Buggy source:
public OSDRequestDispatcher(OSDConfig config) throws Exception {
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + VersionManagement.RELEASE_VERSION);
  this.config=config;
  assert(config.getUUID() != null);
  if (this.config.getDirectoryService().getHostName().equals(DiscoveryUtils.AUTODISCOVER_HOSTNAME)) {
    Logging.logMessage(Logging.LEVEL_INFO,Category.net,this,"String_Node_Str");
    DirService dir=DiscoveryUtils.discoverDir(10);
    if (dir == null) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.net,this,"String_Node_Str");
      throw new IOException("String_Node_Str");
    }
    Logging.logMessage(Logging.LEVEL_INFO,Category.net,this,"String_Node_Str" + dir.getAddress() + "String_Node_Str"+ dir.getPort());
    config.setDirectoryService(new InetSocketAddress(dir.getAddress(),dir.getPort()));
  }
  numBytesTX=new AtomicLong();
  numBytesRX=new AtomicLong();
  numObjsTX=new AtomicLong();
  numObjsRX=new AtomicLong();
  numReplBytesRX=new AtomicLong();
  numReplObjsRX=new AtomicLong();
  ChecksumFactory.getInstance().addProvider(new JavaChecksumProvider());
  operations=new HashMap();
  internalEvents=new HashMap<Class,OSDOperation>();
  initializeOperations();
  SSLOptions serverSSLopts=config.isUsingSSL() ? new SSLOptions(new FileInputStream(config.getServiceCredsFile()),config.getServiceCredsPassphrase(),config.getServiceCredsContainer(),new FileInputStream(config.getTrustedCertsFile()),config.getTrustedCertsPassphrase(),config.getTrustedCertsContainer(),false) : null;
  rpcServer=new RPCNIOSocketServer(config.getPort(),config.getAddress(),this,serverSSLopts);
  rpcServer.setLifeCycleListener(this);
  final SSLOptions clientSSLopts=config.isUsingSSL() ? new SSLOptions(new FileInputStream(config.getServiceCredsFile()),config.getServiceCredsPassphrase(),config.getServiceCredsContainer(),new FileInputStream(config.getTrustedCertsFile()),config.getTrustedCertsPassphrase(),config.getTrustedCertsContainer(),false) : null;
  rpcClient=new RPCNIOSocketClient(clientSSLopts,5000,5 * 60 * 1000);
  rpcClient.setLifeCycleListener(this);
  rpcClientForReplication=new RPCNIOSocketClient(clientSSLopts,30000,5 * 60 * 1000);
  rpcClientForReplication.setLifeCycleListener(this);
  this.serviceAvailability=new ServiceAvailability();
  MetadataCache metadataCache=new MetadataCache();
  StorageLayout storageLayout=new HashStorageLayout(config,metadataCache);
  udpCom=new UDPCommunicator(config.getPort(),this);
  udpCom.setLifeCycleListener(this);
  preprocStage=new PreprocStage(this);
  preprocStage.setLifeCycleListener(this);
  stStage=new StorageStage(this,metadataCache,storageLayout,1);
  stStage.setLifeCycleListener(this);
  delStage=new DeletionStage(this,metadataCache,storageLayout);
  delStage.setLifeCycleListener(this);
  replStage=new ReplicationStage(this);
  replStage.setLifeCycleListener(this);
  dirClient=new DIRClient(rpcClient,config.getDirectoryService());
  mrcClient=new MRCClient(rpcClient,null);
  osdClient=new OSDClient(rpcClient);
  osdClientForReplication=new OSDClient(rpcClientForReplication);
  TimeSync.initialize(dirClient,config.getRemoteTimeSync(),config.getLocalClockRenew());
  UUIDResolver.start(dirClient,10 * 1000,600 * 1000);
  UUIDResolver.addLocalMapping(config.getUUID(),config.getPort(),config.isUsingSSL() ? Constants.ONCRPCS_SCHEME : Constants.ONCRPC_SCHEME);
  UUIDResolver.addLocalMapping(config.getUUID(),config.getPort(),config.isUsingSSL() ? Constants.ONCRPCU_SCHEME : Constants.ONCRPC_SCHEME);
  myCoordinates=new AtomicReference<VivaldiCoordinates>();
  ServiceDataGenerator gen=new ServiceDataGenerator(){
    public ServiceSet getServiceData(){
      OSDConfig config=OSDRequestDispatcher.this.config;
      String freeSpace="String_Node_Str";
      if (config.isReportFreeSpace()) {
        freeSpace=String.valueOf(FSUtils.getFreeSpace(config.getObjDir()));
      }
      String totalSpace="String_Node_Str";
      try {
        File f=new File(config.getObjDir());
        totalSpace=String.valueOf(f.getTotalSpace());
      }
 catch (      Exception ex) {
      }
      OperatingSystemMXBean osb=ManagementFactory.getOperatingSystemMXBean();
      String load=String.valueOf((int)(osb.getSystemLoadAverage() * 100 / osb.getAvailableProcessors()));
      long totalRAM=Runtime.getRuntime().maxMemory();
      long usedRAM=Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
      ServiceSet data=new ServiceSet();
      ServiceDataMap dmap=new ServiceDataMap();
      dmap.put("String_Node_Str",load);
      dmap.put("String_Node_Str",totalSpace);
      dmap.put("String_Node_Str",freeSpace);
      dmap.put("String_Node_Str",Long.toString(totalRAM));
      dmap.put("String_Node_Str",Long.toString(usedRAM));
      dmap.put("String_Node_Str",config.getGeoCoordinates());
      dmap.put("String_Node_Str",Integer.toString(OSDInterface.getVersion()));
      VivaldiCoordinates coord=myCoordinates.get();
      if (coord != null) {
        dmap.put("String_Node_Str",VivaldiNode.coordinatesToString(coord));
      }
      dmap.putAll(config.getCustomParams());
      try {
        final String address="String_Node_Str".equals(config.getHostName()) ? config.getAddress() == null ? config.getUUID().getMappings()[0].resolvedAddr.getAddress().getHostAddress() : config.getAddress().getHostAddress() : config.getHostName();
        dmap.put("String_Node_Str","String_Node_Str" + address + "String_Node_Str"+ config.getHttpPort());
      }
 catch (      UnknownUUIDException ex) {
      }
      Service me=new Service(ServiceType.SERVICE_TYPE_OSD,config.getUUID().toString(),0,"String_Node_Str" + config.getUUID(),0,dmap);
      data.add(me);
      return data;
    }
  }
;
  heartbeatThread=new HeartbeatThread("String_Node_Str",dirClient,config.getUUID(),gen,config,true);
  httpServ=HttpServer.create(new InetSocketAddress(config.getHttpPort()),0);
  httpServ.createContext("String_Node_Str",new HttpHandler(){
    public void handle(    HttpExchange httpExchange) throws IOException {
      byte[] content;
      try {
        content=StatusPage.getStatusPage(OSDRequestDispatcher.this).getBytes("String_Node_Str");
        httpExchange.sendResponseHeaders(200,content.length);
        httpExchange.getResponseBody().write(content);
        httpExchange.getResponseBody().close();
      }
 catch (      Throwable ex) {
        ex.printStackTrace();
        httpExchange.sendResponseHeaders(500,0);
      }
    }
  }
);
  httpServ.start();
  startupTime=System.currentTimeMillis();
  cThread=new CleanupThread(this,(HashStorageLayout)storageLayout);
  cThread.setLifeCycleListener(this);
  if (Logging.isDebug())   Logging.logMessage(Logging.LEVEL_DEBUG,Category.lifecycle,this,"String_Node_Str",this.getConfig().getUUID().toString());
}

Fixed version (ground truth):
public OSDRequestDispatcher(OSDConfig config) throws Exception {
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + VersionManagement.RELEASE_VERSION);
  this.config=config;
  assert(config.getUUID() != null);
  if (this.config.getDirectoryService().getHostName().equals(DiscoveryUtils.AUTODISCOVER_HOSTNAME)) {
    Logging.logMessage(Logging.LEVEL_INFO,Category.net,this,"String_Node_Str");
    DirService dir=DiscoveryUtils.discoverDir(10);
    if (dir == null) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.net,this,"String_Node_Str");
      throw new IOException("String_Node_Str");
    }
    Logging.logMessage(Logging.LEVEL_INFO,Category.net,this,"String_Node_Str" + dir.getAddress() + "String_Node_Str"+ dir.getPort());
    config.setDirectoryService(new InetSocketAddress(dir.getAddress(),dir.getPort()));
  }
  numBytesTX=new AtomicLong();
  numBytesRX=new AtomicLong();
  numObjsTX=new AtomicLong();
  numObjsRX=new AtomicLong();
  numReplBytesRX=new AtomicLong();
  numReplObjsRX=new AtomicLong();
  ChecksumFactory.getInstance().addProvider(new JavaChecksumProvider());
  operations=new HashMap();
  internalEvents=new HashMap<Class,OSDOperation>();
  initializeOperations();
  SSLOptions serverSSLopts=config.isUsingSSL() ? new SSLOptions(new FileInputStream(config.getServiceCredsFile()),config.getServiceCredsPassphrase(),config.getServiceCredsContainer(),new FileInputStream(config.getTrustedCertsFile()),config.getTrustedCertsPassphrase(),config.getTrustedCertsContainer(),false) : null;
  rpcServer=new RPCNIOSocketServer(config.getPort(),config.getAddress(),this,serverSSLopts);
  rpcServer.setLifeCycleListener(this);
  final SSLOptions clientSSLopts=config.isUsingSSL() ? new SSLOptions(new FileInputStream(config.getServiceCredsFile()),config.getServiceCredsPassphrase(),config.getServiceCredsContainer(),new FileInputStream(config.getTrustedCertsFile()),config.getTrustedCertsPassphrase(),config.getTrustedCertsContainer(),false) : null;
  rpcClient=new RPCNIOSocketClient(clientSSLopts,5000,5 * 60 * 1000);
  rpcClient.setLifeCycleListener(this);
  rpcClientForReplication=new RPCNIOSocketClient(clientSSLopts,30000,5 * 60 * 1000);
  rpcClientForReplication.setLifeCycleListener(this);
  this.serviceAvailability=new ServiceAvailability();
  MetadataCache metadataCache=new MetadataCache();
  StorageLayout storageLayout=new HashStorageLayout(config,metadataCache);
  udpCom=new UDPCommunicator(config.getPort(),this);
  udpCom.setLifeCycleListener(this);
  preprocStage=new PreprocStage(this);
  preprocStage.setLifeCycleListener(this);
  stStage=new StorageStage(this,metadataCache,storageLayout,1);
  stStage.setLifeCycleListener(this);
  delStage=new DeletionStage(this,metadataCache,storageLayout);
  delStage.setLifeCycleListener(this);
  replStage=new ReplicationStage(this);
  replStage.setLifeCycleListener(this);
  dirClient=new DIRClient(rpcClient,config.getDirectoryService());
  mrcClient=new MRCClient(rpcClient,null);
  osdClient=new OSDClient(rpcClient);
  osdClientForReplication=new OSDClient(rpcClientForReplication);
  TimeSync.initialize(dirClient,config.getRemoteTimeSync(),config.getLocalClockRenew());
  UUIDResolver.start(dirClient,10 * 1000,600 * 1000);
  UUIDResolver.addLocalMapping(config.getUUID(),config.getPort(),config.isUsingSSL() ? Constants.ONCRPCS_SCHEME : Constants.ONCRPC_SCHEME);
  UUIDResolver.addLocalMapping(config.getUUID(),config.getPort(),config.isUsingSSL() ? Constants.ONCRPCU_SCHEME : Constants.ONCRPC_SCHEME);
  myCoordinates=new AtomicReference<VivaldiCoordinates>();
  ServiceDataGenerator gen=new ServiceDataGenerator(){
    public ServiceSet getServiceData(){
      OSDConfig config=OSDRequestDispatcher.this.config;
      String freeSpace="String_Node_Str";
      if (config.isReportFreeSpace()) {
        freeSpace=String.valueOf(FSUtils.getFreeSpace(config.getObjDir()));
      }
      String totalSpace="String_Node_Str";
      try {
        File f=new File(config.getObjDir());
        totalSpace=String.valueOf(f.getTotalSpace());
      }
 catch (      Exception ex) {
      }
      OperatingSystemMXBean osb=ManagementFactory.getOperatingSystemMXBean();
      String load=String.valueOf((int)(osb.getSystemLoadAverage() * 100 / osb.getAvailableProcessors()));
      long totalRAM=Runtime.getRuntime().maxMemory();
      long usedRAM=Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
      ServiceSet data=new ServiceSet();
      ServiceDataMap dmap=new ServiceDataMap();
      dmap.put("String_Node_Str",load);
      dmap.put("String_Node_Str",totalSpace);
      dmap.put("String_Node_Str",freeSpace);
      dmap.put("String_Node_Str",Long.toString(totalRAM));
      dmap.put("String_Node_Str",Long.toString(usedRAM));
      dmap.put("String_Node_Str",config.getGeoCoordinates());
      dmap.put("String_Node_Str",Integer.toString(OSDInterface.getVersion()));
      VivaldiCoordinates coord=myCoordinates.get();
      if (coord != null) {
        dmap.put("String_Node_Str",VivaldiNode.coordinatesToString(coord));
      }
      dmap.putAll(config.getCustomParams());
      try {
        final String address="String_Node_Str".equals(config.getHostName()) ? config.getAddress() == null ? config.getUUID().getMappings()[0].resolvedAddr.getAddress().getHostAddress() : config.getAddress().getHostAddress() : config.getHostName();
        dmap.put("String_Node_Str","String_Node_Str" + address + "String_Node_Str"+ config.getHttpPort());
      }
 catch (      UnknownUUIDException ex) {
      }
      Service me=new Service(ServiceType.SERVICE_TYPE_OSD,config.getUUID().toString(),0,"String_Node_Str" + config.getUUID(),0,dmap);
      data.add(me);
      return data;
    }
  }
;
  heartbeatThread=new HeartbeatThread("String_Node_Str",dirClient,config.getUUID(),gen,config,true);
  httpServ=HttpServer.create(new InetSocketAddress(config.getHttpPort()),0);
  httpServ.createContext("String_Node_Str",new HttpHandler(){
    public void handle(    HttpExchange httpExchange) throws IOException {
      byte[] content;
      try {
        content=StatusPage.getStatusPage(OSDRequestDispatcher.this).getBytes("String_Node_Str");
        httpExchange.sendResponseHeaders(200,content.length);
        httpExchange.getResponseBody().write(content);
        httpExchange.getResponseBody().close();
      }
 catch (      Throwable ex) {
        ex.printStackTrace();
        httpExchange.sendResponseHeaders(500,0);
      }
    }
  }
);
  httpServ.start();
  startupTime=System.currentTimeMillis();
  vStage=new VivaldiStage(this);
  vStage.setLifeCycleListener(this);
  cThread=new CleanupThread(this,(HashStorageLayout)storageLayout);
  cThread.setLifeCycleListener(this);
  if (Logging.isDebug())   Logging.logMessage(Logging.LEVEL_DEBUG,Category.lifecycle,this,"String_Node_Str",this.getConfig().getUUID().toString());
}