Program: 102133
Project: 102133
Buggy source:
private void createMed() throws Exception {
  ModelExtensionDefinitionParser parser=new ModelExtensionDefinitionParser(ExtensionPlugin.getInstance().getMedSchema());
  this.originalMed=parser.parse(getFile().getContents(),ExtensionPlugin.getInstance().createDefaultModelObjectExtensionAssistant());
  Collection<String> fatals=parser.getFatalErrors();
  if ((fatals != null) && !fatals.isEmpty()) {
    throw new RuntimeException(fatals.iterator().next());
  }
  if (this.medBeingEdited != null) {
    this.medBeingEdited.removeListener(this);
  }
  this.medBeingEdited=new ModelExtensionDefinition(ExtensionPlugin.getInstance().createDefaultModelObjectExtensionAssistant());
  this.medBeingEdited.setDescription(this.originalMed.getDescription());
  this.medBeingEdited.setMetamodelUri(this.originalMed.getMetamodelUri());
  this.medBeingEdited.setNamespacePrefix(this.originalMed.getNamespacePrefix());
  this.medBeingEdited.setNamespaceUri(this.originalMed.getNamespaceUri());
  this.medBeingEdited.setVersion(this.originalMed.getVersion());
  for (  String modelType : this.originalMed.getSupportedModelTypes()) {
    this.medBeingEdited.addModelType(modelType);
  }
  for (  String metaclassName : this.originalMed.getExtendedMetaclasses()) {
    this.medBeingEdited.addMetaclass(metaclassName);
    for (    ModelExtensionPropertyDefinition propDefn : this.originalMed.getPropertyDefinitions(metaclassName)) {
      ModelExtensionPropertyDefinition copy=(ModelExtensionPropertyDefinition)propDefn.clone();
      copy.setNamespaceProvider(this.medBeingEdited);
      this.medBeingEdited.addPropertyDefinition(metaclassName,copy);
    }
  }
  IFile medFile=getFile();
  String projName=medFile.getProject().getName();
  if (projName != null && projName.equals(ExtensionConstants.BUILTIN_MEDS_PROJECT_NAME)) {
    this.medBeingEdited.markAsBuiltIn();
  }
  if (this.selectionSynchronizer == null) {
    this.selectionSynchronizer=new MedSelectionSynchronizer(this);
  }
 else {
    this.selectionSynchronizer.setMed(this.medBeingEdited);
  }
  this.medBeingEdited.addListener(this);
}

Fixed version (ground truth):
private void createMed() throws Exception {
  ModelExtensionDefinitionParser parser=new ModelExtensionDefinitionParser(ExtensionPlugin.getInstance().getMedSchema());
  this.originalMed=parser.parse(getFile().getContents(),ExtensionPlugin.getInstance().createDefaultModelObjectExtensionAssistant());
  Collection<String> fatals=parser.getFatalErrors();
  if ((fatals != null) && !fatals.isEmpty()) {
    throw new RuntimeException(fatals.iterator().next());
  }
  if (this.medBeingEdited != null) {
    this.medBeingEdited.removeListener(this);
  }
  this.medBeingEdited=new ModelExtensionDefinition(ExtensionPlugin.getInstance().createDefaultModelObjectExtensionAssistant());
  this.medBeingEdited.setDescription(this.originalMed.getDescription());
  this.medBeingEdited.setMetamodelUri(this.originalMed.getMetamodelUri());
  this.medBeingEdited.setNamespacePrefix(this.originalMed.getNamespacePrefix());
  this.medBeingEdited.setNamespaceUri(this.originalMed.getNamespaceUri());
  this.medBeingEdited.setVersion(this.originalMed.getVersion());
  for (  String modelType : this.originalMed.getSupportedModelTypes()) {
    this.medBeingEdited.addModelType(modelType);
  }
  for (  String metaclassName : this.originalMed.getExtendedMetaclasses()) {
    this.medBeingEdited.addMetaclass(metaclassName);
    for (    ModelExtensionPropertyDefinition propDefn : this.originalMed.getPropertyDefinitions(metaclassName)) {
      ModelExtensionPropertyDefinition copy=(ModelExtensionPropertyDefinition)propDefn.clone();
      copy.setNamespaceProvider(this.medBeingEdited);
      this.medBeingEdited.addPropertyDefinition(metaclassName,copy);
    }
  }
  IFile medFile=getFile();
  if (isImported(medFile))   this.medBeingEdited.markAsImported();
 else   if (isBuiltIn(medFile))   this.medBeingEdited.markAsBuiltIn();
  if (this.selectionSynchronizer == null) {
    this.selectionSynchronizer=new MedSelectionSynchronizer(this);
  }
 else {
    this.selectionSynchronizer.setMed(this.medBeingEdited);
  }
  this.medBeingEdited.addListener(this);
}