Program: 188583
Project: 188583
Buggy source:
/** 
 * Create a new panel to edit a user
 * @param user the user to edit
 */
public CreateDescriptiveMetadata(String aipId,boolean isNew){
  this.aipId=aipId;
  this.isNew=isNew;
  initWidget(uiBinder.createAndBindUi(this));
  metadataXML=new TextArea();
  metadataXML.addStyleName("String_Node_Str");
  type.addChangeHandler(new ChangeHandler(){
    @Override public void onChange(    ChangeEvent event){
      String value=type.getSelectedValue();
      selectedBundle=null;
      if (StringUtils.isNotBlank(value)) {
        for (        SupportedMetadataTypeBundle bundle : metadataTypes) {
          if (bundle.getId().equals(value)) {
            selectedBundle=bundle;
            break;
          }
        }
        id.setText(value + "String_Node_Str");
      }
 else {
        id.setText("String_Node_Str");
      }
      updateFormOrXML();
    }
  }
);
  BrowserService.Util.getInstance().retrieveSupportedMetadata(aipId,LocaleInfo.getCurrentLocale().getLocaleName(),new AsyncCallback<List<SupportedMetadataTypeBundle>>(){
    @Override public void onFailure(    Throwable caught){
      AsyncCallbackUtils.defaultFailureTreatment(caught);
    }
    @Override public void onSuccess(    List<SupportedMetadataTypeBundle> metadataTypes){
      CreateDescriptiveMetadata.this.metadataTypes=metadataTypes;
      for (      SupportedMetadataTypeBundle b : metadataTypes) {
        if (b.getVersion() != null) {
          type.addItem(b.getLabel(),b.getType() + RodaConstants.METADATA_VERSION_SEPARATOR + b.getVersion());
        }
 else {
          type.addItem(b.getLabel(),b.getType());
        }
      }
      type.addItem(messages.otherItem(),"String_Node_Str");
      type.setSelectedIndex(0);
      id.setText(metadataTypes.get(0).getType() + "String_Node_Str");
      selectedBundle=metadataTypes.get(0);
      updateFormOrXML();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Create a new panel to edit a user
 * @param user the user to edit
 */
public CreateDescriptiveMetadata(String aipId,boolean isNew){
  this.aipId=aipId;
  this.isNew=isNew;
  initWidget(uiBinder.createAndBindUi(this));
  metadataXML=new TextArea();
  metadataXML.addStyleName("String_Node_Str");
  type.addChangeHandler(new ChangeHandler(){
    @Override public void onChange(    ChangeEvent event){
      String value=type.getSelectedValue();
      selectedBundle=null;
      if (StringUtils.isNotBlank(value)) {
        for (        SupportedMetadataTypeBundle bundle : metadataTypes) {
          if (bundle.getId().equals(value)) {
            selectedBundle=bundle;
            break;
          }
        }
        id.setText(value + "String_Node_Str");
      }
 else {
        id.setText("String_Node_Str");
      }
      updateFormOrXML();
    }
  }
);
  BrowserService.Util.getInstance().retrieveSupportedMetadata(aipId,LocaleInfo.getCurrentLocale().getLocaleName(),new AsyncCallback<List<SupportedMetadataTypeBundle>>(){
    @Override public void onFailure(    Throwable caught){
      AsyncCallbackUtils.defaultFailureTreatment(caught);
    }
    @Override public void onSuccess(    List<SupportedMetadataTypeBundle> metadataTypes){
      CreateDescriptiveMetadata.this.metadataTypes=metadataTypes;
      for (      SupportedMetadataTypeBundle b : metadataTypes) {
        if (b.getVersion() != null) {
          type.addItem(b.getLabel(),b.getType() + RodaConstants.METADATA_VERSION_SEPARATOR + b.getVersion());
        }
 else {
          type.addItem(b.getLabel(),b.getType());
        }
      }
      type.addItem(messages.otherItem(),"String_Node_Str");
      type.setSelectedIndex(0);
      selectedBundle=metadataTypes.get(0);
      if (selectedBundle.getVersion() != null) {
        id.setText(selectedBundle.getType() + RodaConstants.METADATA_VERSION_SEPARATOR + selectedBundle.getVersion()+ "String_Node_Str");
      }
 else {
        id.setText(selectedBundle.getType() + "String_Node_Str");
      }
      updateFormOrXML();
    }
  }
);
}