Program: 64092
Project: 64092
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preLogin(SessionEvent event){
  Project project=event.getSession().getProject();
  ClassLoader cl=jpaSession.getDatasourcePlatform().getConversionManager().getLoader();
  for (  Object descriptorAlias : project.getAliasDescriptors().keySet()) {
    ClassDescriptor descriptor=(ClassDescriptor)project.getAliasDescriptors().get(descriptorAlias);
    Class<?> descriptorClass=descriptor.getJavaClass();
    if (PersistenceWeavedRest.class.isAssignableFrom(descriptorClass)) {
      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);
    }
    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.getAttributeName());
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    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 != null) && (dbMapping instanceof ForeignReferenceMapping)) {
              ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
              if (jpaMapping != null) {
                ClassDescriptor jaxbDescriptor=project.getDescriptorForAlias(jpaMapping.getDescriptor().getAlias());
                if (jaxbDescriptor != null) {
                  convertMappingToXMLChoiceMapping(jaxbDescriptor,jpaMapping,cl);
                }
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preLogin(SessionEvent event){
  Project project=event.getSession().getProject();
  ClassLoader cl=jpaSession.getDatasourcePlatform().getConversionManager().getLoader();
  for (  Object descriptorAlias : project.getAliasDescriptors().keySet()) {
    ClassDescriptor descriptor=(ClassDescriptor)project.getAliasDescriptors().get(descriptorAlias);
    Class<?> descriptorClass=descriptor.getJavaClass();
    if (PersistenceWeavedRest.class.isAssignableFrom(descriptorClass)) {
      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);
    }
    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.getAttributeName());
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    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 != null) && (dbMapping instanceof ForeignReferenceMapping)) {
              ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
              if (jpaMapping != null) {
                ClassDescriptor jaxbDescriptor=project.getDescriptorForAlias(jpaMapping.getDescriptor().getAlias());
                if (jaxbDescriptor != null) {
                  convertMappingToXMLChoiceMapping(jaxbDescriptor,jpaMapping,cl,jpaSession);
                }
              }
            }
          }
        }
      }
    }
  }
}