nus-yam/ex-repair huggingface dataset:
Program: 94626
Project: 94626
Buggy source:
protected void runRequest() throws Exception {
  setupProxies();
  setupAuthentication();
  URLConnection urlConnection=directoryOrFile.openConnection();
  IURLConnectionModifier connectionModifier=Activator.getDefault().getURLConnectionModifier();
  if (connectionModifier != null) {
    connectionModifier.setSocketFactoryForConnection(urlConnection);
  }
  InputStream ins=urlConnection.getInputStream();
  ins.close();
  remoteFiles=new IRemoteFile[1];
  remoteFiles[0]=new URLRemoteFile(urlConnection,fileID);
}

Fixed version (ground truth):
protected void runRequest() throws Exception {
  setupProxies();
  setupAuthentication();
  URLConnection urlConnection=directoryOrFile.openConnection();
  if (directoryOrFile.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    urlConnection.setUseCaches(false);
  }
  IURLConnectionModifier connectionModifier=Activator.getDefault().getURLConnectionModifier();
  if (connectionModifier != null) {
    connectionModifier.setSocketFactoryForConnection(urlConnection);
  }
  InputStream ins=urlConnection.getInputStream();
  ins.close();
  remoteFiles=new IRemoteFile[1];
  remoteFiles[0]=new URLRemoteFile(urlConnection,fileID);
}
Program: 94627
Project: 94627
Buggy source:
protected void openStreams() throws IncomingFileTransferException {
  try {
    setupAuthentication();
    connect();
    setRequestHeaderValues();
    setInputStream(urlConnection.getInputStream());
    getResponseHeaderValues();
    fireReceiveStartEvent();
  }
 catch (  final Exception e) {
    throw new IncomingFileTransferException(NLS.bind(Messages.UrlConnectionRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT,getRemoteFileURL().toString()),e,getResponseCode());
  }
}

Fixed version (ground truth):
protected void openStreams() throws IncomingFileTransferException {
  try {
    setupAuthentication();
    connect();
    setRequestHeaderValues();
    setInputStream(urlConnection.getInputStream());
    getResponseHeaderValues();
    fireReceiveStartEvent();
  }
 catch (  final Exception e) {
    IncomingFileTransferException except=new IncomingFileTransferException(NLS.bind(Messages.UrlConnectionRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT,getRemoteFileURL().toString()),e,getResponseCode());
    hardClose();
    throw except;
  }
}
Program: 94628
Project: 94628
Buggy source:
protected void connect() throws IOException {
  setupTimeouts();
  urlConnection=getRemoteFileURL().openConnection();
  IURLConnectionModifier connectionModifier=Activator.getDefault().getURLConnectionModifier();
  if (connectionModifier != null) {
    connectionModifier.setSocketFactoryForConnection(urlConnection);
  }
}

Fixed version (ground truth):
protected void connect() throws IOException {
  setupTimeouts();
  urlConnection=getRemoteFileURL().openConnection();
  if (getRemoteFileURL().getProtocol().equalsIgnoreCase("String_Node_Str")) {
    urlConnection.setUseCaches(false);
  }
  IURLConnectionModifier connectionModifier=Activator.getDefault().getURLConnectionModifier();
  if (connectionModifier != null) {
    connectionModifier.setSocketFactoryForConnection(urlConnection);
  }
}
Program: 94631
Project: 94631
Buggy source:
/** 
 * @throws ExecutionException  
 */
public Object execute(ExecutionEvent arg0) throws ExecutionException {
  IRosterEntry rosterEntry=getRosterEntry();
  if (rosterEntry != null) {
    IRoster roster=rosterEntry.getRoster();
    IRosterManager rosterManager=roster.getPresenceContainerAdapter().getRosterManager();
    final IContainer container=(IContainer)roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
    if (container.getConnectedID() == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NOT_CONNECTED);
    final DocShare sender=Activator.getDefault().getDocShare(container.getID());
    if (sender == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NO_SENDER);
    if (sender.isSharing())     showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_EDITOR_ALREADY_SHARING);
    final ITextEditor textEditor=getTextEditor();
    if (textEditor == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_EXCEPTION_EDITOR_NOT_TEXT);
    final String fileName=getFileName(textEditor);
    if (fileName == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_NO_FILENAME_WITH_CONTENT);
    final IUser user=roster.getUser();
    sender.startShare(rosterManager,user.getID(),user.getName(),rosterEntry.getUser().getID(),fileName,textEditor);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @throws ExecutionException  
 */
public Object execute(ExecutionEvent arg0) throws ExecutionException {
  IRosterEntry rosterEntry=getRosterEntry();
  if (rosterEntry != null) {
    IRoster roster=rosterEntry.getRoster();
    final IContainer container=(IContainer)roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
    if (container.getConnectedID() == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NOT_CONNECTED);
    final DocShare sender=Activator.getDefault().getDocShare(container.getID());
    if (sender == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NO_SENDER);
    if (sender.isSharing())     showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_EDITOR_ALREADY_SHARING);
    final ITextEditor textEditor=getTextEditor();
    if (textEditor == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_EXCEPTION_EDITOR_NOT_TEXT);
    final String fileName=getFileName(textEditor);
    if (fileName == null)     showErrorMessage(Messages.DocShareRosterMenuHandler_NO_FILENAME_WITH_CONTENT);
    final IUser user=roster.getUser();
    sender.startShare(user.getID(),user.getName(),rosterEntry.getUser().getID(),fileName,textEditor);
  }
  return null;
}
Program: 94632
Project: 94632
Buggy source:
/** 
 * This method is called when the plug-in is stopped
 */
public void stop(BundleContext ctxt) throws Exception {
  if (logServiceTracker != null) {
    logServiceTracker.close();
    logServiceTracker=null;
  }
  if (adapterManagerTracker != null) {
    adapterManagerTracker.close();
    adapterManagerTracker=null;
  }
  this.context=null;
  plugin=null;
}

Fixed version (ground truth):
/** 
 * This method is called when the plug-in is stopped
 */
public void stop(BundleContext ctxt) throws Exception {
  if (logServiceTracker != null) {
    logServiceTracker.close();
    logServiceTracker=null;
  }
  if (adapterManagerTracker != null) {
    adapterManagerTracker.close();
    adapterManagerTracker=null;
  }
  if (containerManagerTracker != null) {
    containerManagerTracker.close();
    containerManagerTracker=null;
  }
  this.context=null;
  plugin=null;
}
Program: 94633
Project: 94633
Buggy source:
public Object getAdapter(Class adapter){
  return null;
}

Fixed version (ground truth):
public Object getAdapter(Class adapter){
  if (adapter != null && adapter.isAssignableFrom(IContainer.class)) {
    IContainerManager containerManager=Activator.getDefault().getContainerManager();
    return containerManager.getContainer(getContext().getLocalContainerID());
  }
  return super.getAdapter(adapter);
}
Program: 94634
Project: 94634
Buggy source:
public void disconnect(){
  fireContainerEvent(new ContainerDisconnectingEvent(getID(),targetID));
  rootContainer.doPartChannel(targetID.getName());
  fireContainerEvent(new ContainerDisconnectedEvent(getID(),targetID));
}

Fixed version (ground truth):
public void disconnect(){
  fireContainerEvent(new ContainerDisconnectingEvent(getID(),targetID));
  if (targetID != null)   rootContainer.doPartChannel(targetID.getName());
  fireContainerEvent(new ContainerDisconnectedEvent(getID(),targetID));
}
Program: 94636
Project: 94636
Buggy source:
/** 
 * Begin waiting for incoming messages indefinitely.
 */
public void run(){
  while (!isInterrupted()) {
    try {
      read();
    }
 catch (    IOException e) {
      return;
    }
catch (    RuntimeException e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Begin waiting for incoming messages indefinitely.
 */
public void run(){
  while (!isInterrupted()) {
    try {
      sleep(50);
      read();
    }
 catch (    InterruptedException e) {
      return;
    }
catch (    IOException e) {
      return;
    }
catch (    RuntimeException e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
  }
}
Program: 94637
Project: 94637
Buggy source:
public static VCard _createVCardFromXml(String xmlText){
  VCard vCard=new VCard();
  try {
    DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
    Document document=documentBuilder.parse(new ByteArrayInputStream(xmlText.getBytes()));
    new VCardReader(vCard,document).initializeFields();
  }
 catch (  Exception e) {
    e.printStackTrace(System.err);
  }
  return vCard;
}

Fixed version (ground truth):
public static VCard _createVCardFromXml(String xmlText){
  VCard vCard=new VCard();
  try {
    DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
    byte[] bytes;
    try {
      bytes=xmlText.getBytes("String_Node_Str");
    }
 catch (    UnsupportedEncodingException e) {
      bytes=xmlText.getBytes();
    }
    Document document=documentBuilder.parse(new ByteArrayInputStream(bytes));
    new VCardReader(vCard,document).initializeFields();
  }
 catch (  Exception e) {
    e.printStackTrace(System.err);
  }
  return vCard;
}
Program: 94638
Project: 94638
Buggy source:
public ID createID() throws IDCreateException {
  return IDFactory.getDefault().createID(prefs.parent().name(),prefs.name());
}

Fixed version (ground truth):
public ID createID() throws IDCreateException {
  return IDFactory.getDefault().createID(prefs.parent().name(),EncodingUtils.decodeSlashes(prefs.name()));
}
Program: 94639
Project: 94639
Buggy source:
static void open(Shell shell){
  ElementListSelectionDialog elsd=new ElementListSelectionDialog(shell,new LabelProvider(){
    public String getText(    Object element){
      String summary=((ITask)element).getSummary();
      return summary;
    }
  }
);
  elsd.setElements(CompoundContextActivationContributionItem.tasks.toArray());
  if (Window.OK == elsd.open()) {
    ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
    action.setTask((ITask)elsd.getFirstResult());
    action.run();
  }
}

Fixed version (ground truth):
static void open(Shell shell){
  ElementListSelectionDialog elsd=new ElementListSelectionDialog(shell,new LabelProvider(){
    public String getText(    Object element){
      String summary=((ITask)element).getSummary();
      return summary;
    }
  }
);
  elsd.setElements(CompoundContextActivationContributionItem.tasks.toArray());
  if (Window.OK == elsd.open()) {
    ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
    action.setShell(shell);
    action.setTask((ITask)elsd.getFirstResult());
    action.run();
  }
}
Program: 94640
Project: 94640
Buggy source:
protected IContributionItem[] getContributionItems(){
  int count=0;
  for (Iterator it=tasks.iterator(); it.hasNext() && count != 5; ) {
    ITask task=(ITask)it.next();
    actions[count].setTask(task);
    count++;
  }
  IContributionItem[] array=null;
  if (count == 5 && tasks.size() != 5) {
    array=new IContributionItem[7];
    array[5]=new Separator();
    array[6]=new ActionContributionItem(new Action("String_Node_Str"){
      public void run(){
        ActivateReceivedContextHandler.open(shell);
      }
    }
);
  }
 else {
    array=new IContributionItem[count];
  }
  for (int i=0; i < count; i++) {
    array[i]=new ActionContributionItem(actions[i]);
  }
  return array;
}

Fixed version (ground truth):
protected IContributionItem[] getContributionItems(){
  int count=0;
  for (Iterator it=tasks.iterator(); it.hasNext() && count != 5; ) {
    ITask task=(ITask)it.next();
    actions[count].setShell(shell);
    actions[count].setTask(task);
    count++;
  }
  IContributionItem[] array=null;
  if (count == 5 && tasks.size() != 5) {
    array=new IContributionItem[7];
    array[5]=new Separator();
    array[6]=new ActionContributionItem(new Action("String_Node_Str"){
      public void run(){
        ActivateReceivedContextHandler.open(shell);
      }
    }
);
  }
 else {
    array=new IContributionItem[count];
  }
  for (int i=0; i < count; i++) {
    array[i]=new ActionContributionItem(actions[i]);
  }
  return array;
}
Program: 94641
Project: 94641
Buggy source:
public void fill(Menu menu,int index){
  super.fill(menu,index);
  shell=menu.getShell();
}

Fixed version (ground truth):
public void fill(Menu menu,int index){
  shell=menu.getShell();
  super.fill(menu,index);
}
Program: 94642
Project: 94642
Buggy source:
public void linkActivated(HyperlinkEvent e){
  ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
  action.setTask(task);
  action.run();
  close();
}

Fixed version (ground truth):
public void linkActivated(HyperlinkEvent e){
  ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
  action.setShell(getParentShell());
  action.setTask(task);
  action.run();
  close();
}
Program: 94643
Project: 94643
Buggy source:
protected void createContentArea(Composite parent){
  Composite notificationComposite=new Composite(parent,SWT.NO_FOCUS);
  notificationComposite.setLayout(new GridLayout(2,false));
  notificationComposite.setBackground(parent.getBackground());
  final Label notificationLabelIcon=new Label(notificationComposite,SWT.LEAD);
  notificationLabelIcon.setBackground(parent.getBackground());
  notificationLabelIcon.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW));
  final TaskListHyperlink itemLink=new TaskListHyperlink(notificationComposite,SWT.BEGINNING | SWT.WRAP | SWT.NO_FOCUS);
  itemLink.setText(task.getTaskId());
  itemLink.setImage(labelProvider.getImage(task));
  itemLink.setBackground(parent.getBackground());
  itemLink.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
      action.setTask(task);
      action.run();
      close();
    }
  }
);
  String descriptionText=task.getSummary();
  Label descriptionLabel=new Label(notificationComposite,SWT.NO_FOCUS);
  descriptionLabel.setText(descriptionText);
  descriptionLabel.setBackground(parent.getBackground());
  GridDataFactory.fillDefaults().span(2,SWT.DEFAULT).applyTo(descriptionLabel);
}

Fixed version (ground truth):
protected void createContentArea(Composite parent){
  Composite notificationComposite=new Composite(parent,SWT.NO_FOCUS);
  notificationComposite.setLayout(new GridLayout(2,false));
  notificationComposite.setBackground(parent.getBackground());
  final Label notificationLabelIcon=new Label(notificationComposite,SWT.LEAD);
  notificationLabelIcon.setBackground(parent.getBackground());
  notificationLabelIcon.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW));
  final TaskListHyperlink itemLink=new TaskListHyperlink(notificationComposite,SWT.BEGINNING | SWT.WRAP | SWT.NO_FOCUS);
  itemLink.setText(task.getTaskId());
  itemLink.setImage(labelProvider.getImage(task));
  itemLink.setBackground(parent.getBackground());
  itemLink.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
      action.setShell(getParentShell());
      action.setTask(task);
      action.run();
      close();
    }
  }
);
  String descriptionText=task.getSummary();
  Label descriptionLabel=new Label(notificationComposite,SWT.NO_FOCUS);
  descriptionLabel.setText(descriptionText);
  descriptionLabel.setBackground(parent.getBackground());
  GridDataFactory.fillDefaults().span(2,SWT.DEFAULT).applyTo(descriptionLabel);
}
Program: 94644
Project: 94644
Buggy source:
public Object getAdapter(Class adapter){
  return null;
}

Fixed version (ground truth):
public Object getAdapter(Class adapter){
  if (adapter == null)   return null;
  if (adapter.isInstance(this))   return this;
  final IAdapterManager adapterManager=XmppPlugin.getDefault().getAdapterManager();
  return (adapterManager == null) ? null : adapterManager.loadAdapter(this,adapter.getName());
}
Program: 94645
Project: 94645
Buggy source:
private void fireMessageEvent(IIMMessageEvent event){
  List toNotify=null;
synchronized (messageListeners) {
    toNotify=new ArrayList(messageListeners);
  }
  for (Iterator i=toNotify.iterator(); i.hasNext(); ) {
    IIMMessageListener l=(IIMMessageListener)i.next();
    l.handleMessageEvent(event);
  }
}

Fixed version (ground truth):
private void fireMessageEvent(IIMMessageEvent event){
  List toNotify=null;
synchronized (messageListeners) {
    toNotify=new ArrayList(messageListeners);
  }
  for (final Iterator i=toNotify.iterator(); i.hasNext(); ) {
    final IIMMessageListener l=(IIMMessageListener)i.next();
    l.handleMessageEvent(event);
  }
}
Program: 94646
Project: 94646
Buggy source:
public void sendTypingMessage(ID toID,boolean isTyping,String body) throws ECFException {
  if (toID == null)   throw new ECFException("String_Node_Str");
  try {
    presenceHelper.sendTypingMessage(toID,isTyping,body);
  }
 catch (  Exception e) {
    throw new ECFException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void sendTypingMessage(ID toID,boolean isTyping,String body) throws ECFException {
  if (toID == null)   throw new ECFException("String_Node_Str");
  try {
    presenceHelper.sendTypingMessage(toID,isTyping,body);
  }
 catch (  final Exception e) {
    throw new ECFException("String_Node_Str",e);
  }
}
Program: 94647
Project: 94647
Buggy source:
public Object getAdapter(Class clazz){
  return null;
}

Fixed version (ground truth):
public Object getAdapter(Class adapter){
  if (adapter == null)   return null;
  if (adapter.isInstance(this))   return this;
  final IAdapterManager adapterManager=XmppPlugin.getDefault().getAdapterManager();
  return (adapterManager == null) ? null : adapterManager.loadAdapter(this,adapter.getName());
}
Program: 94648
Project: 94648
Buggy source:
protected void tearDown() throws Exception {
  super.tearDown();
  if (incomingFile != null)   incomingFile.delete();
  incomingFile=null;
  if (incomingDirectory != null)   incomingDirectory.delete();
  incomingDirectory=null;
}

Fixed version (ground truth):
protected void tearDown() throws Exception {
  super.tearDown();
  disconnectClients();
  if (incomingFile != null)   incomingFile.delete();
  incomingFile=null;
  if (incomingDirectory != null)   incomingDirectory.delete();
  incomingDirectory=null;
  outgoing=null;
  targetID=null;
}
Program: 94649
Project: 94649
Buggy source:
public void testTwoClientsToSendAndReceive() throws Exception {
  setClientCount(2);
  clients=createClients();
  adapter0=getOutgoingFileTransfer(0);
  adapter0.addListener(requestListener);
  adapter1=getOutgoingFileTransfer(1);
  for (int i=0; i < 2; i++) {
    connectClient(i);
  }
  final IFileID targetID=createFileID(adapter1,getServerConnectID(0),TESTSRCFILE);
  adapter1.sendOutgoingRequest(targetID,new File(TESTSRCFILE),senderTransferListener,null);
  sleep(10000);
  disconnectClients();
}

Fixed version (ground truth):
public void testTwoClientsToSendAndReceive() throws Exception {
  adapter1.sendOutgoingRequest(targetID,new File(TESTSRCFILE),senderTransferListener,null);
  sleep(5000);
}
Program: 94651
Project: 94651
Buggy source:
protected IContributionItem[] getContributionItems(){
  int count=0;
  for (Iterator it=tasks.iterator(); it.hasNext() && count != 5; ) {
    AbstractTask task=(AbstractTask)it.next();
    actions[count].setTask(task);
    count++;
  }
  IContributionItem[] array=null;
  if (count == 5 && tasks.size() != 5) {
    array=new IContributionItem[7];
    array[5]=new Separator();
    array[6]=new ActionContributionItem(new Action("String_Node_Str"){
      public void run(){
        ActivateReceivedContextHandler.open(shell);
      }
    }
);
  }
 else {
    array=new IContributionItem[count];
  }
  for (int i=0; i < count; i++) {
    array[i]=new ActionContributionItem(actions[i]);
  }
  return array;
}

Fixed version (ground truth):
protected IContributionItem[] getContributionItems(){
  int count=0;
  for (Iterator it=tasks.iterator(); it.hasNext() && count != 5; ) {
    ITask task=(ITask)it.next();
    actions[count].setTask(task);
    count++;
  }
  IContributionItem[] array=null;
  if (count == 5 && tasks.size() != 5) {
    array=new IContributionItem[7];
    array[5]=new Separator();
    array[6]=new ActionContributionItem(new Action("String_Node_Str"){
      public void run(){
        ActivateReceivedContextHandler.open(shell);
      }
    }
);
  }
 else {
    array=new IContributionItem[count];
  }
  for (int i=0; i < count; i++) {
    array[i]=new ActionContributionItem(actions[i]);
  }
  return array;
}
Program: 94652
Project: 94652
Buggy source:
public IStatus runInUIThread(IProgressMonitor monitor){
  TasksUiPlugin.getTaskListManager().activateTask((AbstractTask)task);
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus runInUIThread(IProgressMonitor monitor){
  TasksUi.getTaskActivityManager().activateTask(task);
  return Status.OK_STATUS;
}
Program: 94653
Project: 94653
Buggy source:
protected IStatus run(IProgressMonitor monitor){
  ContextCorePlugin.getContextManager().importContext(context);
  taskList.insertTask(task,null,null);
  scheduleTaskActivationJob();
  return Status.OK_STATUS;
}

Fixed version (ground truth):
protected IStatus run(IProgressMonitor monitor){
  ((LocalContextStore)ContextCore.getContextStore()).importContext(context);
  taskList.addTask(task);
  scheduleTaskActivationJob();
  return Status.OK_STATUS;
}
Program: 94654
Project: 94654
Buggy source:
private void scheduleTaskActivationJob(){
  UIJob job=new UIJob(shell.getDisplay(),"String_Node_Str"){
    public IStatus runInUIThread(    IProgressMonitor monitor){
      TasksUiPlugin.getTaskListManager().activateTask((AbstractTask)task);
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
}

Fixed version (ground truth):
private void scheduleTaskActivationJob(){
  UIJob job=new UIJob(shell.getDisplay(),"String_Node_Str"){
    public IStatus runInUIThread(    IProgressMonitor monitor){
      TasksUi.getTaskActivityManager().activateTask(task);
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
}
Program: 94655
Project: 94655
Buggy source:
protected void createContentArea(Composite parent){
  Composite notificationComposite=new Composite(parent,SWT.NO_FOCUS);
  notificationComposite.setLayout(new GridLayout(2,false));
  notificationComposite.setBackground(parent.getBackground());
  final Label notificationLabelIcon=new Label(notificationComposite,SWT.LEAD);
  notificationLabelIcon.setBackground(parent.getBackground());
  notificationLabelIcon.setImage(TasksUiImages.getImage(TasksUiImages.OVERLAY_INCOMMING));
  final TaskListHyperlink itemLink=new TaskListHyperlink(notificationComposite,SWT.BEGINNING | SWT.WRAP | SWT.NO_FOCUS);
  itemLink.setText(task.getTaskId());
  itemLink.setImage(labelProvider.getImage(task));
  itemLink.setBackground(parent.getBackground());
  itemLink.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
      action.setTask(task);
      action.run();
      close();
    }
  }
);
  String descriptionText=task.getSummary();
  Label descriptionLabel=new Label(notificationComposite,SWT.NO_FOCUS);
  descriptionLabel.setText(descriptionText);
  descriptionLabel.setBackground(parent.getBackground());
  GridDataFactory.fillDefaults().span(2,SWT.DEFAULT).applyTo(descriptionLabel);
}

Fixed version (ground truth):
protected void createContentArea(Composite parent){
  Composite notificationComposite=new Composite(parent,SWT.NO_FOCUS);
  notificationComposite.setLayout(new GridLayout(2,false));
  notificationComposite.setBackground(parent.getBackground());
  final Label notificationLabelIcon=new Label(notificationComposite,SWT.LEAD);
  notificationLabelIcon.setBackground(parent.getBackground());
  notificationLabelIcon.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW));
  final TaskListHyperlink itemLink=new TaskListHyperlink(notificationComposite,SWT.BEGINNING | SWT.WRAP | SWT.NO_FOCUS);
  itemLink.setText(task.getTaskId());
  itemLink.setImage(labelProvider.getImage(task));
  itemLink.setBackground(parent.getBackground());
  itemLink.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      ActivateTaskAction action=new CompoundContextActivationContributionItem.ActivateTaskAction();
      action.setTask(task);
      action.run();
      close();
    }
  }
);
  String descriptionText=task.getSummary();
  Label descriptionLabel=new Label(notificationComposite,SWT.NO_FOCUS);
  descriptionLabel.setText(descriptionText);
  descriptionLabel.setBackground(parent.getBackground());
  GridDataFactory.fillDefaults().span(2,SWT.DEFAULT).applyTo(descriptionLabel);
}
Program: 94657
Project: 94657
Buggy source:
public void handleSubjectChange(ID from,final String newSubject){
  chatRoomTab.getInputText().getDisplay().asyncExec(new Runnable(){
    public void run(){
      chatRoomTab.setSubject(newSubject);
    }
  }
);
}

Fixed version (ground truth):
public void handleSubjectChange(ID from,final String newSubject){
  if (!chatRoomTab.getInputText().isDisposed()) {
    chatRoomTab.getInputText().getDisplay().asyncExec(new Runnable(){
      public void run(){
        chatRoomTab.setSubject(newSubject);
      }
    }
);
  }
}
Program: 94659
Project: 94659
Buggy source:
/** 
 * Deactivate the factory.
 * @see ch.ethz.iks.r_osgi.channels.NetworkChannelFactory#deactivate(ch.ethz.iks.r_osgi.Remoting)
 */
public void deactivate(final Remoting remoting) throws IOException {
  thread.interrupt();
  this.remoting=null;
}

Fixed version (ground truth):
/** 
 * Deactivate the factory.
 * @see ch.ethz.iks.r_osgi.channels.NetworkChannelFactory#deactivate(ch.ethz.iks.r_osgi.Remoting)
 */
public void deactivate(final Remoting remoting) throws IOException {
  if (thread != null)   thread.interrupt();
  this.remoting=null;
}
Program: 94661
Project: 94661
Buggy source:
/** 
 * Connects to the server specified during this DispatchSession's construction and attempts to retrieve a viable notification server address.
 * @param username the name to use for authentication
 * @return a ResponseCommand which holds the information received from thedispatch server
 * @throws ConnectException If the MSN servers did not respond as expected.
 * @throws IOException If an I/O error occurs during the read or write operations
 */
ResponseCommand connect(String username) throws ConnectException, IOException {
  write("String_Node_Str","String_Node_Str");
  String input=super.read();
  if (!input.startsWith("String_Node_Str")) {
    throw new ConnectException("String_Node_Str");
  }
  write("String_Node_Str","String_Node_Str" + username);
  input=super.read();
  if (!input.startsWith("String_Node_Str")) {
    throw new ConnectException("String_Node_Str");
  }
  write("String_Node_Str","String_Node_Str" + username);
  return new ResponseCommand(super.read());
}

Fixed version (ground truth):
/** 
 * Connects to the server specified during this DispatchSession's construction and attempts to retrieve a viable notification server address.
 * @param username the name to use for authentication
 * @return a ResponseCommand which holds the information received from thedispatch server
 * @throws ConnectException If the MSN servers did not respond as expected.
 * @throws IOException If an I/O error occurs during the read or write operations
 */
ResponseCommand connect(String username) throws ConnectException, IOException {
  write("String_Node_Str","String_Node_Str");
  String input=super.read().trim();
  if (!input.startsWith("String_Node_Str")) {
    throw new ConnectException("String_Node_Str");
  }
  write("String_Node_Str","String_Node_Str" + username);
  input=super.read().trim();
  if (!input.startsWith("String_Node_Str")) {
    throw new ConnectException("String_Node_Str");
  }
  write("String_Node_Str","String_Node_Str" + username);
  return new ResponseCommand(super.read().trim());
}
Program: 94662
Project: 94662
Buggy source:
/** 
 * Reads data from the channel and returns it as a String.
 * @return the contents that have been read, or <code>null</code> ifnothing is currently available
 * @throws IOException If an I/O error occurred while reading from the channel.
 */
String read() throws IOException {
  int read=is.read(buffer);
  if (read < 1) {
    return null;
  }
  return new String(buffer,0,read,"String_Node_Str").trim();
}

Fixed version (ground truth):
/** 
 * Reads data from the channel and returns it as a String.
 * @return the contents that have been read, or <code>null</code> ifnothing is currently available
 * @throws IOException If an I/O error occurred while reading from the channel.
 */
String read() throws IOException {
  int read=is.read(buffer);
  if (read < 1) {
    return null;
  }
  return new String(buffer,0,read,"String_Node_Str");
}
Program: 94663
Project: 94663
Buggy source:
/** 
 * Begin waiting for incoming messages indefinitely.
 */
public void run(){
  while (!isInterrupted()) {
    try {
      read();
    }
 catch (    IOException e) {
      return;
    }
  }
}

Fixed version (ground truth):
/** 
 * Begin waiting for incoming messages indefinitely.
 */
public void run(){
  while (!isInterrupted()) {
    try {
      read();
    }
 catch (    IOException e) {
      return;
    }
catch (    RuntimeException e) {
      System.out.println("String_Node_Str");
      e.printStackTrace();
    }
  }
}
Program: 94664
Project: 94664
Buggy source:
private StyledText createStyledTextWidget(Composite parent,int styles){
  try {
    SourceViewer result=new SourceViewer(parent,null,null,true,styles);
    result.configure(new ChatRoomViewerConfiguration(EditorsUI.getPreferenceStore(),container,ChatRoomManagerView.this));
    result.setDocument(new Document());
    return result.getTextWidget();
  }
 catch (  Exception e) {
    Activator.getDefault().getLog().log(new Status(IStatus.WARNING,Activator.PLUGIN_ID,IStatus.WARNING,Messages.ChatRoomManagerView_WARNING_HYPERLINKING_NOT_AVAILABLE,e));
    return new StyledText(parent,styles);
  }
catch (  NoClassDefFoundError e) {
    Activator.getDefault().getLog().log(new Status(IStatus.WARNING,Activator.PLUGIN_ID,IStatus.WARNING,Messages.ChatRoomManagerView_WARNING_HYPERLINKING_NOT_AVAILABLE,e));
    return new StyledText(parent,styles);
  }
}

Fixed version (ground truth):
private StyledText createStyledTextWidget(Composite parent,int styles){
  SourceViewer result=null;
  try {
    result=new SourceViewer(parent,null,null,true,styles);
  }
 catch (  NoClassDefFoundError e) {
    Activator.getDefault().getLog().log(new Status(IStatus.WARNING,Activator.PLUGIN_ID,IStatus.WARNING,Messages.ChatRoomManagerView_WARNING_HYPERLINKING_NOT_AVAILABLE,e));
    return new StyledText(parent,styles);
  }
  result.configure(new ChatRoomViewerConfiguration(EditorsUI.getPreferenceStore(),container,ChatRoomManagerView.this));
  result.setDocument(new Document());
  return result.getTextWidget();
}
Program: 94665
Project: 94665
Buggy source:
protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer){
  Map hyperlinkDetectorTargets=super.getHyperlinkDetectorTargets(sourceViewer);
  hyperlinkDetectorTargets.put(container.getClass().getPackage().getName(),view);
  return hyperlinkDetectorTargets;
}

Fixed version (ground truth):
protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer){
  Map hyperlinkDetectorTargets=super.getHyperlinkDetectorTargets(sourceViewer);
  if (container != null)   hyperlinkDetectorTargets.put(container.getClass().getPackage().getName(),view);
  return hyperlinkDetectorTargets;
}
Program: 94666
Project: 94666
Buggy source:
protected void setupTreeViewer(Composite parent){
  treeViewer=new TreeViewer(parent,SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
  getSite().setSelectionProvider(treeViewer);
  presenceListener=new PresenceListener();
  treeViewer.setContentProvider(new MultiRosterContentProvider());
  treeViewer.setLabelProvider(new MultiRosterLabelProvider());
  treeViewer.addFilter(hideOfflineFilter);
  treeViewer.addFilter(hideEmptyGroupsFilter);
  treeViewer.setInput(rosterAccounts);
  treeViewer.addOpenListener(new IOpenListener(){
    public void open(    OpenEvent e){
      message((IStructuredSelection)e.getSelection());
    }
  }
);
  ToolTip toolTip=new ViewerToolTip(treeViewer.getControl());
  toolTip.setHideOnMouseDown(false);
  toolTip.setPopupDelay(200);
  toolTip.setShift(new Point(5,5));
  makeActions();
  hookContextMenu();
  contributeToActionBars();
  retrieveServices();
  hookDropSupport();
  treeViewer.expandToLevel(DEFAULT_EXPAND_LEVEL);
}

Fixed version (ground truth):
protected void setupTreeViewer(Composite parent){
  treeViewer=new TreeViewer(parent,SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
  getSite().setSelectionProvider(treeViewer);
  presenceListener=new PresenceListener();
  treeViewer.setContentProvider(new MultiRosterContentProvider());
  treeViewer.setLabelProvider(new MultiRosterLabelProvider());
  treeViewer.addFilter(hideOfflineFilter);
  treeViewer.addFilter(hideEmptyGroupsFilter);
  treeViewer.setInput(rosterAccounts);
  treeViewer.addOpenListener(new IOpenListener(){
    public void open(    OpenEvent e){
      message((IStructuredSelection)e.getSelection());
    }
  }
);
  ToolTip toolTip=new ViewerToolTip(treeViewer.getControl());
  toolTip.setHideOnMouseDown(false);
  toolTip.setPopupDelay(200);
  toolTip.setShift(new Point(5,5));
  makeActions();
  hookContextMenu();
  contributeToActionBars();
  hookDropSupport();
  retrieveServices();
  treeViewer.expandToLevel(DEFAULT_EXPAND_LEVEL);
}
Program: 94667
Project: 94667
Buggy source:
public void createPartControl(Composite parent){
  pageBook=new PageBook(parent,SWT.NONE);
  createHelpMessage(pageBook);
  setupTreeViewer(pageBook);
  pageBook.showPage(helpMessageLabel);
}

Fixed version (ground truth):
public void createPartControl(Composite parent){
  pageBook=new PageBook(parent,SWT.NONE);
  createHelpMessage(pageBook);
  setupTreeViewer(pageBook);
  if (rosterAccounts.size() == 0)   pageBook.showPage(helpMessageLabel);
}
Program: 94668
Project: 94668
Buggy source:
public void widgetSelected(SelectionEvent e){
  verify();
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  verify(true);
}
Program: 94669
Project: 94669
Buggy source:
public void widgetDefaultSelected(SelectionEvent e){
  verify();
}

Fixed version (ground truth):
public void widgetDefaultSelected(SelectionEvent e){
  verify(true);
}
Program: 94670
Project: 94670
Buggy source:
public void modifyText(ModifyEvent e){
  verify();
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  verify(false);
}
Program: 94671
Project: 94671
Buggy source:
private void verify(){
  String email=emailText.getText().trim();
  if (email.equals("String_Node_Str")) {
    setErrorMessage(Messages.MSNConnectWizardPage_EmailAddressRequired);
  }
 else {
    Matcher matcher=emailPattern.matcher(email);
    if (!matcher.matches()) {
      setErrorMessage(Messages.MSNConnectWizardPage_EmailAddressInvalid);
    }
 else {
      restorePassword(email);
      if (passwordText.getText().equals("String_Node_Str")) {
        setErrorMessage(Messages.MSNConnectWizardPage_PasswordRequired);
      }
 else {
        setErrorMessage(null);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Verifies the user's input to the wizard. Optionally sets the password for the specified email if one has been stored and is recognized.
 * @param restorePassword <tt>true</tt> if the password field should be set if a password can be found
 */
private void verify(boolean restorePassword){
  String email=emailText.getText().trim();
  if (email.equals("String_Node_Str")) {
    setErrorMessage(Messages.MSNConnectWizardPage_EmailAddressRequired);
  }
 else {
    Matcher matcher=emailPattern.matcher(email);
    if (!matcher.matches()) {
      setErrorMessage(Messages.MSNConnectWizardPage_EmailAddressInvalid);
    }
 else {
      if (restorePassword) {
        restorePassword(email);
      }
      if (passwordText.getText().equals("String_Node_Str")) {
        setErrorMessage(Messages.MSNConnectWizardPage_PasswordRequired);
      }
 else {
        setErrorMessage(null);
      }
    }
  }
}
Program: 94672
Project: 94672
Buggy source:
private void addListeners(){
  emailText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      verify();
    }
  }
);
  emailText.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
      verify();
    }
    public void widgetSelected(    SelectionEvent e){
      verify();
    }
  }
);
  passwordText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      verify();
    }
  }
);
}

Fixed version (ground truth):
private void addListeners(){
  emailText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      verify(true);
    }
  }
);
  emailText.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
      verify(true);
    }
    public void widgetSelected(    SelectionEvent e){
      verify(true);
    }
  }
);
  passwordText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      verify(false);
    }
  }
);
}
Program: 94673
Project: 94673
Buggy source:
public void createControl(Composite parent){
  parent=new Composite(parent,SWT.NONE);
  parent.setLayout(new GridLayout(2,false));
  GridData data=new GridData(SWT.FILL,SWT.CENTER,true,false);
  Label label=new Label(parent,SWT.LEFT);
  label.setText(Messages.MSNConnectWizardPage_EmailAddressLabel);
  emailText=new Combo(parent,SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
  emailText.setLayoutData(data);
  label=new Label(parent,SWT.LEFT);
  label.setText(Messages.MSNConnectWizardPage_PasswordLabel);
  passwordText=new Text(parent,SWT.SINGLE | SWT.PASSWORD | SWT.BORDER);
  passwordText.setLayoutData(data);
  restoreCombo();
  addListeners();
  if (username != null) {
    emailText.setText(username);
    restorePassword(username);
    passwordText.setFocus();
  }
  Dialog.applyDialogFont(parent);
  setControl(parent);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  parent=new Composite(parent,SWT.NONE);
  parent.setLayout(new GridLayout(2,false));
  GridData data=new GridData(SWT.FILL,SWT.CENTER,true,false);
  Label label=new Label(parent,SWT.LEFT);
  label.setText(Messages.MSNConnectWizardPage_EmailAddressLabel);
  emailText=new Combo(parent,SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
  emailText.setLayoutData(data);
  label=new Label(parent,SWT.LEFT);
  label.setText(Messages.MSNConnectWizardPage_PasswordLabel);
  passwordText=new Text(parent,SWT.SINGLE | SWT.PASSWORD | SWT.BORDER);
  passwordText.setLayoutData(data);
  addListeners();
  restoreCombo();
  if (username != null) {
    emailText.setText(username);
    restorePassword(username);
    passwordText.setFocus();
  }
  Dialog.applyDialogFont(parent);
  setControl(parent);
}
Program: 94674
Project: 94674
Buggy source:
/** 
 * Add container to the roster view. The container provided should adapter to the IPresenceContainerAdapter. If it does not, then false will be returned.
 * @param container The container provided should adapter to the IPresenceContainerAdapter. If it does not, then false will be returned.
 * @return true if the given container can be added to this roster view.False if not.
 */
public boolean addContainer(IContainer container);

Fixed version (ground truth):
/** 
 * Add container to the roster view. The container provided should adapter to the IPresenceContainerAdapter. If it does not, then false will be returned.  Note that this method should only be called by the user interface thread, and not by some other thread.
 * @param container The container provided should adapter to the IPresenceContainerAdapter. If it does not (because container is already present in this view part), then false will be returned.
 * @return <code>true</code> if the given container can be added to this roster view.<code>false</code> if not.  If the container has already been added to this view part, then will return <code>false</code>.
 */
public boolean addContainer(IContainer container);
Program: 94676
Project: 94676
Buggy source:
protected boolean addRosterAccount(MultiRosterAccount account){
  boolean result=account != null && rosterAccounts.add(account);
  if (result)   setLocalPullDownEnabled(true);
  return result;
}

Fixed version (ground truth):
protected boolean addRosterAccount(MultiRosterAccount account){
  if (account == null)   return false;
  boolean result=rosterAccounts.add(account);
  if (result)   setLocalPullDownEnabled(true);
  return result;
}
Program: 94677
Project: 94677
Buggy source:
protected void processDisconnect(DisconnectEvent e){
  final IAsynchConnection conn=(IAsynchConnection)e.getConnection();
  ID fromID=null;
synchronized (getGroupMembershipLock()) {
    fromID=getIDForConnection(conn);
    if (fromID == null)     return;
    handleLeave(fromID,conn);
  }
  if (fromID != null)   fireContainerEvent(new ContainerDisconnectedEvent(getID(),fromID));
}

Fixed version (ground truth):
protected void processDisconnect(DisconnectEvent e){
  final IAsynchConnection conn=(IAsynchConnection)e.getConnection();
  ID fromID=null;
synchronized (getGroupMembershipLock()) {
    fromID=getIDForConnection(conn);
    if (fromID == null)     return;
    handleLeave(fromID,conn);
  }
  if (fromID != null)   fireContainerEvent(new ContainerEjectedEvent(getID(),fromID,e.getException()));
}
Program: 94678
Project: 94678
Buggy source:
public void handleEvent(IContainerEvent event){
  if (event instanceof IContainerDisconnectedEvent) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        MultiRosterAccount.this.multiRosterView.rosterAccountDisconnected(MultiRosterAccount.this);
      }
    }
);
  }
}

Fixed version (ground truth):
public void handleEvent(IContainerEvent event){
  if (event instanceof IContainerDisconnectedEvent || event instanceof IContainerEjectedEvent) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        MultiRosterAccount.this.multiRosterView.rosterAccountDisconnected(MultiRosterAccount.this);
      }
    }
);
  }
}
Program: 94679
Project: 94679
Buggy source:
public void handleEvent(final IContainerEvent evt){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      if (evt instanceof IContainerDisconnectedEvent) {
        IContainerDisconnectedEvent cd=(IContainerDisconnectedEvent)evt;
        final ID departedContainerID=cd.getTargetID();
        ID connectedID=targetID;
        if (connectedID == null || connectedID.equals(departedContainerID)) {
          chatroomview.disconnected();
          isContainerConnected=false;
        }
      }
 else       if (evt instanceof IContainerConnectedEvent) {
        isContainerConnected=true;
        chatroomview.setEnabled(true);
        String[] roomsForTarget=getRoomsForTarget();
        for (int i=0; i < roomsForTarget.length; i++) {
          IChatRoomInfo info=manager.getChatRoomInfo(roomsForTarget[i]);
          chatroomview.joinRoom(info,getPasswordForChatRoomConnect(info));
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public void handleEvent(final IContainerEvent evt){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      if (evt instanceof IContainerDisconnectedEvent || evt instanceof IContainerEjectedEvent) {
        final ID departedContainerID=((evt instanceof IContainerDisconnectedEvent) ? ((IContainerDisconnectedEvent)evt).getTargetID() : ((IContainerEjectedEvent)evt).getTargetID());
        ID connectedID=targetID;
        if (connectedID == null || connectedID.equals(departedContainerID)) {
          chatroomview.disconnected();
          isContainerConnected=false;
        }
      }
 else       if (evt instanceof IContainerConnectedEvent) {
        isContainerConnected=true;
        chatroomview.setEnabled(true);
        String[] roomsForTarget=getRoomsForTarget();
        for (int i=0; i < roomsForTarget.length; i++) {
          IChatRoomInfo info=manager.getChatRoomInfo(roomsForTarget[i]);
          chatroomview.joinRoom(info,getPasswordForChatRoomConnect(info));
        }
      }
    }
  }
);
}
Program: 94682
Project: 94682
Buggy source:
public void handleEvent(IContainerEvent evt){
  if (evt instanceof IContainerDisconnectedEvent) {
    chatroom.disconnected();
  }
}

Fixed version (ground truth):
public void handleEvent(IContainerEvent evt){
  if (evt instanceof IContainerDisconnectedEvent || evt instanceof IContainerEjectedEvent) {
    chatroom.disconnected();
  }
}
Program: 94683
Project: 94683
Buggy source:
public void handleEvent(IContainerEvent evt){
  if (evt instanceof IContainerDisconnectedEvent) {
    chatroom.disconnected();
  }
}

Fixed version (ground truth):
public void handleEvent(IContainerEvent evt){
  if (evt instanceof IContainerDisconnectedEvent || evt instanceof IContainerEjectedEvent) {
    chatroom.disconnected();
  }
}
Program: 94685
Project: 94685
Buggy source:
protected void closeProjectGroup(User user){
  if (MessageDialog.openConfirm(null,MessageLoader.getString("String_Node_Str"),MessageLoader.getString("String_Node_Str") + this.view.name + "String_Node_Str")) {
    this.view.lch.chatGUIDestroy();
  }
}

Fixed version (ground truth):
protected void closeProjectGroup(User user){
  if (MessageDialog.openConfirm(null,MessageLoader.getString("String_Node_Str"),MessageLoader.getFormattedString("String_Node_Str",this.view.name))) {
    this.view.lch.chatGUIDestroy();
  }
}