Program: 55323
Project: 55323
Buggy source:
/** 
 * Constructs a new task manager, starts its IPC service and attempts to discover the job manager to receive an initial configuration.
 * @param configDir the directory containing the configuration files for the task manager
 */
public TaskManager(String configDir) throws Exception {
  GlobalConfiguration.loadConfiguration(configDir);
  final String address=GlobalConfiguration.getString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY,null);
  InetSocketAddress jobManagerAddress=null;
  if (address == null) {
    LOG.info("String_Node_Str");
    try {
      jobManagerAddress=DiscoveryService.getJobManagerAddress();
    }
 catch (    DiscoveryException e) {
      throw new Exception("String_Node_Str" + e.getMessage(),e);
    }
  }
 else {
    LOG.info("String_Node_Str");
    final int port=GlobalConfiguration.getInteger(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY,ConfigConstants.DEFAULT_JOB_MANAGER_IPC_PORT);
    try {
      final InetAddress tmpAddress=InetAddress.getByName(address);
      jobManagerAddress=new InetSocketAddress(tmpAddress,port);
    }
 catch (    UnknownHostException e) {
      throw new Exception("String_Node_Str" + e.getMessage(),e);
    }
  }
  LOG.info("String_Node_Str" + jobManagerAddress);
  final int ipcPort=GlobalConfiguration.getInteger(ConfigConstants.TASK_MANAGER_IPC_PORT_KEY,ConfigConstants.DEFAULT_TASK_MANAGER_IPC_PORT);
  final int dataPort=GlobalConfiguration.getInteger(ConfigConstants.TASK_MANAGER_DATA_PORT_KEY,ConfigConstants.DEFAULT_TASK_MANAGER_DATA_PORT);
  InetAddress taskManagerAddress=null;
  try {
    taskManagerAddress=DiscoveryService.getTaskManagerAddress(jobManagerAddress.getAddress());
  }
 catch (  DiscoveryException e) {
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.localInstanceConnectionInfo=new InstanceConnectionInfo(taskManagerAddress,ipcPort,dataPort);
  RPCService rpcService=null;
  try {
    rpcService=new RPCService(ipcPort);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.rpcService=rpcService;
  LOG.info("String_Node_Str" + this.localInstanceConnectionInfo + "String_Node_Str");
  JobManagerProtocol jobManager=null;
  try {
    jobManager=this.rpcService.getProxy(jobManagerAddress,JobManagerProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.jobManager=jobManager;
  InputSplitProviderProtocol globalInputSplitProvider=null;
  try {
    globalInputSplitProvider=this.rpcService.getProxy(jobManagerAddress,InputSplitProviderProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.globalInputSplitProvider=globalInputSplitProvider;
  ChannelLookupProtocol lookupService=null;
  try {
    lookupService=this.rpcService.getProxy(jobManagerAddress,ChannelLookupProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.lookupService=lookupService;
  PluginCommunicationProtocol pluginCommunicationService=null;
  try {
    pluginCommunicationService=this.rpcService.getProxy(jobManagerAddress,PluginCommunicationProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.pluginCommunicationService=pluginCommunicationService;
  if (GlobalConfiguration.getBoolean(ProfilingUtils.ENABLE_PROFILING_KEY,false)) {
    final String profilerClassName=GlobalConfiguration.getString(ProfilingUtils.TASKMANAGER_CLASSNAME_KEY,null);
    if (profilerClassName == null) {
      LOG.error("String_Node_Str");
      throw new Exception("String_Node_Str");
    }
    this.profiler=ProfilingUtils.loadTaskManagerProfiler(profilerClassName,jobManagerAddress.getAddress(),this.localInstanceConnectionInfo);
  }
 else {
    this.profiler=null;
    LOG.debug("String_Node_Str");
  }
  final String[] tmpDirPaths=GlobalConfiguration.getString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY,ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH).split(File.pathSeparator);
  checkTempDirs(tmpDirPaths);
  ByteBufferedChannelManager byteBufferedChannelManager=null;
  try {
    byteBufferedChannelManager=new ByteBufferedChannelManager(this.lookupService,this.localInstanceConnectionInfo);
  }
 catch (  IOException ioe) {
    LOG.error(StringUtils.stringifyException(ioe));
    throw new Exception("String_Node_Str" + ioe.getMessage(),ioe);
  }
  this.byteBufferedChannelManager=byteBufferedChannelManager;
  HardwareDescription hardware=HardwareDescriptionFactory.extractFromSystem();
  if (hardware == null) {
    LOG.warn("String_Node_Str");
  }
  long memorySize=GlobalConfiguration.getInteger(ConfigConstants.MEMORY_MANAGER_AVAILABLE_MEMORY_SIZE_KEY,-1);
  if (memorySize > 0) {
    hardware=HardwareDescriptionFactory.construct(hardware.getNumberOfCPUCores(),hardware.getSizeOfPhysicalMemory(),memorySize * 1024L * 1024L);
  }
  this.hardwareDescription=hardware;
  LOG.info("String_Node_Str" + (hardware.getSizeOfFreeMemory() >>> 20) + "String_Node_Str");
  try {
    this.memoryManager=new DefaultMemoryManager(hardware.getSizeOfFreeMemory());
  }
 catch (  RuntimeException rte) {
    LOG.fatal("String_Node_Str" + (hardware.getSizeOfFreeMemory() >>> 20) + "String_Node_Str",rte);
    throw rte;
  }
  this.ioManager=new IOManager(tmpDirPaths);
  this.taskManagerPlugins=PluginManager.getTaskManagerPlugins(this,configDir);
  Runtime.getRuntime().addShutdownHook(new TaskManagerCleanUp(this));
}

Fixed version (ground truth):
/** 
 * Constructs a new task manager, starts its IPC service and attempts to discover the job manager to receive an initial configuration.
 * @param configDir the directory containing the configuration files for the task manager
 */
public TaskManager(String configDir) throws Exception {
  GlobalConfiguration.loadConfiguration(configDir);
  final String address=GlobalConfiguration.getString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY,null);
  InetSocketAddress jobManagerAddress=null;
  if (address == null) {
    LOG.info("String_Node_Str");
    try {
      jobManagerAddress=DiscoveryService.getJobManagerAddress();
    }
 catch (    DiscoveryException e) {
      throw new Exception("String_Node_Str" + e.getMessage(),e);
    }
  }
 else {
    LOG.info("String_Node_Str");
    final int port=GlobalConfiguration.getInteger(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY,ConfigConstants.DEFAULT_JOB_MANAGER_IPC_PORT);
    try {
      final InetAddress tmpAddress=InetAddress.getByName(address);
      jobManagerAddress=new InetSocketAddress(tmpAddress,port);
    }
 catch (    UnknownHostException e) {
      throw new Exception("String_Node_Str" + e.getMessage(),e);
    }
  }
  LOG.info("String_Node_Str" + jobManagerAddress);
  final int ipcPort=GlobalConfiguration.getInteger(ConfigConstants.TASK_MANAGER_IPC_PORT_KEY,ConfigConstants.DEFAULT_TASK_MANAGER_IPC_PORT);
  final int dataPort=GlobalConfiguration.getInteger(ConfigConstants.TASK_MANAGER_DATA_PORT_KEY,ConfigConstants.DEFAULT_TASK_MANAGER_DATA_PORT);
  InetAddress taskManagerAddress=null;
  try {
    taskManagerAddress=DiscoveryService.getTaskManagerAddress(jobManagerAddress.getAddress());
  }
 catch (  DiscoveryException e) {
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.localInstanceConnectionInfo=new InstanceConnectionInfo(taskManagerAddress,ipcPort,dataPort);
  RPCService rpcService=null;
  try {
    rpcService=new RPCService(ipcPort);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.rpcService=rpcService;
  this.rpcService.setProtocolCallbackHandler(TaskOperationProtocol.class,this);
  LOG.info("String_Node_Str" + this.localInstanceConnectionInfo + "String_Node_Str");
  JobManagerProtocol jobManager=null;
  try {
    jobManager=this.rpcService.getProxy(jobManagerAddress,JobManagerProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.jobManager=jobManager;
  InputSplitProviderProtocol globalInputSplitProvider=null;
  try {
    globalInputSplitProvider=this.rpcService.getProxy(jobManagerAddress,InputSplitProviderProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.globalInputSplitProvider=globalInputSplitProvider;
  ChannelLookupProtocol lookupService=null;
  try {
    lookupService=this.rpcService.getProxy(jobManagerAddress,ChannelLookupProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.lookupService=lookupService;
  PluginCommunicationProtocol pluginCommunicationService=null;
  try {
    pluginCommunicationService=this.rpcService.getProxy(jobManagerAddress,PluginCommunicationProtocol.class);
  }
 catch (  IOException e) {
    LOG.error(StringUtils.stringifyException(e));
    throw new Exception("String_Node_Str" + e.getMessage(),e);
  }
  this.pluginCommunicationService=pluginCommunicationService;
  if (GlobalConfiguration.getBoolean(ProfilingUtils.ENABLE_PROFILING_KEY,false)) {
    final String profilerClassName=GlobalConfiguration.getString(ProfilingUtils.TASKMANAGER_CLASSNAME_KEY,null);
    if (profilerClassName == null) {
      LOG.error("String_Node_Str");
      throw new Exception("String_Node_Str");
    }
    this.profiler=ProfilingUtils.loadTaskManagerProfiler(profilerClassName,jobManagerAddress.getAddress(),this.localInstanceConnectionInfo);
  }
 else {
    this.profiler=null;
    LOG.debug("String_Node_Str");
  }
  final String[] tmpDirPaths=GlobalConfiguration.getString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY,ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH).split(File.pathSeparator);
  checkTempDirs(tmpDirPaths);
  ByteBufferedChannelManager byteBufferedChannelManager=null;
  try {
    byteBufferedChannelManager=new ByteBufferedChannelManager(this.lookupService,this.localInstanceConnectionInfo);
  }
 catch (  IOException ioe) {
    LOG.error(StringUtils.stringifyException(ioe));
    throw new Exception("String_Node_Str" + ioe.getMessage(),ioe);
  }
  this.byteBufferedChannelManager=byteBufferedChannelManager;
  HardwareDescription hardware=HardwareDescriptionFactory.extractFromSystem();
  if (hardware == null) {
    LOG.warn("String_Node_Str");
  }
  long memorySize=GlobalConfiguration.getInteger(ConfigConstants.MEMORY_MANAGER_AVAILABLE_MEMORY_SIZE_KEY,-1);
  if (memorySize > 0) {
    hardware=HardwareDescriptionFactory.construct(hardware.getNumberOfCPUCores(),hardware.getSizeOfPhysicalMemory(),memorySize * 1024L * 1024L);
  }
  this.hardwareDescription=hardware;
  LOG.info("String_Node_Str" + (hardware.getSizeOfFreeMemory() >>> 20) + "String_Node_Str");
  try {
    this.memoryManager=new DefaultMemoryManager(hardware.getSizeOfFreeMemory());
  }
 catch (  RuntimeException rte) {
    LOG.fatal("String_Node_Str" + (hardware.getSizeOfFreeMemory() >>> 20) + "String_Node_Str",rte);
    throw rte;
  }
  this.ioManager=new IOManager(tmpDirPaths);
  this.taskManagerPlugins=PluginManager.getTaskManagerPlugins(this,configDir);
  Runtime.getRuntime().addShutdownHook(new TaskManagerCleanUp(this));
}