Program: 188650
Project: 188650
Buggy source:
@UiHandler("String_Node_Str") void buttonMoveItemHandler(ClickEvent e){
  final SelectedItems<IndexedAIP> selected=aipList.getSelected();
  if (SelectedItemsUtils.isEmpty(selected)) {
    if (aipId != null && itemBundle != null) {
      Filter filter=new Filter(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,aipId));
      SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive);
      if (itemBundle.getAip().getParentID() != null) {
        selectAipDialog.setEmptyParentButtonVisible(true);
      }
      selectAipDialog.showAndCenter();
      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;
          SelectedItemsList<IndexedAIP> selected=new SelectedItemsList<IndexedAIP>(Arrays.asList(aipId),IndexedAIP.class.getName());
          BrowserService.Util.getInstance().moveInHierarchy(selected,parentId,new AsyncCallback<IndexedAIP>(){
            @Override public void onSuccess(            IndexedAIP result){
              if (result != null) {
                Tools.newHistory(Browse.RESOLVER,result.getId());
              }
 else {
                Tools.newHistory(Browse.RESOLVER);
              }
            }
            @Override public void onFailure(            Throwable caught){
              if (caught instanceof NotFoundException) {
                Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
              }
 else {
                Toast.showError(messages.moveIllegalOperation(caught.getMessage()));
              }
            }
          }
);
        }
      }
);
    }
 else {
      Dialogs.showInformationDialog(messages.selectAnItemTitle(),messages.selectAnItemDescription(),messages.dialogOk());
    }
  }
 else {
    Filter filter;
    boolean showEmptyParentButton;
    if (aipId != null) {
      filter=new Filter(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,aipId));
      showEmptyParentButton=true;
    }
 else {
      filter=new Filter();
      showEmptyParentButton=false;
    }
    SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive);
    selectAipDialog.setEmptyParentButtonVisible(showEmptyParentButton);
    selectAipDialog.showAndCenter();
    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;
        BrowserService.Util.getInstance().moveInHierarchy(selected,parentId,new LoadingAsyncCallback<IndexedAIP>(){
          @Override public void onSuccessImpl(          IndexedAIP result){
            if (result != null) {
              Tools.newHistory(Browse.RESOLVER,result.getId());
            }
 else {
              Tools.newHistory(Browse.RESOLVER);
            }
          }
          @Override public void onFailureImpl(          Throwable caught){
            if (caught instanceof NotFoundException) {
              Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
            }
 else {
              Toast.showError(messages.moveIllegalOperation(caught.getMessage()));
            }
          }
        }
);
      }
    }
);
  }
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonMoveItemHandler(ClickEvent e){
  final SelectedItems<IndexedAIP> selected=aipList.getSelected();
  if (SelectedItemsUtils.isEmpty(selected)) {
    if (aipId != null && itemBundle != null) {
      Filter filter=new Filter(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,aipId));
      SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive);
      if (itemBundle.getAip().getParentID() != null) {
        selectAipDialog.setEmptyParentButtonVisible(true);
      }
      selectAipDialog.showAndCenter();
      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;
          SelectedItemsList<IndexedAIP> selected=new SelectedItemsList<IndexedAIP>(Arrays.asList(aipId),IndexedAIP.class.getName());
          BrowserService.Util.getInstance().moveInHierarchy(selected,parentId,new AsyncCallback<IndexedAIP>(){
            @Override public void onSuccess(            IndexedAIP result){
              if (result != null) {
                Tools.newHistory(Browse.RESOLVER,result.getId());
              }
 else {
                Tools.newHistory(Browse.RESOLVER);
              }
            }
            @Override public void onFailure(            Throwable caught){
              if (caught instanceof NotFoundException) {
                Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
              }
 else {
                Toast.showError(messages.moveIllegalOperation(caught.getMessage()));
              }
            }
          }
);
        }
      }
);
    }
 else {
      Dialogs.showInformationDialog(messages.selectAnItemTitle(),messages.selectAnItemToMoveDescription(),messages.dialogOk());
    }
  }
 else {
    Filter filter;
    boolean showEmptyParentButton;
    if (aipId != null) {
      filter=new Filter(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,aipId));
      showEmptyParentButton=true;
    }
 else {
      filter=new Filter();
      showEmptyParentButton=false;
    }
    SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive);
    selectAipDialog.setEmptyParentButtonVisible(showEmptyParentButton);
    selectAipDialog.showAndCenter();
    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;
        BrowserService.Util.getInstance().moveInHierarchy(selected,parentId,new LoadingAsyncCallback<IndexedAIP>(){
          @Override public void onSuccessImpl(          IndexedAIP result){
            if (result != null) {
              Tools.newHistory(Browse.RESOLVER,result.getId());
            }
 else {
              Tools.newHistory(Browse.RESOLVER);
            }
          }
          @Override public void onFailureImpl(          Throwable caught){
            if (caught instanceof NotFoundException) {
              Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
            }
 else {
              Toast.showError(messages.moveIllegalOperation(caught.getMessage()));
            }
          }
        }
);
      }
    }
);
  }
}