Program: 92260
Project: 92260
Buggy source:
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  assert(fRoot != null);
  IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (window == null) {
    return false;
  }
  ISystemRegistry registry=RSECorePlugin.getTheSystemRegistry();
  IRSESystemType sysType=RSECorePlugin.getTheCoreRegistry().getSystemTypeById(TRACE_CONTROL_SYSTEM_TYPE);
  IHost[] hosts=registry.getHostsBySystemType(sysType);
  final INewConnectionDialog dialog=TraceControlDialogFactory.getInstance().getNewConnectionDialog();
  dialog.setTraceControlParent(fRoot);
  dialog.setHosts(hosts);
  if (dialog.open() != Window.OK) {
    return null;
  }
  String hostName=dialog.getConnectionName();
  String hostAddress=dialog.getHostName();
  IHost host=null;
  for (int i=0; i < hosts.length; i++) {
    if (hosts[i].getAliasName().equals(hostName)) {
      host=hosts[i];
      break;
    }
  }
  if (host == null) {
    try {
      host=registry.createHost(sysType,hostName,hostAddress,"String_Node_Str");
    }
 catch (    Exception e) {
      MessageDialog.openError(window.getShell(),Messages.TraceControl_EclipseCommandFailure,Messages.TraceControl_NewNodeCreationFailure + "String_Node_Str" + hostName+ "String_Node_Str"+ hostAddress+ "String_Node_Str"+ "String_Node_Str"+ e.toString());
      return null;
    }
  }
  if (host != null) {
    fLock.lock();
    try {
      TargetNodeComponent node=null;
      if (!fRoot.containsChild(hostName)) {
        node=new TargetNodeComponent(hostName,fRoot,host);
        fRoot.addChild(node);
      }
 else {
        node=(TargetNodeComponent)fRoot.getChild(hostName);
      }
      node.connect();
    }
  finally {
      fLock.unlock();
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  assert(fRoot != null);
  IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (window == null) {
    return false;
  }
  ISystemRegistry registry=RSECorePlugin.getTheSystemRegistry();
  IRSESystemType sysType=RSECorePlugin.getTheCoreRegistry().getSystemTypeById(TRACE_CONTROL_SYSTEM_TYPE);
  IHost[] hosts=getSuitableHosts();
  final INewConnectionDialog dialog=TraceControlDialogFactory.getInstance().getNewConnectionDialog();
  dialog.setTraceControlParent(fRoot);
  dialog.setHosts(hosts);
  if (dialog.open() != Window.OK) {
    return null;
  }
  String hostName=dialog.getConnectionName();
  String hostAddress=dialog.getHostName();
  IHost host=null;
  for (int i=0; i < hosts.length; i++) {
    if (hosts[i].getAliasName().equals(hostName)) {
      host=hosts[i];
      break;
    }
  }
  if (host == null) {
    try {
      host=registry.createHost(sysType,hostName,hostAddress,"String_Node_Str");
    }
 catch (    Exception e) {
      MessageDialog.openError(window.getShell(),Messages.TraceControl_EclipseCommandFailure,Messages.TraceControl_NewNodeCreationFailure + "String_Node_Str" + hostName+ "String_Node_Str"+ hostAddress+ "String_Node_Str"+ "String_Node_Str"+ e.toString());
      return null;
    }
  }
  if (host != null) {
    fLock.lock();
    try {
      TargetNodeComponent node=null;
      if (!fRoot.containsChild(hostName)) {
        node=new TargetNodeComponent(hostName,fRoot,host);
        fRoot.addChild(node);
      }
 else {
        node=(TargetNodeComponent)fRoot.getChild(hostName);
      }
      node.connect();
    }
  finally {
      fLock.unlock();
    }
  }
  return null;
}