Program: 188562
Project: 188562
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),new NotSimpleFilterParameter(RodaConstants.AIP_ID,aipId));
      SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive,false);
      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().moveAIPInHierarchy(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 {
                AsyncCallbackUtils.defaultFailureTreatment(caught);
              }
            }
          }
);
        }
      }
);
    }
 else {
      Dialogs.showInformationDialog(messages.selectAnItemTitle(),messages.selectAnItemToMoveDescription(),messages.dialogOk());
    }
  }
 else {
    Filter filter=new Filter();
    boolean showEmptyParentButton;
    if (aipId != null) {
      filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,aipId));
      filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ID,aipId));
      showEmptyParentButton=true;
    }
 else {
      filter=Filter.NULL;
      showEmptyParentButton=false;
    }
    SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive,true);
    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().moveAIPInHierarchy(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 {
              AsyncCallbackUtils.defaultFailureTreatment(caught);
            }
          }
        }
);
      }
    }
);
  }
}

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),new NotSimpleFilterParameter(RodaConstants.AIP_ID,aipId));
      SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive,false);
      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().moveAIPInHierarchy(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 {
                AsyncCallbackUtils.defaultFailureTreatment(caught);
              }
            }
          }
);
        }
      }
);
    }
 else {
      Dialogs.showInformationDialog(messages.selectAnItemTitle(),messages.selectAnItemToMoveDescription(),messages.dialogOk());
    }
  }
 else {
    Filter filter=new Filter();
    boolean showEmptyParentButton;
    if (aipId != null) {
      filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ANCESTORS,aipId));
      filter.add(new NotSimpleFilterParameter(RodaConstants.AIP_ID,aipId));
      showEmptyParentButton=true;
    }
 else {
      filter=Filter.ALL;
      showEmptyParentButton=false;
    }
    SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,justActive,true);
    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().moveAIPInHierarchy(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 {
              AsyncCallbackUtils.defaultFailureTreatment(caught);
            }
          }
        }
);
      }
    }
);
  }
}