Program: 11726
Project: 11726
Buggy source:
@Override public GenPackage findGenPackage(EPackage ePackage){
  GenPackage result;
  if (ePackageToGenPackageMap == null) {
    ePackageToGenPackageMap=new HashMap<EPackage,GenPackage>();
    result=null;
  }
 else {
    result=ePackageToGenPackageMap.get(ePackage);
    if (result != null) {
      return result;
    }
  }
  if (!isMainGenModel() && (ePackage == EcorePackage.eINSTANCE || ePackage == XMLTypePackage.eINSTANCE || ePackage == XMLNamespacePackage.eINSTANCE)) {
    result=getMainGenModel().findGenPackage(ePackage);
  }
 else   if (ePackage == EcorePackage.eINSTANCE) {
    if (ecoreGenPackage == null) {
      GenModel ecoreGenModel=getGenModel().createGenModel();
      ecoreGenModel.initialize(Collections.singleton(EcorePackage.eINSTANCE));
      ecoreGenModel.setMainGenModel(this);
      ecoreGenModel.setImportManager(getImportManager());
      ecoreGenModel.setLanguage("String_Node_Str");
      ecoreGenPackage=ecoreGenModel.getGenPackages().get(0);
      ecoreGenPackage.setPrefix("String_Node_Str");
      ecoreGenPackage.setBasePackage("String_Node_Str");
    }
    result=ecoreGenPackage;
  }
 else   if (ePackage == XMLTypePackage.eINSTANCE) {
    if (xmlTypeGenPackage == null) {
      GenModel xmlTypeGenModel=getGenModel().createGenModel();
      xmlTypeGenModel.initialize(Collections.singleton(XMLTypePackage.eINSTANCE));
      xmlTypeGenModel.setMainGenModel(this);
      xmlTypeGenModel.setImportManager(getImportManager());
      xmlTypeGenModel.setLanguage("String_Node_Str");
      xmlTypeGenPackage=xmlTypeGenModel.getGenPackages().get(0);
      xmlTypeGenPackage.setPrefix("String_Node_Str");
      xmlTypeGenPackage.setBasePackage("String_Node_Str");
      xmlTypeGenPackage.setDataTypeConverters(true);
    }
    result=xmlTypeGenPackage;
  }
 else   if (ePackage == XMLNamespacePackage.eINSTANCE) {
    if (xmlNamespaceGenPackage == null) {
      GenModel xmlNamespaceGenModel=getGenModel().createGenModel();
      xmlNamespaceGenModel.initialize(Collections.singleton(XMLNamespacePackage.eINSTANCE));
      xmlNamespaceGenModel.setMainGenModel(this);
      xmlNamespaceGenModel.setImportManager(getImportManager());
      xmlNamespaceGenModel.setLanguage("String_Node_Str");
      xmlNamespaceGenPackage=xmlNamespaceGenModel.getGenPackages().get(0);
      xmlNamespaceGenPackage.setPrefix("String_Node_Str");
      xmlNamespaceGenPackage.setBasePackage("String_Node_Str");
    }
    result=xmlNamespaceGenPackage;
  }
 else   if (ePackage != null) {
    for (Iterator<GenPackage> pIter=getAllGenPackages().iterator(); pIter.hasNext() && result == null; ) {
      GenPackage genPackage=pIter.next();
      result=findGenPackageHelper(genPackage,ePackage);
    }
  }
  ePackageToGenPackageMap.put(ePackage,result);
  return result;
}

Fixed version (ground truth):
@Override public GenPackage findGenPackage(EPackage ePackage){
  GenPackage result;
  if (ePackageToGenPackageMap == null) {
    ePackageToGenPackageMap=new HashMap<EPackage,GenPackage>();
    result=null;
  }
 else {
    result=ePackageToGenPackageMap.get(ePackage);
    if (result != null) {
      return result;
    }
  }
  boolean isMainGenModel=isMainGenModel();
  if (!isMainGenModel && (ePackage == EcorePackage.eINSTANCE || ePackage == XMLTypePackage.eINSTANCE || ePackage == XMLNamespacePackage.eINSTANCE)) {
    result=getMainGenModel().findGenPackage(ePackage);
  }
 else   if (ePackage == EcorePackage.eINSTANCE) {
    if (ecoreGenPackage == null) {
      GenModel ecoreGenModel=getGenModel().createGenModel();
      ecoreGenModel.initialize(Collections.singleton(EcorePackage.eINSTANCE));
      ecoreGenModel.setMainGenModel(this);
      ecoreGenModel.setImportManager(getImportManager());
      ecoreGenModel.setLanguage("String_Node_Str");
      ecoreGenPackage=ecoreGenModel.getGenPackages().get(0);
      ecoreGenPackage.setPrefix("String_Node_Str");
      ecoreGenPackage.setBasePackage("String_Node_Str");
    }
    result=ecoreGenPackage;
  }
 else   if (ePackage == XMLTypePackage.eINSTANCE) {
    if (xmlTypeGenPackage == null) {
      GenModel xmlTypeGenModel=getGenModel().createGenModel();
      xmlTypeGenModel.initialize(Collections.singleton(XMLTypePackage.eINSTANCE));
      xmlTypeGenModel.setMainGenModel(this);
      xmlTypeGenModel.setImportManager(getImportManager());
      xmlTypeGenModel.setLanguage("String_Node_Str");
      xmlTypeGenPackage=xmlTypeGenModel.getGenPackages().get(0);
      xmlTypeGenPackage.setPrefix("String_Node_Str");
      xmlTypeGenPackage.setBasePackage("String_Node_Str");
      xmlTypeGenPackage.setDataTypeConverters(true);
    }
    result=xmlTypeGenPackage;
  }
 else   if (ePackage == XMLNamespacePackage.eINSTANCE) {
    if (xmlNamespaceGenPackage == null) {
      GenModel xmlNamespaceGenModel=getGenModel().createGenModel();
      xmlNamespaceGenModel.initialize(Collections.singleton(XMLNamespacePackage.eINSTANCE));
      xmlNamespaceGenModel.setMainGenModel(this);
      xmlNamespaceGenModel.setImportManager(getImportManager());
      xmlNamespaceGenModel.setLanguage("String_Node_Str");
      xmlNamespaceGenPackage=xmlNamespaceGenModel.getGenPackages().get(0);
      xmlNamespaceGenPackage.setPrefix("String_Node_Str");
      xmlNamespaceGenPackage.setBasePackage("String_Node_Str");
    }
    result=xmlNamespaceGenPackage;
  }
 else   if (ePackage != null) {
    for (Iterator<GenPackage> pIter=getAllGenPackages().iterator(); pIter.hasNext() && result == null; ) {
      GenPackage genPackage=pIter.next();
      result=findGenPackageHelper(genPackage,ePackage);
    }
    if (result == null && !isMainGenModel) {
      result=getMainGenModel().findGenPackage(ePackage);
    }
  }
  ePackageToGenPackageMap.put(ePackage,result);
  return result;
}