Program: 95030
Project: 95030
Buggy source:
protected void setup(final IContainer container,final ID localUser,final String nick){
  this.container=container;
  this.soContainer=(ISharedObjectContainer)this.container.getAdapter(ISharedObjectContainer.class);
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      try {
        IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage wp=ww.getActivePage();
        IViewPart view=wp.showView("String_Node_Str");
        rosterView=(RosterView)view;
        String nickname=null;
        if (nick != null) {
          nickname=nick;
        }
 else {
          String name=localUser.getName();
          nickname=name.substring(0,name.indexOf("String_Node_Str"));
        }
        PresenceContainerUI.this.localUser=new org.eclipse.ecf.core.user.User(localUser,nickname);
      }
 catch (      Exception e) {
        ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.PLUGIN_ID,SEND_ERRORCODE,"String_Node_Str",e));
      }
    }
  }
);
  chatManager.addMessageListener(new IIMMessageListener(){
    public void handleMessageEvent(    final IIMMessageEvent chatMessageEvent){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          if (chatMessageEvent instanceof IChatMessageEvent) {
            rosterView.handleMessageEvent(chatMessageEvent);
          }
 else           if (chatMessageEvent instanceof ITypingMessageEvent) {
            rosterView.handleTyping(chatMessageEvent.getFromID());
          }
        }
      }
);
    }
  }
);
  container.addListener(new IContainerListener(){
    public void handleEvent(    IContainerEvent event){
      if (event instanceof IContainerConnectedEvent) {
        IContainerConnectedEvent cce=(IContainerConnectedEvent)event;
        final ID joinedContainer=cce.getTargetID();
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            ILocalInputHandler handler=new ILocalInputHandler(){
              public void inputText(              ID userID,              String text){
                try {
                  chatMessageSender.sendChatMessage(userID,text);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void startTyping(              ID userID){
                try {
                  typingMessageSender.sendTypingMessage(userID,true,"String_Node_Str");
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void disconnect(){
                container.disconnect();
              }
              public void updatePresence(              ID userID,              IPresence presence){
                try {
                  presenceSender.sendPresenceUpdate(userID,presence);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void sendRosterAdd(              String user,              String name,              String[] groups){
                try {
                  rosterSubscriptionSender.sendRosterAdd(user,name,groups);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void sendRosterRemove(              ID userID){
                try {
                  rosterSubscriptionSender.sendRosterRemove(userID);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
            }
;
            PresenceContainerUI.this.groupID=joinedContainer;
            rosterView.addAccount(joinedContainer,PresenceContainerUI.this.localUser,handler,pc,soContainer);
          }
        }
);
      }
 else       if (event instanceof IContainerDisconnectedEvent) {
        final IContainerDisconnectedEvent de=(IContainerDisconnectedEvent)event;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            rosterView.accountDisconnected(de.getTargetID());
          }
        }
);
      }
    }
  }
);
  pc.getRosterManager().addPresenceListener(new IPresenceListener(){
    public void handleRosterEntryAdd(    final IRosterEntry entry){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handleRosterEntryAdd(PresenceContainerUI.this.groupID,entry);
        }
      }
);
    }
    public void handlePresence(    final ID fromID,    final IPresence presence){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handlePresence(PresenceContainerUI.this.groupID,fromID,presence);
        }
      }
);
    }
    public void handleRosterEntryUpdate(    final IRosterEntry entry){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handleRosterEntryAdd(PresenceContainerUI.this.groupID,entry);
        }
      }
);
    }
    public void handleRosterEntryRemove(    final IRosterEntry entry){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handleRosterEntryRemove(PresenceContainerUI.this.groupID,entry);
        }
      }
);
    }
  }
);
  pc.getRosterManager().addRosterSubscriptionListener(new IRosterSubscriptionListener(){
    public void handleSubscribeRequest(    final ID fromID){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          try {
            IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            ReceiveAuthorizeRequestDialog authRequest=new ReceiveAuthorizeRequestDialog(ww.getShell(),fromID.getName(),localUser.getName());
            authRequest.setBlockOnOpen(true);
            authRequest.open();
            int res=authRequest.getButtonPressed();
            if (res == ReceiveAuthorizeRequestDialog.AUTHORIZE_AND_ADD) {
              if (presenceSender != null) {
                presenceSender.sendPresenceUpdate(fromID,new Presence(IPresence.Type.SUBSCRIBED));
                if (rosterView != null)                 rosterView.sendRosterAdd(localUser,fromID.getName(),null);
              }
            }
 else             if (res == ReceiveAuthorizeRequestDialog.AUTHORIZE_ID) {
              if (presenceSender != null) {
                presenceSender.sendPresenceUpdate(fromID,new Presence(IPresence.Type.SUBSCRIBED));
              }
            }
 else             if (res == ReceiveAuthorizeRequestDialog.REFUSE_ID) {
            }
 else {
            }
          }
 catch (          Exception e) {
            ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.PLUGIN_ID,SEND_ERRORCODE,"String_Node_Str",e));
          }
        }
      }
);
    }
    public void handleSubscribed(    ID fromID){
    }
    public void handleUnsubscribed(    ID fromID){
    }
  }
);
}

Fixed version (ground truth):
protected void setup(final IContainer container,final ID localUser,final String nick){
  this.container=container;
  this.soContainer=(ISharedObjectContainer)this.container.getAdapter(ISharedObjectContainer.class);
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      try {
        IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage wp=ww.getActivePage();
        IViewPart view=wp.showView("String_Node_Str");
        rosterView=(RosterView)view;
        String nickname=null;
        if (nick != null) {
          nickname=nick;
        }
 else {
          String name=localUser.getName();
          nickname=name.substring(0,name.indexOf("String_Node_Str"));
        }
        PresenceContainerUI.this.localUser=new org.eclipse.ecf.core.user.User(localUser,nickname);
      }
 catch (      Exception e) {
        ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.PLUGIN_ID,SEND_ERRORCODE,"String_Node_Str",e));
      }
    }
  }
);
  chatManager.addMessageListener(new IIMMessageListener(){
    public void handleMessageEvent(    final IIMMessageEvent chatMessageEvent){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          if (chatMessageEvent instanceof IChatMessageEvent) {
            rosterView.handleMessageEvent(chatMessageEvent);
          }
 else           if (chatMessageEvent instanceof ITypingMessageEvent) {
            rosterView.handleTyping(chatMessageEvent.getFromID());
          }
        }
      }
);
    }
  }
);
  container.addListener(new IContainerListener(){
    public void handleEvent(    IContainerEvent event){
      if (event instanceof IContainerConnectedEvent) {
        IContainerConnectedEvent cce=(IContainerConnectedEvent)event;
        final ID joinedContainer=cce.getTargetID();
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            ILocalInputHandler handler=new ILocalInputHandler(){
              public void inputText(              ID userID,              String text){
                try {
                  chatMessageSender.sendChatMessage(userID,text);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void startTyping(              ID userID){
                try {
                  typingMessageSender.sendTypingMessage(userID,true,"String_Node_Str");
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void disconnect(){
                container.disconnect();
              }
              public void updatePresence(              ID userID,              IPresence presence){
                try {
                  presenceSender.sendPresenceUpdate(userID,presence);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void sendRosterAdd(              String user,              String name,              String[] groups){
                try {
                  rosterSubscriptionSender.sendRosterAdd(user,name,groups);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
              public void sendRosterRemove(              ID userID){
                try {
                  rosterSubscriptionSender.sendRosterRemove(userID);
                }
 catch (                ECFException e) {
                  ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.getDefault().getBundle().getSymbolicName(),SEND_ERRORCODE,"String_Node_Str",e));
                }
              }
            }
;
            PresenceContainerUI.this.groupID=joinedContainer;
            rosterView.addAccount(joinedContainer,PresenceContainerUI.this.localUser,handler,pc,soContainer);
          }
        }
);
      }
 else       if (event instanceof IContainerDisconnectedEvent) {
        final IContainerDisconnectedEvent de=(IContainerDisconnectedEvent)event;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            rosterView.accountDisconnected(de.getTargetID());
          }
        }
);
      }
    }
  }
);
  pc.getRosterManager().addPresenceListener(new IPresenceListener(){
    public void handleRosterEntryAdd(    final IRosterEntry entry){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handleRosterEntryAdd(PresenceContainerUI.this.groupID,entry);
        }
      }
);
    }
    public void handlePresence(    final ID fromID,    final IPresence presence){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handlePresence(PresenceContainerUI.this.groupID,fromID,presence);
        }
      }
);
    }
    public void handleRosterEntryUpdate(    final IRosterEntry entry){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handleRosterEntryUpdate(PresenceContainerUI.this.groupID,entry);
        }
      }
);
    }
    public void handleRosterEntryRemove(    final IRosterEntry entry){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          rosterView.handleRosterEntryRemove(PresenceContainerUI.this.groupID,entry);
        }
      }
);
    }
  }
);
  pc.getRosterManager().addRosterSubscriptionListener(new IRosterSubscriptionListener(){
    public void handleSubscribeRequest(    final ID fromID){
      Display.getDefault().syncExec(new Runnable(){
        public void run(){
          try {
            IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            ReceiveAuthorizeRequestDialog authRequest=new ReceiveAuthorizeRequestDialog(ww.getShell(),fromID.getName(),localUser.getName());
            authRequest.setBlockOnOpen(true);
            authRequest.open();
            int res=authRequest.getButtonPressed();
            if (res == ReceiveAuthorizeRequestDialog.AUTHORIZE_AND_ADD) {
              if (presenceSender != null) {
                presenceSender.sendPresenceUpdate(fromID,new Presence(IPresence.Type.SUBSCRIBED));
                if (rosterView != null)                 rosterView.sendRosterAdd(localUser,fromID.getName(),null);
              }
            }
 else             if (res == ReceiveAuthorizeRequestDialog.AUTHORIZE_ID) {
              if (presenceSender != null) {
                presenceSender.sendPresenceUpdate(fromID,new Presence(IPresence.Type.SUBSCRIBED));
              }
            }
 else             if (res == ReceiveAuthorizeRequestDialog.REFUSE_ID) {
            }
 else {
            }
          }
 catch (          Exception e) {
            ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,ClientPlugin.PLUGIN_ID,SEND_ERRORCODE,"String_Node_Str",e));
          }
        }
      }
);
    }
    public void handleSubscribed(    ID fromID){
    }
    public void handleUnsubscribed(    ID fromID){
    }
  }
);
}