Program: 35659
Project: 35659
Buggy source:
public void showNewFlexibleElementForm(final FlexibleElementDTO model,final boolean isUpdate){
  int width=700;
  int height=350;
  String title=I18N.CONSTANTS.adminFlexible();
  final Window window=new Window();
  window.setHeading(title);
  window.setSize(width,height);
  window.setPlain(true);
  window.setModal(true);
  window.setBlinkModal(true);
  window.setLayout(new FitLayout());
  final ElementForm form=new ElementForm(dispatcher,new AsyncCallback<UpdateModelResult>(){
    @Override public void onFailure(    Throwable caught){
      window.hide();
    }
    @Override public void onSuccess(    UpdateModelResult result){
      if (!isUpdate) {
        window.hide();
        AdminFlexibleElementsView.this.getFieldsStore().add((FlexibleElementDTO)result.getAnnexEntity());
        AdminFlexibleElementsView.this.getFieldsStore().commitChanges();
      }
 else {
        window.hide();
        if (projectModel != null) {
          ProjectModelDTO modelUpdated=(ProjectModelDTO)result.getEntity();
          AdminFlexibleElementsView.this.refreshProjectModel(modelUpdated);
        }
 else {
          OrgUnitModelDTO modelUpdated=(OrgUnitModelDTO)result.getEntity();
          AdminFlexibleElementsView.this.refreshOrgUnitModel(modelUpdated);
        }
        AdminFlexibleElementsView.this.getFieldsStore().remove(model);
        AdminFlexibleElementsView.this.getFieldsStore().add((FlexibleElementDTO)result.getAnnexEntity());
        AdminFlexibleElementsView.this.getFieldsStore().commitChanges();
      }
    }
  }
,model,projectModel,orgUnitModel,addedGroups);
  window.add(form);
  window.show();
}

Fixed version (ground truth):
public void showNewFlexibleElementForm(final FlexibleElementDTO model,final boolean isUpdate){
  int width=700;
  int height=350;
  String title=I18N.CONSTANTS.adminFlexible();
  final Window window=new Window();
  window.setHeading(title);
  window.setSize(width,height);
  window.setPlain(true);
  window.setModal(true);
  window.setBlinkModal(true);
  window.setLayout(new FitLayout());
  final ElementForm form=new ElementForm(dispatcher,new AsyncCallback<UpdateModelResult>(){
    @Override public void onFailure(    Throwable caught){
      window.hide();
    }
    @Override public void onSuccess(    UpdateModelResult result){
      if (!isUpdate) {
        window.hide();
        AdminFlexibleElementsView.this.getFieldsStore().add((FlexibleElementDTO)result.getAnnexEntity());
        AdminFlexibleElementsView.this.getFieldsStore().commitChanges();
      }
 else {
        window.hide();
        if (projectModel != null) {
          ProjectModelDTO modelUpdated=(ProjectModelDTO)result.getEntity();
          AdminFlexibleElementsView.this.refreshProjectModel(modelUpdated);
        }
 else {
          OrgUnitModelDTO modelUpdated=(OrgUnitModelDTO)result.getEntity();
          AdminFlexibleElementsView.this.refreshOrgUnitModel(modelUpdated);
        }
        AdminFlexibleElementsView.this.getFieldsStore().remove(model);
        AdminFlexibleElementsView.this.getFieldsStore().add((FlexibleElementDTO)result.getAnnexEntity());
        AdminFlexibleElementsView.this.getFieldsStore().commitChanges();
      }
    }
  }
,model,projectModel,orgUnitModel);
  window.add(form);
  window.show();
}