nus-yam/ex-repair huggingface dataset:
Program: 87380
Project: 87380
Buggy source:
/** 
 * Double click callback; fires a   {@link AmendmentContainerCreateEvent} on the private document bus.
 * @param sender the overlay widget that was double clicked
 */
@Override public void onDblClick(final OverlayWidget sender){
  documentEventBus.fireEvent(new AmendmentContainerCreateEvent(sender,null,0,AmendmentAction.MODIFICATION,documentController));
}

Fixed version (ground truth):
/** 
 * Double click callback; fires a   {@link AmendmentContainerCreateEvent} on the private document bus.
 * @param sender the overlay widget that was double clicked
 */
@Override public void onDblClick(final OverlayWidget sender,final Event event){
  documentEventBus.fireEvent(new AmendmentContainerCreateEvent(sender,null,0,AmendmentAction.MODIFICATION,documentController));
}
Program: 87381
Project: 87381
Buggy source:
/** 
 * Mouse over callback; if the   {@link OverlayWidget} <tt>sender</tt> is amendable, we will attach the{@link ActionBarController} with the available amendment options, and set the location obtained via{@link org.nsesa.editor.gwt.core.client.ui.document.DocumentController#getLocator()}.
 * @param sender the overlay widget that was hovered
 */
@Override public void onMouseOver(final OverlayWidget sender){
  if (!sender.isIntroducedByAnAmendment()) {
    actionBarController.attach(sender,documentController);
    actionBarController.setLocation(documentController.getLocator().getLocation(sender,documentController.getDocument().getLanguageIso(),false));
  }
}

Fixed version (ground truth):
/** 
 * Mouse over callback; if the   {@link OverlayWidget} <tt>sender</tt> is amendable, we will attach the{@link ActionBarController} with the available amendment options, and set the location obtained via{@link org.nsesa.editor.gwt.core.client.ui.document.DocumentController#getLocator()}.
 * @param sender the overlay widget that was hovered
 */
@Override public void onMouseOver(final OverlayWidget sender,final Event event){
  if (!sender.isIntroducedByAnAmendment()) {
    actionBarController.attach(sender,documentController);
    actionBarController.setLocation(documentController.getLocator().getLocation(sender,documentController.getDocument().getLanguageIso(),false));
  }
}
Program: 87382
Project: 87382
Buggy source:
@Inject public DefaultAmendmentController(final AmendmentView amendmentView,final AmendmentView amendmentExtendedView){
  this.view=amendmentView;
  this.extendedView=amendmentExtendedView;
}

Fixed version (ground truth):
@Inject public DefaultAmendmentController(final AmendmentView amendmentView,final AmendmentView amendmentExtendedView,final AmendmentActionPanelController amendmentActionPanelController){
  this.view=amendmentView;
  this.extendedView=amendmentExtendedView;
  this.amendmentActionPanelController=amendmentActionPanelController;
  registerListeners();
}
Program: 87384
Project: 87384
Buggy source:
/** 
 * Sets the document controller. If the document controller is not <tt>null</tt> (which can happen if an amendment controller is no longer injected in a document controller), then we also register the event listeners.
 * @param documentController the document controller
 */
@Override public void setDocumentController(final DocumentController documentController){
  this.documentController=documentController;
  if (documentController != null) {
    registerListeners();
    this.amendmentActionPanelController=documentController.getInjector().getAmendmentActionPanelController();
    this.documentController.getDocumentEventBus().addHandler(DocumentScrollEvent.TYPE,new DocumentScrollEventHandler(){
      @Override public void onEvent(      DocumentScrollEvent event){
        amendmentActionPanelController.hide();
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Sets the document controller. If the document controller is not <tt>null</tt> (which can happen if an amendment controller is no longer injected in a document controller), then we also register the event listeners.
 * @param documentController the document controller
 */
@Override public void setDocumentController(final DocumentController documentController){
  this.documentController=documentController;
}
Program: 87386
Project: 87386
Buggy source:
@Inject public AmendmentActionPanelController(final AmendmentActionPanelView amendmentActionPanelView){
  this.view=amendmentActionPanelView;
  this.popupPanel.setWidget(amendmentActionPanelView);
  addWidget(anchorTable);
  anchorTable.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  addWidget(anchorWithdraw);
  anchorWithdraw.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  addSeparator();
  addWidget(anchorDelete);
  anchorDelete.getElement().getStyle().setCursor(Style.Cursor.POINTER);
}

Fixed version (ground truth):
@Inject public AmendmentActionPanelController(final AmendmentActionPanelView amendmentActionPanelView,final CoreMessages coreMessages,final DocumentEventBus documentEventBus){
  this.view=amendmentActionPanelView;
  this.popupPanel.setWidget(amendmentActionPanelView);
  this.documentEventBus=documentEventBus;
  addWidget(anchorTable);
  addWidget(anchorWithdraw);
  addSeparator();
  addWidget(anchorDelete);
  anchorTable.setText(coreMessages.amendmentActionTable());
  anchorWithdraw.setText(coreMessages.amendmentActionWithdraw());
  anchorDelete.setText(coreMessages.amendmentActionDelete());
  registerListeners();
}
Program: 87387
Project: 87387
Buggy source:
/** 
 * Sets the parent amendment controller, and registers the event listeners.
 * @param amendmentController the parent amendment controller
 */
public void setAmendmentController(AmendmentController amendmentController){
  this.amendmentController=amendmentController;
  registerListeners();
}

Fixed version (ground truth):
/** 
 * Sets the parent amendment controller, and registers the event listeners.
 * @param amendmentController the parent amendment controller
 */
public void setAmendmentController(AmendmentController amendmentController){
  this.amendmentController=amendmentController;
}
Program: 87388
Project: 87388
Buggy source:
/** 
 * Creates a simple   {@link AmendmentController} associated with a given <tt>amendmentContainerDTO</tt>
 * @param amendmentContainerDTO the amendment container DTO to create a controller for
 * @return the controller
 */
private AmendmentController createAmendmentController(final AmendmentContainerDTO amendmentContainerDTO){
  final AmendmentController amendmentController=documentController.getInjector().getAmendmentController();
  amendmentController.setModel(amendmentContainerDTO);
  return amendmentController;
}

Fixed version (ground truth):
/** 
 * Creates a simple   {@link AmendmentController} associated with a given <tt>amendmentContainerDTO</tt>
 * @param amendmentContainerDTO the amendment container DTO to create a controller for
 * @return the controller
 */
private AmendmentController createAmendmentController(final AmendmentContainerDTO amendmentContainerDTO){
  final AmendmentController amendmentController=documentController.getInjector().getAmendmentController();
  amendmentController.setModel(amendmentContainerDTO);
  amendmentController.setDocumentController(documentController);
  return amendmentController;
}
Program: 87389
Project: 87389
Buggy source:
@Inject public DefaultAmendmentController(final AmendmentView amendmentView,final AmendmentView amendmentExtendedView,final AmendmentActionPanelController amendmentActionPanelController){
  this.view=amendmentView;
  this.extendedView=amendmentExtendedView;
  this.amendmentActionPanelController=amendmentActionPanelController;
  registerListeners();
}

Fixed version (ground truth):
@Inject public DefaultAmendmentController(final AmendmentView amendmentView,final AmendmentView amendmentExtendedView){
  this.view=amendmentView;
  this.extendedView=amendmentExtendedView;
  registerListeners();
}
Program: 87390
Project: 87390
Buggy source:
/** 
 * Sets the document controller. If the document controller is not <tt>null</tt> (which can happen if an amendment controller is no longer injected in a document controller), then we also register the event listeners.
 * @param documentController the document controller
 */
@Override public void setDocumentController(final DocumentController documentController){
  this.documentController=documentController;
}

Fixed version (ground truth):
/** 
 * Sets the document controller. If the document controller is not <tt>null</tt> (which can happen if an amendment controller is no longer injected in a document controller), then we also register the event listeners.
 * @param documentController the document controller
 */
@Override public void setDocumentController(final DocumentController documentController){
  this.documentController=documentController;
  if (documentController != null) {
    amendmentActionPanelController=documentController.getInjector().getAmendmentActionPanelController();
  }
}
Program: 87392
Project: 87392
Buggy source:
@Inject public AmendmentActionPanelController(final AmendmentActionPanelView amendmentActionPanelView,final CoreMessages coreMessages,final DocumentEventBus documentEventBus){
  this.view=amendmentActionPanelView;
  this.popupPanel.setWidget(amendmentActionPanelView);
  this.documentEventBus=documentEventBus;
  addWidget(anchorTable);
  addWidget(anchorWithdraw);
  addSeparator();
  addWidget(anchorDelete);
  anchorTable.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  anchorWithdraw.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  anchorDelete.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  anchorTable.setText(coreMessages.amendmentActionTable());
  anchorWithdraw.setText(coreMessages.amendmentActionWithdraw());
  anchorDelete.setText(coreMessages.amendmentActionDelete());
  registerListeners();
}

Fixed version (ground truth):
@Inject public AmendmentActionPanelController(final AmendmentActionPanelView amendmentActionPanelView,final CoreMessages coreMessages){
  this.view=amendmentActionPanelView;
  this.popupPanel.setWidget(amendmentActionPanelView);
  addWidget(anchorTable);
  addWidget(anchorWithdraw);
  addSeparator();
  addWidget(anchorDelete);
  anchorTable.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  anchorWithdraw.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  anchorDelete.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  anchorTable.setText(coreMessages.amendmentActionTable());
  anchorWithdraw.setText(coreMessages.amendmentActionWithdraw());
  anchorDelete.setText(coreMessages.amendmentActionDelete());
  registerListeners();
}
Program: 87393
Project: 87393
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  AmendmentContainerDTO that=(AmendmentContainerDTO)o;
  if (amendmentAction != that.amendmentAction)   return false;
  if (!amendmentContainerStatus.equals(that.amendmentContainerStatus))   return false;
  if (body != null ? !body.equals(that.body) : that.body != null)   return false;
  if (!id.equals(that.id))   return false;
  if (!languageISO.equals(that.languageISO))   return false;
  if (!revisionID.equals(that.revisionID))   return false;
  if (sourceReference != null ? !sourceReference.equals(that.sourceReference) : that.sourceReference != null)   return false;
  if (targetReferences != null ? !targetReferences.equals(that.targetReferences) : that.targetReferences != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  AmendmentContainerDTO that=(AmendmentContainerDTO)o;
  if (amendmentAction != that.amendmentAction)   return false;
  if (!amendmentContainerStatus.equals(that.amendmentContainerStatus))   return false;
  if (body != null ? !body.equals(that.body) : that.body != null)   return false;
  if (!id.equals(that.id))   return false;
  if (languageISO != null ? !languageISO.equals(that.languageISO) : that.languageISO != null)   return false;
  if (!revisionID.equals(that.revisionID))   return false;
  if (sourceReference != null ? !sourceReference.equals(that.sourceReference) : that.sourceReference != null)   return false;
  if (targetReferences != null ? !targetReferences.equals(that.targetReferences) : that.targetReferences != null)   return false;
  return true;
}
Program: 87394
Project: 87394
Buggy source:
@Before public void setup(){
  AmendmentContainerDTO amendmentContainerDTO=new AmendmentContainerDTO();
  amendmentContainerDTO.setSourceReference(reference);
  amendmentController=new DefaultAmendmentController(new AmendmentViewImpl(null),new AmendmentViewImpl(null),null);
  amendmentController.setModel(amendmentContainerDTO);
  root=new OverlayWidgetImpl();
  root.setType("String_Node_Str");
  child1=new OverlayWidgetImpl();
  child1.setType("String_Node_Str");
  child2=new OverlayWidgetImpl();
  child2.setType("String_Node_Str");
  child3=new OverlayWidgetImpl();
  child3.setType("String_Node_Str");
  root.addOverlayWidget(child1);
  root.addOverlayWidget(child2);
  root.addOverlayWidget(child3);
}

Fixed version (ground truth):
@Before public void setup(){
  AmendmentContainerDTO amendmentContainerDTO=new AmendmentContainerDTO();
  amendmentContainerDTO.setSourceReference(reference);
  amendmentController=new DefaultAmendmentController(new AmendmentViewImpl(null),new AmendmentViewImpl(null));
  amendmentController.setModel(amendmentContainerDTO);
  root=new OverlayWidgetImpl();
  root.setType("String_Node_Str");
  child1=new OverlayWidgetImpl();
  child1.setType("String_Node_Str");
  child2=new OverlayWidgetImpl();
  child2.setType("String_Node_Str");
  child3=new OverlayWidgetImpl();
  child3.setType("String_Node_Str");
  root.addOverlayWidget(child1);
  root.addOverlayWidget(child2);
  root.addOverlayWidget(child3);
}
Program: 87395
Project: 87395
Buggy source:
@Test public void testAddAmendmentController() throws Exception {
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended,null);
  overlayWidget.addAmendmentController(amendmentController);
  Assert.assertTrue(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}

Fixed version (ground truth):
@Test public void testAddAmendmentController() throws Exception {
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended);
  overlayWidget.addAmendmentController(amendmentController);
  Assert.assertTrue(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}
Program: 87396
Project: 87396
Buggy source:
@Test public void testAddAmendmentControllerWithVetoListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public void afterAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
    @Override public boolean beforeAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return true;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended,null);
  overlayWidget.addAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertFalse("String_Node_Str",hits[1]);
  Assert.assertFalse(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}

Fixed version (ground truth):
@Test public void testAddAmendmentControllerWithVetoListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public void afterAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
    @Override public boolean beforeAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return true;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended);
  overlayWidget.addAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertFalse("String_Node_Str",hits[1]);
  Assert.assertFalse(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}
Program: 87397
Project: 87397
Buggy source:
@Test public void testRemoveAmendmentController() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl(){
{
      amendmentControllersHolderElement=new HTMLPanel("String_Node_Str");
    }
  }
;
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended,null);
  overlayWidget.addAmendmentController(amendmentController);
  overlayWidget.removeAmendmentController(amendmentController);
  Assert.assertFalse(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}

Fixed version (ground truth):
@Test public void testRemoveAmendmentController() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl(){
{
      amendmentControllersHolderElement=new HTMLPanel("String_Node_Str");
    }
  }
;
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended);
  overlayWidget.addAmendmentController(amendmentController);
  overlayWidget.removeAmendmentController(amendmentController);
  Assert.assertFalse(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}
Program: 87398
Project: 87398
Buggy source:
@Test public void testIsAmended() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  Assert.assertFalse(overlayWidget.isAmended());
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExt=new AmendmentViewImpl(null);
  AmendmentController amendmentController1=new DefaultAmendmentController(amendmentView,amendmentViewExt,null);
  overlayWidget.addAmendmentController(amendmentController1);
  Assert.assertTrue(overlayWidget.isAmended());
}

Fixed version (ground truth):
@Test public void testIsAmended() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  Assert.assertFalse(overlayWidget.isAmended());
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExt=new AmendmentViewImpl(null);
  AmendmentController amendmentController1=new DefaultAmendmentController(amendmentView,amendmentViewExt);
  overlayWidget.addAmendmentController(amendmentController1);
  Assert.assertTrue(overlayWidget.isAmended());
}
Program: 87399
Project: 87399
Buggy source:
@Test public void testRemoveAmendmentControllerWithVetoListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public boolean beforeAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return true;
    }
    @Override public void afterAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended,null);
  overlayWidget.addAmendmentController(amendmentController);
  overlayWidget.removeAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertFalse("String_Node_Str",hits[1]);
  Assert.assertTrue(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}

Fixed version (ground truth):
@Test public void testRemoveAmendmentControllerWithVetoListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public boolean beforeAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return true;
    }
    @Override public void afterAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended);
  overlayWidget.addAmendmentController(amendmentController);
  overlayWidget.removeAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertFalse("String_Node_Str",hits[1]);
  Assert.assertTrue(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}
Program: 87400
Project: 87400
Buggy source:
@Test public void testAddAmendmentControllerWithListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl(){
{
      amendmentControllersHolderElement=new HTMLPanel("String_Node_Str");
    }
  }
;
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public void afterAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
    @Override public boolean beforeAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return false;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended,null);
  overlayWidget.addAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertTrue("String_Node_Str",hits[1]);
  Assert.assertTrue(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}

Fixed version (ground truth):
@Test public void testAddAmendmentControllerWithListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl(){
{
      amendmentControllersHolderElement=new HTMLPanel("String_Node_Str");
    }
  }
;
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public void afterAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
    @Override public boolean beforeAmendmentControllerAdded(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return false;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended);
  overlayWidget.addAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertTrue("String_Node_Str",hits[1]);
  Assert.assertTrue(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}
Program: 87401
Project: 87401
Buggy source:
@Test public void testRemoveAmendmentControllerWithListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public boolean beforeAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return false;
    }
    @Override public void afterAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended,null);
  overlayWidget.addAmendmentController(amendmentController);
  overlayWidget.removeAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertTrue("String_Node_Str",hits[1]);
  Assert.assertFalse(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}

Fixed version (ground truth):
@Test public void testRemoveAmendmentControllerWithListener() throws Exception {
  final OverlayWidget overlayWidget=new OverlayWidgetImpl();
  final Boolean[] hits=new Boolean[]{false,false};
  overlayWidget.setListener(new OverlayWidgetListenerMock(){
    @Override public boolean beforeAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[0]=true;
      return false;
    }
    @Override public void afterAmendmentControllerRemoved(    OverlayWidget overlayWidget,    AmendmentController amendmentController){
      hits[1]=true;
    }
  }
);
  final ClientFactory clientFactory=new ClientFactoryMock();
  final AmendmentView amendmentView=new AmendmentViewImpl(null);
  final AmendmentView amendmentViewExtended=new AmendmentViewImpl(null);
  final AmendmentController amendmentController=new DefaultAmendmentController(amendmentView,amendmentViewExtended);
  overlayWidget.addAmendmentController(amendmentController);
  overlayWidget.removeAmendmentController(amendmentController);
  Assert.assertTrue("String_Node_Str",hits[0]);
  Assert.assertTrue("String_Node_Str",hits[1]);
  Assert.assertFalse(Arrays.asList(overlayWidget.getAmendmentControllers()).contains(amendmentController));
}
Program: 87402
Project: 87402
Buggy source:
@Override protected void onAttach(){
  super.onAttach();
  init();
}

Fixed version (ground truth):
@Override protected void onAttach(){
  super.onAttach();
  Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand(){
    @Override public void execute(){
      init();
    }
  }
);
}
Program: 87403
Project: 87403
Buggy source:
@Inject public DefaultAmendmentManager(final ClientFactory clientFactory,final ServiceFactory serviceFactory,final Transformer transformer,final DocumentEventBus documentEventBus,final AmendmentInjectionPointFinder injectionPointFinder,final AmendmentInjectionPointProvider injectionPointProvider){
  this.clientFactory=clientFactory;
  this.serviceFactory=serviceFactory;
  this.transformer=transformer;
  this.documentEventBus=documentEventBus;
  this.injectionPointFinder=injectionPointFinder;
  this.injectionPointProvider=injectionPointProvider;
  registerListeners();
}

Fixed version (ground truth):
@Inject public DefaultAmendmentManager(final Transformer transformer,final DocumentEventBus documentEventBus,final AmendmentInjectionPointFinder injectionPointFinder,final AmendmentInjectionPointProvider injectionPointProvider){
  this.transformer=transformer;
  this.documentEventBus=documentEventBus;
  this.injectionPointFinder=injectionPointFinder;
  this.injectionPointProvider=injectionPointProvider;
}
Program: 87405
Project: 87405
Buggy source:
@Override public void setDocumentController(DocumentController documentController){
  this.documentController=documentController;
}

Fixed version (ground truth):
@Override public void setDocumentController(DocumentController documentController){
  this.documentController=documentController;
  registerListeners();
}
Program: 87406
Project: 87406
Buggy source:
@Inject public DefaultDiffingManager(final ServiceFactory serviceFactory,final ClientFactory clientFactory,final DocumentEventBus documentEventBus){
  this.serviceFactory=serviceFactory;
  this.clientFactory=clientFactory;
  this.documentEventBus=documentEventBus;
}

Fixed version (ground truth):
@Inject public DefaultDiffingManager(final DocumentEventBus documentEventBus){
  this.documentEventBus=documentEventBus;
}
Program: 87407
Project: 87407
Buggy source:
@Inject public DefaultAmendmentController(final ClientFactory clientFactory,final AmendmentView amendmentView,final AmendmentView amendmentExtendedView){
  this.clientFactory=clientFactory;
  this.view=amendmentView;
  this.extendedView=amendmentExtendedView;
  registerListeners();
}

Fixed version (ground truth):
@Inject public DefaultAmendmentController(final AmendmentView amendmentView,final AmendmentView amendmentExtendedView){
  this.view=amendmentView;
  this.extendedView=amendmentExtendedView;
}
Program: 87409
Project: 87409
Buggy source:
@Override public void setDocumentController(final DocumentController documentController){
  this.documentController=documentController;
  if (documentController != null) {
    this.amendmentActionPanelController=documentController.getInjector().getAmendmentActionPanelController();
    this.documentController.getDocumentEventBus().addHandler(DocumentScrollEvent.TYPE,new DocumentScrollEventHandler(){
      @Override public void onEvent(      DocumentScrollEvent event){
        amendmentActionPanelController.hide();
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void setDocumentController(final DocumentController documentController){
  this.documentController=documentController;
  if (documentController != null) {
    registerListeners();
    this.amendmentActionPanelController=documentController.getInjector().getAmendmentActionPanelController();
    this.documentController.getDocumentEventBus().addHandler(DocumentScrollEvent.TYPE,new DocumentScrollEventHandler(){
      @Override public void onEvent(      DocumentScrollEvent event){
        amendmentActionPanelController.hide();
      }
    }
);
  }
}
Program: 87411
Project: 87411
Buggy source:
@Inject public AmendmentActionPanelController(final ClientFactory clientFactory,final ServiceFactory serviceFactory,final AmendmentActionPanelView amendmentActionPanelView){
  this.clientFactory=clientFactory;
  this.serviceFactory=serviceFactory;
  this.view=amendmentActionPanelView;
  this.popupPanel.setWidget(amendmentActionPanelView);
  anchorTable.setText(clientFactory.getCoreMessages().amendmentActionTable());
  anchorWithdraw.setText(clientFactory.getCoreMessages().amendmentActionWithdraw());
  anchorDelete.setText(clientFactory.getCoreMessages().amendmentActionDelete());
  addWidget(anchorTable);
  addWidget(anchorWithdraw);
  addSeparator();
  addWidget(anchorDelete);
  registerListeners();
}

Fixed version (ground truth):
@Inject public AmendmentActionPanelController(final AmendmentActionPanelView amendmentActionPanelView){
  this.view=amendmentActionPanelView;
  this.popupPanel.setWidget(amendmentActionPanelView);
  addWidget(anchorTable);
  addWidget(anchorWithdraw);
  addSeparator();
  addWidget(anchorDelete);
}
Program: 87412
Project: 87412
Buggy source:
public void setAmendmentController(AmendmentController amendmentController){
  this.amendmentController=amendmentController;
}

Fixed version (ground truth):
public void setAmendmentController(AmendmentController amendmentController){
  this.amendmentController=amendmentController;
  registerListeners();
}
Program: 87413
Project: 87413
Buggy source:
protected String getFormattedDeadline(){
  final Date now=new Date();
  final Date midnight=new Date(now.getDay(),now.getMonth(),now.getYear(),0,0,0);
  final Date oneDayBefore=new Date(midnight.getTime() - (24 * 60 * 60* 1000));
  final Date oneHourBefore=new Date(deadline.getTime() - (60 * 60 * 1000));
  if (now.after(deadline)) {
    return coreMessages.documentDeadlinePassedMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlinePassedFormat()).format(deadline));
  }
  if (deadline.after(oneHourBefore)) {
    return coreMessages.documentDeadlineH1Message(DateTimeFormat.getFormat(coreMessages.documentDeadlineH1Format()).format(deadline));
  }
  if (deadline.after(midnight)) {
    return coreMessages.documentDeadlineTodayMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlineTodayFormat()).format(deadline));
  }
  if (deadline.after(oneDayBefore)) {
    return coreMessages.documentDeadlineTomorrowMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlineTomorrowFormat()).format(deadline));
  }
  return coreMessages.documentDeadlineDefaultMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlineDefaultFormat()).format(deadline));
}

Fixed version (ground truth):
protected String getFormattedDeadline(){
  final Date now=new Date();
  final Date midnight=new Date(now.getDay(),now.getMonth(),now.getYear(),0,0,0);
  final Date oneDayBefore=new Date(midnight.getTime() - (24 * 60 * 60* 1000));
  final Date oneHourBefore=new Date(deadline.getTime() - (60 * 60 * 1000));
  final CoreMessages coreMessages=documentController.getClientFactory().getCoreMessages();
  if (now.after(deadline)) {
    return coreMessages.documentDeadlinePassedMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlinePassedFormat()).format(deadline));
  }
  if (deadline.after(oneHourBefore)) {
    return coreMessages.documentDeadlineH1Message(DateTimeFormat.getFormat(coreMessages.documentDeadlineH1Format()).format(deadline));
  }
  if (deadline.after(midnight)) {
    return coreMessages.documentDeadlineTodayMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlineTodayFormat()).format(deadline));
  }
  if (deadline.after(oneDayBefore)) {
    return coreMessages.documentDeadlineTomorrowMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlineTomorrowFormat()).format(deadline));
  }
  return coreMessages.documentDeadlineDefaultMessage(DateTimeFormat.getFormat(coreMessages.documentDeadlineDefaultFormat()).format(deadline));
}
Program: 87414
Project: 87414
Buggy source:
@Inject public DeadlineController(final DocumentEventBus documentEventBus,final DeadlineTracker deadlineTracker,final DeadlineView view,final CoreMessages coreMessages){
  this.documentEventBus=documentEventBus;
  this.deadlineTracker=deadlineTracker;
  this.deadlineTracker.setDeadlineController(this);
  this.view=view;
  this.coreMessages=coreMessages;
  registerListeners();
}

Fixed version (ground truth):
@Inject public DeadlineController(final DocumentEventBus documentEventBus,final DeadlineTracker deadlineTracker,final DeadlineView view){
  this.documentEventBus=documentEventBus;
  this.deadlineTracker=deadlineTracker;
  this.deadlineTracker.setDeadlineController(this);
  this.view=view;
  registerListeners();
}
Program: 87415
Project: 87415
Buggy source:
@Override public String getInnerHTML(){
  final NodeList<Node> childNodes=getElement().getChildNodes();
  final StringBuilder sb=new StringBuilder();
  for (int i=0; i < childNodes.getLength(); i++) {
    final Node node=childNodes.getItem(i);
    if (Node.ELEMENT_NODE == node.getNodeType()) {
      Element element=node.cast();
      if (element != getAmendmentHolderElement().getElement()) {
        sb.append(DOM.toString((com.google.gwt.user.client.Element)element));
      }
    }
 else     if (Node.TEXT_NODE == node.getNodeType()) {
      sb.append(node.getNodeValue());
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String getInnerHTML(){
  final Node clonedNode=getElement().cloneNode(true);
  NodeUtil.walk(clonedNode,new NodeUtil.NodeVisitor(){
    @Override public void visit(    final Node node){
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        Element el=node.cast();
        if (el.getTagName().equals(getAmendmentHolderElement().getElement().getTagName()) && el.getClassName().equals(getAmendmentHolderElement().getElement().getClassName())) {
          el.removeFromParent();
        }
      }
    }
  }
);
  return ((Element)clonedNode.cast()).getInnerHTML();
}
Program: 87417
Project: 87417
Buggy source:
@Override public void onEvent(final AmendmentContainerDeleteEvent event){
  final ArrayList<AmendmentContainerDTO> amendmentContainerDTOs=new ArrayList<AmendmentContainerDTO>(Collections2.transform(Arrays.asList(event.getAmendmentControllers()),new Function<AmendmentController,AmendmentContainerDTO>(){
    @Override public AmendmentContainerDTO apply(    AmendmentController input){
      return input.getModel();
    }
  }
));
  serviceFactory.getGwtAmendmentService().deleteAmendmentContainers(clientFactory.getClientContext(),amendmentContainerDTOs,new AsyncCallback<AmendmentContainerDTO[]>(){
    @Override public void onFailure(    Throwable caught){
      clientFactory.getEventBus().fireEvent(new CriticalErrorEvent("String_Node_Str",caught));
    }
    @Override public void onSuccess(    AmendmentContainerDTO[] result){
      amendmentControllers.remove(event.getAmendmentControllers());
      for (int i=0; i < result.length; i++) {
        AmendmentController amendmentController=event.getAmendmentControllers()[i];
        documentEventBus.fireEvent(new AmendmentContainerDeletedEvent(amendmentController));
      }
      documentEventBus.fireEvent(new NotificationEvent(clientFactory.getCoreMessages().amendmentActionDeleteSuccessful(result.length)));
    }
  }
);
}

Fixed version (ground truth):
@Override public void onEvent(final AmendmentContainerDeleteEvent event){
  final ArrayList<AmendmentContainerDTO> amendmentContainerDTOs=new ArrayList<AmendmentContainerDTO>(Collections2.transform(Arrays.asList(event.getAmendmentControllers()),new Function<AmendmentController,AmendmentContainerDTO>(){
    @Override public AmendmentContainerDTO apply(    AmendmentController input){
      return input.getModel();
    }
  }
));
  serviceFactory.getGwtAmendmentService().deleteAmendmentContainers(clientFactory.getClientContext(),amendmentContainerDTOs,new AsyncCallback<AmendmentContainerDTO[]>(){
    @Override public void onFailure(    Throwable caught){
      clientFactory.getEventBus().fireEvent(new CriticalErrorEvent("String_Node_Str",caught));
    }
    @Override public void onSuccess(    AmendmentContainerDTO[] result){
      amendmentControllers.removeAll(Arrays.asList(event.getAmendmentControllers()));
      for (int i=0; i < result.length; i++) {
        AmendmentController amendmentController=event.getAmendmentControllers()[i];
        documentEventBus.fireEvent(new AmendmentContainerDeletedEvent(amendmentController));
      }
      documentEventBus.fireEvent(new NotificationEvent(clientFactory.getCoreMessages().amendmentActionDeleteSuccessful(result.length)));
    }
  }
);
}
Program: 87418
Project: 87418
Buggy source:
@Override public void onSuccess(AmendmentContainerDTO[] result){
  amendmentControllers.remove(event.getAmendmentControllers());
  for (int i=0; i < result.length; i++) {
    AmendmentController amendmentController=event.getAmendmentControllers()[i];
    documentEventBus.fireEvent(new AmendmentContainerDeletedEvent(amendmentController));
  }
  documentEventBus.fireEvent(new NotificationEvent(clientFactory.getCoreMessages().amendmentActionDeleteSuccessful(result.length)));
}

Fixed version (ground truth):
@Override public void onSuccess(AmendmentContainerDTO[] result){
  amendmentControllers.removeAll(Arrays.asList(event.getAmendmentControllers()));
  for (int i=0; i < result.length; i++) {
    AmendmentController amendmentController=event.getAmendmentControllers()[i];
    documentEventBus.fireEvent(new AmendmentContainerDeletedEvent(amendmentController));
  }
  documentEventBus.fireEvent(new NotificationEvent(clientFactory.getCoreMessages().amendmentActionDeleteSuccessful(result.length)));
}
Program: 87419
Project: 87419
Buggy source:
public void hide(){
  richTextEditor.destroy();
  richTextEditor.asWidget().setVisible(false);
  amendableWidget.asWidget().setVisible(true);
}

Fixed version (ground truth):
public void hide(){
  richTextEditor.destroy();
  richTextEditor.asWidget().setVisible(false);
  if (amendableWidget != null)   amendableWidget.asWidget().setVisible(true);
}
Program: 87420
Project: 87420
Buggy source:
@Override public int getTypeIndex(final boolean includeAmendments){
  if (getParentAmendableWidget() != null) {
    final Iterator<AmendableWidget> iterator=getParentAmendableWidget().getChildAmendableWidgets().iterator();
    int count=0;
    while (iterator.hasNext()) {
      final AmendableWidget aw=iterator.next();
      if (aw != null) {
        if (aw == this) {
          break;
        }
        if (aw.getType().equalsIgnoreCase(getType())) {
          if (includeAmendments) {
            count++;
          }
 else {
            if (!aw.isIntroducedByAnAmendment()) {
              count++;
            }
          }
        }
      }
    }
    return count;
  }
  return -1;
}

Fixed version (ground truth):
@Override public int getTypeIndex(final boolean includeAmendments){
  if (getParentAmendableWidget() != null) {
    final Iterator<AmendableWidget> iterator=getParentAmendableWidget().getChildAmendableWidgets().iterator();
    int count=0;
    while (iterator.hasNext()) {
      final AmendableWidget aw=iterator.next();
      if (aw != null) {
        if (aw == this) {
          break;
        }
        if (aw.getType().equalsIgnoreCase(getType())) {
          if (includeAmendments) {
            count++;
          }
 else {
            if (!aw.isIntroducedByAnAmendment()) {
              count++;
            }
          }
        }
      }
    }
    return count;
  }
  return 0;
}
Program: 87421
Project: 87421
Buggy source:
@Override public void onDetach(){
  if (childAmendableWidgets != null) {
    for (    final AmendableWidget child : childAmendableWidgets) {
      if (child.isAttached()) {
        child.onDetach();
      }
    }
  }
  if (isAttached()) {
    super.onDetach();
    this.listener=null;
    this.overlayStrategy=null;
    this.origin=null;
    this.amendable=null;
    this.setElement(null);
    this.amendmentControllers=null;
    this.assignedNumber=null;
    this.amendmentHolderElement=null;
    this.childAmendableWidgets=null;
    this.format=null;
    this.id=null;
    this.immutable=null;
    this.type=null;
    this.UIListener=null;
  }
}

Fixed version (ground truth):
@Override public void onDetach(){
  if (childAmendableWidgets != null) {
    for (    final AmendableWidget child : childAmendableWidgets) {
      if (child.isAttached()) {
        child.onDetach();
      }
    }
  }
  if (isAttached()) {
    super.onDetach();
    this.listener=null;
    this.overlayStrategy=null;
    this.origin=null;
    this.amendable=null;
    this.amendmentControllers=null;
    this.assignedNumber=null;
    this.amendmentHolderElement=null;
    this.childAmendableWidgets=null;
    this.format=null;
    this.id=null;
    this.immutable=null;
    this.type=null;
    this.UIListener=null;
  }
}
Program: 87422
Project: 87422
Buggy source:
@Override public void init(){
  if (!attached) {
    final JsArrayString jsStrings=(JsArrayString)JsArrayString.createArray();
    for (    final String s : cssPath) {
      jsStrings.push(s);
    }
    JavaScriptObject configuration=getConfiguration(jsStrings,readOnly,textArea.getOffsetHeight());
    editorInstance=getEditor(configuration,this.id,temporaryContent);
    if (editorInstance == null) {
      throw new NullPointerException("String_Node_Str");
    }
    attached=true;
  }
}

Fixed version (ground truth):
@Override public void init(){
  if (!attached) {
    final JsArrayString jsStrings=(JsArrayString)JsArrayString.createArray();
    for (    final String s : cssPath) {
      jsStrings.push(s);
    }
    JavaScriptObject configuration=getConfiguration(jsStrings,readOnly,textArea.getOffsetHeight() + (readOnly ? -5 : -45));
    editorInstance=getEditor(configuration,this.id,temporaryContent);
    if (editorInstance == null) {
      throw new NullPointerException("String_Node_Str");
    }
    attached=true;
  }
}
Program: 87423
Project: 87423
Buggy source:
protected void injectInternal(final AmendmentController amendmentController,final AmendableWidget root,final DocumentController documentController){
  final List<AmendableWidget> injectionPoints=injectionPointFinder.findInjectionPoints(amendmentController,root,documentController);
  if (injectionPoints != null) {
    for (    final AmendableWidget injectionPoint : injectionPoints) {
      final AmendableWidget target=injectionPointProvider.provideInjectionPoint(amendmentController,injectionPoint,documentController);
      if (target != null) {
        target.addAmendmentController(amendmentController);
        amendmentController.setDocumentController(documentController);
        documentEventBus.fireEvent(new AmendmentContainerInjectedEvent(amendmentController));
      }
    }
  }
}

Fixed version (ground truth):
protected void injectInternal(final AmendmentController amendmentController,final AmendableWidget root,final DocumentController documentController){
  final List<AmendableWidget> injectionPoints=injectionPointFinder.findInjectionPoints(amendmentController,root,documentController);
  if (injectionPoints != null) {
    if (injectionPoints.size() > 1) {
    }
    for (    final AmendableWidget injectionPoint : injectionPoints) {
      final AmendableWidget target=injectionPointProvider.provideInjectionPoint(amendmentController,injectionPoint,documentController);
      if (target != null) {
        target.addAmendmentController(amendmentController);
        amendmentController.setDocumentController(documentController);
        documentEventBus.fireEvent(new AmendmentContainerInjectedEvent(amendmentController));
      }
    }
  }
}