Program: 188584
Project: 188584
Buggy source:
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  buttonApply.setEnabled(false);
  String idText=id.getText();
  String typeText=selectedBundle != null ? selectedBundle.getType() : messages.otherItem();
  String typeVersion=selectedBundle != null ? selectedBundle.getVersion() : null;
  String template=selectedBundle != null ? selectedBundle.getTemplate() : null;
  String xmlText=metadataXML.getText();
  boolean hasOverridenTheForm=inXML && !xmlText.equals(metadataTextFromForm);
  if (idText.length() > 0) {
    Set<MetadataValue> values=null;
    if (!hasOverridenTheForm && selectedBundle != null) {
      values=selectedBundle.getValues();
    }
    DescriptiveMetadataEditBundle newBundle=new DescriptiveMetadataEditBundle(idText,typeText,typeVersion,xmlText,template,values,true);
    BrowserService.Util.getInstance().createDescriptiveMetadataFile(aipId,newBundle,new AsyncCallback<Void>(){
      @Override public void onFailure(      Throwable caught){
        if (caught instanceof ValidationException) {
          ValidationException e=(ValidationException)caught;
          updateErrors(e);
        }
 else         if (caught instanceof AlreadyExistsException) {
          idError.setVisible(true);
          idError.setHTML(SafeHtmlUtils.fromSafeConstant(messages.fileAlreadyExists()));
        }
 else {
          idError.setVisible(false);
          AsyncCallbackUtils.defaultFailureTreatment(caught);
        }
        buttonApply.setEnabled(true);
      }
      @Override public void onSuccess(      Void result){
        errors.setText("String_Node_Str");
        errors.setVisible(false);
        Toast.showInfo(messages.dialogSuccess(),messages.metadataFileCreated());
        Tools.newHistory(Browse.RESOLVER,aipId);
      }
    }
);
  }
 else {
    Toast.showError("String_Node_Str");
    buttonApply.setEnabled(true);
  }
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  buttonApply.setEnabled(false);
  String idText=id.getText();
  String typeText=selectedBundle != null ? selectedBundle.getType() : messages.otherItem();
  String typeVersion=selectedBundle != null ? selectedBundle.getVersion() : null;
  String template=selectedBundle != null ? selectedBundle.getTemplate() : null;
  String xmlText=metadataXML.getText();
  boolean hasOverridenTheForm=inXML && !xmlText.equals(metadataTextFromForm);
  if (idText.length() > 0) {
    Set<MetadataValue> values=null;
    if (!hasOverridenTheForm && selectedBundle != null) {
      values=selectedBundle.getValues();
    }
    DescriptiveMetadataEditBundle newBundle=new DescriptiveMetadataEditBundle(idText,typeText,typeVersion,xmlText,template,values,true);
    BrowserService.Util.getInstance().createDescriptiveMetadataFile(aipId,newBundle,new AsyncCallback<Void>(){
      @Override public void onFailure(      Throwable caught){
        if (caught instanceof ValidationException) {
          ValidationException e=(ValidationException)caught;
          updateErrors(e);
          idError.setVisible(false);
        }
 else         if (caught instanceof AlreadyExistsException) {
          idError.setVisible(true);
          idError.setHTML(SafeHtmlUtils.fromSafeConstant(messages.fileAlreadyExists()));
          errors.setVisible(false);
        }
 else {
          idError.setVisible(false);
          AsyncCallbackUtils.defaultFailureTreatment(caught);
        }
        buttonApply.setEnabled(true);
      }
      @Override public void onSuccess(      Void result){
        errors.setText("String_Node_Str");
        errors.setVisible(false);
        Toast.showInfo(messages.dialogSuccess(),messages.metadataFileCreated());
        Tools.newHistory(Browse.RESOLVER,aipId);
      }
    }
);
  }
 else {
    Toast.showError("String_Node_Str");
    buttonApply.setEnabled(true);
  }
}