Program: 95185
Project: 95185
Buggy source:
/** 
 * Create a new container instance, and connect to a remote server or group.
 * @param containerType the container type used to create the new container instance.  Must not be null.
 * @param uri the uri that is used to create a targetID for connection.  Must not be null.
 * @param nickname an optional String nickname.  May be null.
 * @param connectData optional connection data.  May be null.
 * @param resource the resource that this container instance is associated with.  Must not be null.
 * @throws Exception
 */
public void createAndConnectClient(final String containerType,String uri,String nickname,final Object connectData,final IResource resource) throws Exception {
  final IContainer newClient=ContainerFactory.getDefault().makeContainer(containerType);
  Namespace targetNamespace=newClient.getConnectNamespace();
  ID targetID=IDFactory.getDefault().makeID(targetNamespace,uri);
  String username=setupUsername(targetID,nickname);
  final ClientEntry newClientEntry=new ClientEntry(containerType,newClient);
  IPresenceContainer pc=(IPresenceContainer)newClient.getAdapter(IPresenceContainer.class);
  if (pc != null) {
    presenceContainerUI=new PresenceContainerUI(pc);
    presenceContainerUI.setup(newClient,targetID,username);
  }
 else {
    ISharedObjectContainer sharedObjectContainer=(ISharedObjectContainer)newClient.getAdapter(ISharedObjectContainer.class);
    if (sharedObjectContainer != null) {
      new SharedObjectContainerUI(this,sharedObjectContainer).setup(sharedObjectContainer,newClientEntry,resource,username);
    }
  }
  try {
    newClient.connect(targetID,getJoinContext(username,connectData));
  }
 catch (  ContainerConnectException e) {
    EclipseCollabSharedObject so=newClientEntry.getObject();
    if (so != null)     so.destroySelf();
    throw e;
  }
  if (presenceContainerUI != null) {
    try {
      presenceContainerUI.connectToFirstChatRoom();
    }
 catch (    ECFException e1) {
      System.err.println("String_Node_Str");
      e1.printStackTrace(System.err);
    }
  }
  addClientForResource(newClientEntry,resource);
}

Fixed version (ground truth):
/** 
 * Create a new container instance, and connect to a remote server or group.
 * @param containerType the container type used to create the new container instance.  Must not be null.
 * @param uri the uri that is used to create a targetID for connection.  Must not be null.
 * @param nickname an optional String nickname.  May be null.
 * @param connectData optional connection data.  May be null.
 * @param resource the resource that this container instance is associated with.  Must not be null.
 * @throws Exception
 */
public void createAndConnectClient(final String containerType,String uri,String nickname,final Object connectData,final IResource resource) throws Exception {
  final IContainer newClient=ContainerFactory.getDefault().makeContainer(containerType);
  Namespace targetNamespace=newClient.getConnectNamespace();
  ID targetID=IDFactory.getDefault().makeID(targetNamespace,uri);
  String username=setupUsername(targetID,nickname);
  final ClientEntry newClientEntry=new ClientEntry(containerType,newClient);
  IPresenceContainer pc=(IPresenceContainer)newClient.getAdapter(IPresenceContainer.class);
  if (pc != null) {
    presenceContainerUI=new PresenceContainerUI(pc);
    presenceContainerUI.setup(newClient,targetID,username);
  }
 else {
    ISharedObjectContainer sharedObjectContainer=(ISharedObjectContainer)newClient.getAdapter(ISharedObjectContainer.class);
    if (sharedObjectContainer != null) {
      new SharedObjectContainerUI(this,sharedObjectContainer).setup(sharedObjectContainer,newClientEntry,resource,username);
    }
  }
  try {
    newClient.connect(targetID,getJoinContext(username,connectData));
  }
 catch (  ContainerConnectException e) {
    EclipseCollabSharedObject so=newClientEntry.getObject();
    if (so != null)     so.destroySelf();
    throw e;
  }
  addClientForResource(newClientEntry,resource);
}