Program: 188350
Project: 188350
Buggy source:
private void move(final SelectedItems<IndexedAIP> selected,final AsyncCallback<ActionImpact> callback){
  int counter=0;
  boolean justActive=parentAipState != null ? AIPState.ACTIVE.equals(parentAipState) : true;
  Filter filter=new Filter();
  boolean showEmptyParentButton;
  if (parentAipId != null) {
    filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,parentAipId));
    filter.add(new NotSimpleFilterParameter(RodaConstants.INDEX_UUID,parentAipId));
    showEmptyParentButton=true;
  }
 else {
    if (selected instanceof SelectedItemsList) {
      SelectedItemsList<IndexedAIP> list=(SelectedItemsList<IndexedAIP>)selected;
      counter=list.getIds().size();
      if (counter <= RodaConstants.DIALOG_FILTER_LIMIT_NUMBER) {
        for (        String id : list.getIds()) {
          filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,id));
          filter.add(new NotSimpleFilterParameter(RodaConstants.INDEX_UUID,id));
        }
      }
    }
    if (selected instanceof SelectedItemsFilter) {
      filter=((SelectedItemsFilter<IndexedAIP>)selected).getFilter();
    }
 else {
      filter=Filter.ALL;
    }
    showEmptyParentButton=false;
  }
  SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive,true);
  selectAipDialog.setEmptyParentButtonVisible(showEmptyParentButton);
  selectAipDialog.showAndCenter();
  if (counter > 0 && counter <= RodaConstants.DIALOG_FILTER_LIMIT_NUMBER) {
    selectAipDialog.addStyleName("String_Node_Str");
  }
  selectAipDialog.addValueChangeHandler(new ValueChangeHandler<IndexedAIP>(){
    @Override public void onValueChange(    ValueChangeEvent<IndexedAIP> event){
      final IndexedAIP parentAIP=event.getValue();
      final String parentId=(parentAIP != null) ? parentAIP.getId() : null;
      Dialogs.showPromptDialog(messages.outcomeDetailTitle(),null,null,messages.outcomeDetailPlaceholder(),RegExp.compile("String_Node_Str"),messages.cancelButton(),messages.confirmButton(),new AsyncCallback<String>(){
        @Override public void onFailure(        Throwable caught){
        }
        @Override public void onSuccess(        String details){
          BrowserService.Util.getInstance().moveAIPInHierarchy(selected,parentId,details,new LoadingAsyncCallback<IndexedAIP>(){
            @Override public void onSuccessImpl(            IndexedAIP result){
              Toast.showInfo(messages.runningInBackgroundTitle(),messages.runningInBackgroundDescription());
              if (result != null) {
                HistoryUtils.newHistory(BrowseAIP.RESOLVER,result.getId());
              }
 else {
                HistoryUtils.newHistory(BrowseAIP.RESOLVER);
              }
              callback.onSuccess(ActionImpact.UPDATED);
            }
            @Override public void onFailureImpl(            Throwable caught){
              if (caught instanceof NotFoundException) {
                Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
              }
 else {
                callback.onFailure(caught);
              }
            }
          }
);
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
private void move(final SelectedItems<IndexedAIP> selected,final AsyncCallback<ActionImpact> callback){
  int counter=0;
  boolean justActive=parentAipState != null ? AIPState.ACTIVE.equals(parentAipState) : true;
  Filter filter=new Filter();
  boolean showEmptyParentButton;
  if (parentAipId != null) {
    filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,parentAipId));
    filter.add(new NotSimpleFilterParameter(RodaConstants.INDEX_UUID,parentAipId));
    showEmptyParentButton=true;
  }
 else {
    if (selected instanceof SelectedItemsList) {
      SelectedItemsList<IndexedAIP> list=(SelectedItemsList<IndexedAIP>)selected;
      counter=list.getIds().size();
      if (counter <= RodaConstants.DIALOG_FILTER_LIMIT_NUMBER) {
        for (        String id : list.getIds()) {
          filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,id));
          filter.add(new NotSimpleFilterParameter(RodaConstants.INDEX_UUID,id));
        }
      }
    }
    if (selected instanceof SelectedItemsFilter) {
      filter=((SelectedItemsFilter<IndexedAIP>)selected).getFilter();
    }
 else {
      filter=Filter.ALL;
    }
    showEmptyParentButton=false;
  }
  SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive,true);
  selectAipDialog.setEmptyParentButtonVisible(showEmptyParentButton);
  selectAipDialog.showAndCenter();
  if (counter > 0 && counter <= RodaConstants.DIALOG_FILTER_LIMIT_NUMBER) {
    selectAipDialog.addStyleName("String_Node_Str");
  }
  selectAipDialog.addValueChangeHandler(new ValueChangeHandler<IndexedAIP>(){
    @Override public void onValueChange(    ValueChangeEvent<IndexedAIP> event){
      final IndexedAIP parentAIP=event.getValue();
      final String parentId=(parentAIP != null) ? parentAIP.getId() : null;
      Dialogs.showPromptDialog(messages.outcomeDetailTitle(),null,null,messages.outcomeDetailPlaceholder(),RegExp.compile("String_Node_Str"),messages.cancelButton(),messages.confirmButton(),false,new AsyncCallback<String>(){
        @Override public void onFailure(        Throwable caught){
        }
        @Override public void onSuccess(        String details){
          BrowserService.Util.getInstance().moveAIPInHierarchy(selected,parentId,details,new LoadingAsyncCallback<IndexedAIP>(){
            @Override public void onSuccessImpl(            IndexedAIP result){
              Toast.showInfo(messages.runningInBackgroundTitle(),messages.runningInBackgroundDescription());
              if (result != null) {
                HistoryUtils.newHistory(BrowseAIP.RESOLVER,result.getId());
              }
 else {
                HistoryUtils.newHistory(BrowseAIP.RESOLVER);
              }
              callback.onSuccess(ActionImpact.UPDATED);
            }
            @Override public void onFailureImpl(            Throwable caught){
              if (caught instanceof NotFoundException) {
                Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
              }
 else {
                callback.onFailure(caught);
              }
            }
          }
);
        }
      }
);
    }
  }
);
}