Program: 63365
Project: 63365
Buggy source:
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preLogin(SessionEvent event){
  Project project=event.getSession().getProject();
  ClassLoader cl=jpaSession.getDatasourcePlatform().getConversionManager().getLoader();
  DefaultXMLNameTransformer xmlNameTransformer=new DefaultXMLNameTransformer();
  for (  Object descriptorAlias : project.getAliasDescriptors().keySet()) {
    ClassDescriptor descriptor=(ClassDescriptor)project.getAliasDescriptors().get(descriptorAlias);
    if (!PersistenceWeavedRest.class.isAssignableFrom(descriptor.getJavaClass())) {
      continue;
    }
    if (descriptor.isXMLDescriptor()) {
      XMLDescriptor xmlDescriptor=(XMLDescriptor)project.getAliasDescriptors().get(descriptorAlias);
      if (null != xmlDescriptor) {
        if (null == xmlDescriptor.getDefaultRootElement()) {
          xmlDescriptor.setDefaultRootElement(xmlNameTransformer.transformRootElementName(xmlDescriptor.getJavaClass().getName()));
          xmlDescriptor.setResultAlwaysXMLRoot(false);
        }
      }
    }
    XMLCompositeCollectionMapping relationshipMapping=new XMLCompositeCollectionMapping();
    relationshipMapping.setAttributeName("String_Node_Str");
    relationshipMapping.setGetMethodName("String_Node_Str");
    relationshipMapping.setSetMethodName("String_Node_Str");
    relationshipMapping.setDescriptor(descriptor);
    CollectionContainerPolicy containerPolicy=new CollectionContainerPolicy(ArrayList.class);
    relationshipMapping.setContainerPolicy(containerPolicy);
    relationshipMapping.setField(new XMLField("String_Node_Str"));
    relationshipMapping.setReferenceClass(Link.class);
    XMLJavaTypeConverter converter=new XMLJavaTypeConverter(RelationshipLinkAdapter.class);
    converter.initialize(relationshipMapping,event.getSession());
    relationshipMapping.setConverter(converter);
    descriptor.addMapping(relationshipMapping);
    XMLCompositeObjectMapping hrefMapping=new XMLCompositeObjectMapping();
    hrefMapping.setAttributeName("String_Node_Str");
    hrefMapping.setGetMethodName("String_Node_Str");
    hrefMapping.setSetMethodName("String_Node_Str");
    hrefMapping.setDescriptor(descriptor);
    hrefMapping.setField(new XMLField("String_Node_Str"));
    hrefMapping.setReferenceClass(Link.class);
    hrefMapping.setXPath("String_Node_Str");
    descriptor.addMapping(hrefMapping);
    XMLCompositeObjectMapping itemLinksMapping=new XMLCompositeObjectMapping();
    itemLinksMapping.setAttributeName("String_Node_Str");
    itemLinksMapping.setGetMethodName("String_Node_Str");
    itemLinksMapping.setSetMethodName("String_Node_Str");
    itemLinksMapping.setDescriptor(descriptor);
    itemLinksMapping.setReferenceClass(ItemLinks.class);
    itemLinksMapping.setXPath("String_Node_Str");
    descriptor.addMapping(itemLinksMapping);
    ClassDescriptor jpaDescriptor=jpaSession.getDescriptorForAlias(descriptor.getAlias());
    Vector<DatabaseMapping> descriptorMappings=(Vector<DatabaseMapping>)descriptor.getMappings().clone();
    for (    DatabaseMapping mapping : descriptorMappings) {
      if (mapping.isXMLMapping()) {
        if (mapping.isAbstractCompositeObjectMapping() || mapping.isAbstractCompositeCollectionMapping()) {
          if (mapping.isAbstractCompositeCollectionMapping()) {
            XMLInverseReferenceMapping inverseMapping=((XMLCompositeCollectionMapping)mapping).getInverseReferenceMapping();
            if (inverseMapping != null) {
              break;
            }
          }
 else           if (mapping.isAbstractCompositeObjectMapping()) {
            XMLInverseReferenceMapping inverseMapping=((XMLCompositeObjectMapping)mapping).getInverseReferenceMapping();
            if (inverseMapping != null) {
              break;
            }
          }
          if (jpaDescriptor != null) {
            DatabaseMapping dbMapping=jpaDescriptor.getMappingForAttributeName(mapping.getAttributeName());
            if ((dbMapping != null) && (dbMapping instanceof ForeignReferenceMapping)) {
              ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
              if (jpaMapping != null) {
                if (jpaMapping.getMappedBy() != null) {
                  ClassDescriptor inverseDescriptor=project.getDescriptorForAlias(jpaMapping.getReferenceDescriptor().getAlias());
                  if (inverseDescriptor != null) {
                    DatabaseMapping inverseMapping=inverseDescriptor.getMappingForAttributeName(jpaMapping.getMappedBy());
                    if (inverseMapping != null) {
                      convertMappingToXMLInverseReferenceMapping(inverseDescriptor,inverseMapping,jpaMapping);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    InheritancePolicy inheritancePolicy=descriptor.getInheritancePolicyOrNull();
    if ((inheritancePolicy != null) && (inheritancePolicy.isRootParentDescriptor())) {
      boolean isAbstract=Modifier.isAbstract(descriptor.getJavaClass().getModifiers());
      if (isAbstract) {
        Class subClassToInstantiate=null;
        Map<?,?> classIndicatorMapping=inheritancePolicy.getClassIndicatorMapping();
        for (        Map.Entry<?,?> entry : classIndicatorMapping.entrySet()) {
          Object value=entry.getValue();
          if (value instanceof Class) {
            subClassToInstantiate=(Class)value;
            isAbstract=Modifier.isAbstract(subClassToInstantiate.getModifiers());
            if ((subClassToInstantiate != null) && (!isAbstract)) {
              InstantiationPolicy instantiationPolicy=new InstantiationPolicy();
              instantiationPolicy.useFactoryInstantiationPolicy(new ConcreteSubclassFactory(subClassToInstantiate),"String_Node_Str");
              descriptor.setInstantiationPolicy(instantiationPolicy);
              break;
            }
          }
        }
      }
    }
  }
  for (  Object descriptorAlias : project.getAliasDescriptors().keySet()) {
    ClassDescriptor descriptor=(ClassDescriptor)project.getAliasDescriptors().get(descriptorAlias);
    ClassDescriptor jpaDescriptor=jpaSession.getDescriptorForAlias(descriptor.getAlias());
    Vector<DatabaseMapping> descriptorMappings=(Vector<DatabaseMapping>)descriptor.getMappings().clone();
    for (    DatabaseMapping mapping : descriptorMappings) {
      if (mapping.isXMLMapping()) {
        if (mapping.isAbstractCompositeObjectMapping() || mapping.isAbstractCompositeCollectionMapping()) {
          if (jpaDescriptor != null) {
            DatabaseMapping dbMapping=jpaDescriptor.getMappingForAttributeName(mapping.getAttributeName());
            if ((dbMapping instanceof ForeignReferenceMapping)) {
              ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
              ClassDescriptor jaxbDescriptor=project.getDescriptorForAlias(jpaMapping.getDescriptor().getAlias());
              convertMappingToXMLChoiceMapping(jaxbDescriptor,jpaMapping,cl,jpaSession);
            }
          }
 else           if (mapping instanceof XMLCompositeObjectMapping) {
            XMLCompositeObjectMapping jpaMapping=(XMLCompositeObjectMapping)mapping;
            ClassDescriptor jaxbDescriptor=project.getDescriptorForAlias(jpaMapping.getDescriptor().getAlias());
            if (jaxbDescriptor != null) {
              Class clazz=jpaMapping.getReferenceClass();
              if (clazz != null) {
                if ((jpaSession.getDescriptor(clazz) != null) && (jpaSession.getDescriptor(clazz).isEISDescriptor()))                 convertMappingToXMLChoiceMapping(jaxbDescriptor,jpaMapping,cl,jpaSession);
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preLogin(SessionEvent event){
  Project project=event.getSession().getProject();
  ClassLoader cl=jpaSession.getDatasourcePlatform().getConversionManager().getLoader();
  DefaultXMLNameTransformer xmlNameTransformer=new DefaultXMLNameTransformer();
  for (  Object descriptorAlias : project.getAliasDescriptors().keySet()) {
    ClassDescriptor descriptor=(ClassDescriptor)project.getAliasDescriptors().get(descriptorAlias);
    if (!PersistenceWeavedRest.class.isAssignableFrom(descriptor.getJavaClass())) {
      continue;
    }
    if (descriptor.isXMLDescriptor()) {
      XMLDescriptor xmlDescriptor=(XMLDescriptor)project.getAliasDescriptors().get(descriptorAlias);
      if (null != xmlDescriptor) {
        if (null == xmlDescriptor.getDefaultRootElement()) {
          xmlDescriptor.setDefaultRootElement(xmlNameTransformer.transformRootElementName(xmlDescriptor.getJavaClass().getName()));
          xmlDescriptor.setResultAlwaysXMLRoot(false);
        }
      }
    }
    XMLCompositeCollectionMapping relationshipMapping=new XMLCompositeCollectionMapping();
    relationshipMapping.setAttributeName("String_Node_Str");
    relationshipMapping.setGetMethodName("String_Node_Str");
    relationshipMapping.setSetMethodName("String_Node_Str");
    relationshipMapping.setDescriptor(descriptor);
    CollectionContainerPolicy containerPolicy=new CollectionContainerPolicy(ArrayList.class);
    relationshipMapping.setContainerPolicy(containerPolicy);
    relationshipMapping.setField(new XMLField("String_Node_Str"));
    relationshipMapping.setReferenceClass(Link.class);
    XMLJavaTypeConverter converter=new XMLJavaTypeConverter(RelationshipLinkAdapter.class);
    converter.initialize(relationshipMapping,event.getSession());
    relationshipMapping.setConverter(converter);
    descriptor.addMapping(relationshipMapping);
    XMLCompositeObjectMapping hrefMapping=new XMLCompositeObjectMapping();
    hrefMapping.setAttributeName("String_Node_Str");
    hrefMapping.setGetMethodName("String_Node_Str");
    hrefMapping.setSetMethodName("String_Node_Str");
    hrefMapping.setDescriptor(descriptor);
    hrefMapping.setField(new XMLField("String_Node_Str"));
    hrefMapping.setReferenceClass(Link.class);
    hrefMapping.setXPath("String_Node_Str");
    descriptor.addMapping(hrefMapping);
    XMLCompositeObjectMapping itemLinksMapping=new XMLCompositeObjectMapping();
    itemLinksMapping.setAttributeName("String_Node_Str");
    itemLinksMapping.setGetMethodName("String_Node_Str");
    itemLinksMapping.setSetMethodName("String_Node_Str");
    itemLinksMapping.setDescriptor(descriptor);
    itemLinksMapping.setReferenceClass(ItemLinks.class);
    itemLinksMapping.setXPath("String_Node_Str");
    descriptor.addMapping(itemLinksMapping);
    ClassDescriptor jpaDescriptor=jpaSession.getDescriptorForAlias(descriptor.getAlias());
    Vector<DatabaseMapping> descriptorMappings=(Vector<DatabaseMapping>)descriptor.getMappings().clone();
    for (    DatabaseMapping mapping : descriptorMappings) {
      if (mapping.isXMLMapping()) {
        if (mapping.isAbstractCompositeObjectMapping() || mapping.isAbstractCompositeCollectionMapping()) {
          if (mapping.isAbstractCompositeCollectionMapping()) {
            XMLInverseReferenceMapping inverseMapping=((XMLCompositeCollectionMapping)mapping).getInverseReferenceMapping();
            if (inverseMapping != null) {
              break;
            }
          }
 else           if (mapping.isAbstractCompositeObjectMapping()) {
            XMLInverseReferenceMapping inverseMapping=((XMLCompositeObjectMapping)mapping).getInverseReferenceMapping();
            if (inverseMapping != null) {
              break;
            }
          }
          if (jpaDescriptor != null) {
            DatabaseMapping dbMapping=jpaDescriptor.getMappingForAttributeName(mapping.getAttributeName());
            if ((dbMapping != null) && (dbMapping instanceof ForeignReferenceMapping)) {
              ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
              if (jpaMapping.getMappedBy() != null) {
                ClassDescriptor inverseDescriptor=project.getDescriptorForAlias(jpaMapping.getReferenceDescriptor().getAlias());
                if (inverseDescriptor != null) {
                  DatabaseMapping inverseMapping=inverseDescriptor.getMappingForAttributeName(jpaMapping.getMappedBy());
                  if (inverseMapping != null) {
                    convertMappingToXMLInverseReferenceMapping(inverseDescriptor,inverseMapping,jpaMapping);
                  }
                }
              }
            }
          }
        }
      }
    }
    InheritancePolicy inheritancePolicy=descriptor.getInheritancePolicyOrNull();
    if ((inheritancePolicy != null) && (inheritancePolicy.isRootParentDescriptor())) {
      boolean isAbstract=Modifier.isAbstract(descriptor.getJavaClass().getModifiers());
      if (isAbstract) {
        Class subClassToInstantiate=null;
        Map<?,?> classIndicatorMapping=inheritancePolicy.getClassIndicatorMapping();
        for (        Map.Entry<?,?> entry : classIndicatorMapping.entrySet()) {
          Object value=entry.getValue();
          if (value instanceof Class) {
            subClassToInstantiate=(Class)value;
            isAbstract=Modifier.isAbstract(subClassToInstantiate.getModifiers());
            if (!isAbstract) {
              InstantiationPolicy instantiationPolicy=new InstantiationPolicy();
              instantiationPolicy.useFactoryInstantiationPolicy(new ConcreteSubclassFactory(subClassToInstantiate),"String_Node_Str");
              descriptor.setInstantiationPolicy(instantiationPolicy);
              break;
            }
          }
        }
      }
    }
  }
  for (  Object descriptorAlias : project.getAliasDescriptors().keySet()) {
    ClassDescriptor descriptor=(ClassDescriptor)project.getAliasDescriptors().get(descriptorAlias);
    ClassDescriptor jpaDescriptor=jpaSession.getDescriptorForAlias(descriptor.getAlias());
    Vector<DatabaseMapping> descriptorMappings=(Vector<DatabaseMapping>)descriptor.getMappings().clone();
    for (    DatabaseMapping mapping : descriptorMappings) {
      if (mapping.isXMLMapping()) {
        if (mapping.isAbstractCompositeObjectMapping() || mapping.isAbstractCompositeCollectionMapping()) {
          if (jpaDescriptor != null) {
            DatabaseMapping dbMapping=jpaDescriptor.getMappingForAttributeName(mapping.getAttributeName());
            if ((dbMapping instanceof ForeignReferenceMapping)) {
              ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
              ClassDescriptor jaxbDescriptor=project.getDescriptorForAlias(jpaMapping.getDescriptor().getAlias());
              convertMappingToXMLChoiceMapping(jaxbDescriptor,jpaMapping,cl,jpaSession);
            }
          }
 else           if (mapping instanceof XMLCompositeObjectMapping) {
            XMLCompositeObjectMapping jpaMapping=(XMLCompositeObjectMapping)mapping;
            ClassDescriptor jaxbDescriptor=project.getDescriptorForAlias(jpaMapping.getDescriptor().getAlias());
            if (jaxbDescriptor != null) {
              Class clazz=jpaMapping.getReferenceClass();
              if (clazz != null) {
                if ((jpaSession.getDescriptor(clazz) != null) && (jpaSession.getDescriptor(clazz).isEISDescriptor()))                 convertMappingToXMLChoiceMapping(jaxbDescriptor,jpaMapping,cl,jpaSession);
              }
            }
          }
        }
      }
    }
  }
}