Program: 35356
Project: 35356
Buggy source:
private void updateContact(final ContactDTO contactDTO,final AsyncCallback<ContactDTO> callback,final Component target){
  dispatch.execute(new UpdateLayoutGroupIterations(new ArrayList<IterationChange>(iterationChanges.values()),contactDTO.getId()),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){
      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();
      dispatch.execute(new UpdateContact(contactDTO.getId(),valueChanges),new CommandResultHandler<VoidResult>(){
        @Override public void onCommandFailure(        final Throwable caught){
          N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
        }
        @Override protected void onCommandSuccess(        final VoidResult result){
          N10N.infoNotif(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.saveConfirm());
          eventBus.fireEvent(new UpdateEvent(UpdateEvent.CONTACT_UPDATE,contactDTO));
          for (          final ValueEvent event : valueChanges) {
            if (event.getSource() instanceof DefaultContactFlexibleElementDTO) {
              updateCurrentContact(contactDTO,(DefaultContactFlexibleElementDTO)event.getSource(),event.getSingleValue());
            }
          }
          valueChanges.clear();
          if (callback != null) {
            callback.onSuccess(contactDTO);
          }
          refresh(contactDTO);
        }
      }
,view.getSaveButton(),new LoadingMask(view.getDetailsContainer()),new LoadingMask(target));
    }
  }
,view.getSaveButton(),new LoadingMask(view.getDetailsContainer()),new LoadingMask(target));
}

Fixed version (ground truth):
private void updateContact(final ContactDTO contactDTO,final AsyncCallback<ContactDTO> callback,final Component target){
  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() && isOfflineMode()) {
        iterator.remove();
      }
    }
    dispatch.execute(new UpdateLayoutGroupIterations(iterationChangesList,contactDTO.getId()),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();
          dispatch.execute(new UpdateContact(contactDTO.getId(),valueChanges),new CommandResultHandler<VoidResult>(){
            @Override public void onCommandFailure(            final Throwable caught){
              N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
            }
            @Override protected void onCommandSuccess(            final VoidResult result){
              N10N.infoNotif(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.saveConfirm());
              eventBus.fireEvent(new UpdateEvent(UpdateEvent.CONTACT_UPDATE,contactDTO));
              for (              final ValueEvent event : valueChanges) {
                if (event.getSource() instanceof DefaultContactFlexibleElementDTO) {
                  updateCurrentContact(contactDTO,(DefaultContactFlexibleElementDTO)event.getSource(),event.getSingleValue());
                }
              }
              valueChanges.clear();
              if (callback != null) {
                callback.onSuccess(contactDTO);
              }
              refresh(contactDTO);
            }
          }
,view.getSaveButton(),new LoadingMask(view.getDetailsContainer()),new LoadingMask(target));
        }
 else {
          N10N.infoNotif(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.saveConfirm());
        }
      }
    }
,view.getSaveButton(),new LoadingMask(view.getDetailsContainer()),new LoadingMask(target));
  }
 else {
    dispatch.execute(new UpdateContact(contactDTO.getId(),valueChanges),new CommandResultHandler<VoidResult>(){
      @Override public void onCommandFailure(      final Throwable caught){
        N10N.error(I18N.CONSTANTS.save(),I18N.CONSTANTS.saveError());
      }
      @Override protected void onCommandSuccess(      final VoidResult result){
        N10N.infoNotif(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.saveConfirm());
        eventBus.fireEvent(new UpdateEvent(UpdateEvent.CONTACT_UPDATE,contactDTO));
        for (        final ValueEvent event : valueChanges) {
          if (event.getSource() instanceof DefaultContactFlexibleElementDTO) {
            updateCurrentContact(contactDTO,(DefaultContactFlexibleElementDTO)event.getSource(),event.getSingleValue());
          }
        }
        valueChanges.clear();
        if (callback != null) {
          callback.onSuccess(contactDTO);
        }
        refresh(contactDTO);
      }
    }
,view.getSaveButton(),new LoadingMask(view.getDetailsContainer()),new LoadingMask(target));
  }
}