Program: 35346
Project: 35346
Buggy source:
/** 
 * Method executed on save button action.
 */
private void onSaveAction(){
  if (!iterationChanges.isEmpty()) {
    final List<IterationChange> iterationChangesList=new ArrayList<IterationChange>(iterationChanges.values());
    Iterator<IterationChange> iterator=iterationChangesList.iterator();
    while (iterator.hasNext()) {
      IterationChange iterationChange=iterator.next();
      if (iterationChange.isCreated() && Profiler.INSTANCE.isOfflineMode()) {
        iterator.remove();
      }
    }
    UpdateLayoutGroupIterations updateLayoutGroupIterations=new UpdateLayoutGroupIterations(iterationChangesList,getOrgUnit().getId());
    dispatch.execute(updateLayoutGroupIterations,new CommandResultHandler<ListResult<IterationChange>>(){
      @Override public void onCommandFailure(      final Throwable caught){
        N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
      }
      @Override protected void onCommandSuccess(      ListResult<IterationChange> result){
        if (result != null) {
          for (          IterationChange iterationChange : result.getList()) {
            if (iterationChange.isDeleted()) {
              Iterator<ValueEvent> valuesIterator=valueChanges.iterator();
              while (valuesIterator.hasNext()) {
                ValueEvent valueEvent=valuesIterator.next();
                if (valueEvent.getIterationId() == iterationChange.getIterationId()) {
                  valuesIterator.remove();
                }
              }
            }
 else             if (iterationChange.isCreated()) {
              int oldId=iterationChange.getIterationId();
              int newId=iterationChange.getNewIterationId();
              newIterationsTabItems.get(oldId).setIterationId(newId);
              for (              ValueEvent valueEvent : valueChanges) {
                if (valueEvent.getIterationId() == oldId) {
                  valueEvent.setIterationId(newId);
                }
              }
            }
          }
          iterationChanges.clear();
          newIterationsTabItems.clear();
          UpdateProject command=new UpdateProject(getOrgUnit().getId(),valueChanges);
          command.setOrgUnit(true);
          dispatch.execute(command,new CommandResultHandler<VoidResult>(){
            @Override public void onCommandFailure(            final Throwable caught){
              N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
            }
            @Override public void onCommandSuccess(            final VoidResult result){
              updateOrgUnit();
            }
          }
,new LoadingMask(view.getContentOrgUnitDetailsPanel()));
        }
 else {
          N10N.infoNotif(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.saveConfirm());
        }
      }
    }
,view.getSaveButton(),view.getExcelExportButton(),new LoadingMask(view.getContentOrgUnitDetailsPanel()));
  }
 else {
    UpdateProject command=new UpdateProject(getOrgUnit().getId(),valueChanges);
    command.setOrgUnit(true);
    dispatch.execute(command,new CommandResultHandler<VoidResult>(){
      @Override public void onCommandFailure(      final Throwable caught){
        N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
      }
      @Override public void onCommandSuccess(      final VoidResult result){
        updateOrgUnit();
      }
    }
,view.getSaveButton(),view.getExcelExportButton(),new LoadingMask(view.getContentOrgUnitDetailsPanel()));
  }
}

Fixed version (ground truth):
/** 
 * Method executed on save button action.
 */
private void onSaveAction(){
  if (!iterationChanges.isEmpty()) {
    final List<IterationChange> iterationChangesList=new ArrayList<IterationChange>(iterationChanges.values());
    Iterator<IterationChange> iterator=iterationChangesList.iterator();
    while (iterator.hasNext()) {
      IterationChange iterationChange=iterator.next();
      if (iterationChange.isCreated() && Profiler.INSTANCE.isOfflineMode()) {
        iterator.remove();
      }
    }
    UpdateLayoutGroupIterations updateLayoutGroupIterations=new UpdateLayoutGroupIterations(iterationChangesList,getOrgUnit().getId());
    dispatch.execute(updateLayoutGroupIterations,new CommandResultHandler<ListResult<IterationChange>>(){
      @Override public void onCommandFailure(      final Throwable caught){
        N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
      }
      @Override protected void onCommandSuccess(      ListResult<IterationChange> result){
        if (result != null) {
          for (          IterationChange iterationChange : result.getList()) {
            if (iterationChange.isDeleted()) {
              Iterator<ValueEvent> valuesIterator=valueChanges.iterator();
              while (valuesIterator.hasNext()) {
                ValueEvent valueEvent=valuesIterator.next();
                Integer iterationId=valueEvent.getIterationId();
                if (iterationId != null && iterationId == iterationChange.getIterationId()) {
                  valuesIterator.remove();
                }
              }
            }
 else             if (iterationChange.isCreated()) {
              int oldId=iterationChange.getIterationId();
              int newId=iterationChange.getNewIterationId();
              newIterationsTabItems.get(oldId).setIterationId(newId);
              for (              ValueEvent valueEvent : valueChanges) {
                Integer iterationId=valueEvent.getIterationId();
                if (iterationId != null && iterationId == oldId) {
                  valueEvent.setIterationId(newId);
                }
              }
            }
          }
          iterationChanges.clear();
          newIterationsTabItems.clear();
          UpdateProject command=new UpdateProject(getOrgUnit().getId(),valueChanges);
          command.setOrgUnit(true);
          dispatch.execute(command,new CommandResultHandler<VoidResult>(){
            @Override public void onCommandFailure(            final Throwable caught){
              N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
            }
            @Override public void onCommandSuccess(            final VoidResult result){
              updateOrgUnit();
            }
          }
,new LoadingMask(view.getContentOrgUnitDetailsPanel()));
        }
 else {
          N10N.infoNotif(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.saveConfirm());
        }
      }
    }
,view.getSaveButton(),view.getExcelExportButton(),new LoadingMask(view.getContentOrgUnitDetailsPanel()));
  }
 else {
    UpdateProject command=new UpdateProject(getOrgUnit().getId(),valueChanges);
    command.setOrgUnit(true);
    dispatch.execute(command,new CommandResultHandler<VoidResult>(){
      @Override public void onCommandFailure(      final Throwable caught){
        N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
      }
      @Override public void onCommandSuccess(      final VoidResult result){
        updateOrgUnit();
      }
    }
,view.getSaveButton(),view.getExcelExportButton(),new LoadingMask(view.getContentOrgUnitDetailsPanel()));
  }
}