Program: 64245
Project: 64245
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preLogin(SessionEvent event){
  Project project=event.getSession().getProject();
  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());
                  DatabaseMapping inverseMapping=inverseDescriptor.getMappingForAttributeName(jpaMapping.getMappedBy());
                  convertMappingToXMLInverseReferenceMapping(inverseDescriptor,inverseMapping,jpaMapping.getAttributeName());
                }
              }
            }
          }
        }
      }
    }
    ClassLoader cl=jpaSession.getPlatform().getConversionManager().getLoader();
    for (    DatabaseMapping mapping : descriptorMappings) {
      if (jpaDescriptor != null && mapping.isXMLMapping()) {
        if (mapping.isAbstractCompositeObjectMapping() || mapping.isAbstractCompositeCollectionMapping()) {
          DatabaseMapping dbMapping=jpaDescriptor.getMappingForAttributeName(mapping.getAttributeName());
          if ((dbMapping != null) && (dbMapping instanceof ForeignReferenceMapping)) {
            ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
            if (jpaMapping != null) {
              if (descriptor != null) {
                DatabaseMapping existingMapping=descriptor.getMappingForAttributeName(jpaMapping.getAttributeName());
                if ((existingMapping != null) && (!(existingMapping instanceof XMLInverseReferenceMapping))) {
                  convertMappingToXMLChoiceMapping(descriptor,jpaMapping,cl);
                }
              }
            }
          }
        }
      }
    }
    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;
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preLogin(SessionEvent event){
  Project project=event.getSession().getProject();
  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());
                  DatabaseMapping inverseMapping=inverseDescriptor.getMappingForAttributeName(jpaMapping.getMappedBy());
                  convertMappingToXMLInverseReferenceMapping(inverseDescriptor,inverseMapping,jpaMapping.getAttributeName());
                }
              }
            }
          }
        }
      }
    }
    ClassLoader cl=jpaSession.getDatasourcePlatform().getConversionManager().getLoader();
    for (    DatabaseMapping mapping : descriptorMappings) {
      if (jpaDescriptor != null && mapping.isXMLMapping()) {
        if (mapping.isAbstractCompositeObjectMapping() || mapping.isAbstractCompositeCollectionMapping()) {
          DatabaseMapping dbMapping=jpaDescriptor.getMappingForAttributeName(mapping.getAttributeName());
          if ((dbMapping != null) && (dbMapping instanceof ForeignReferenceMapping)) {
            ForeignReferenceMapping jpaMapping=(ForeignReferenceMapping)dbMapping;
            if (jpaMapping != null) {
              if (descriptor != null) {
                DatabaseMapping existingMapping=descriptor.getMappingForAttributeName(jpaMapping.getAttributeName());
                if ((existingMapping != null) && (!(existingMapping instanceof XMLInverseReferenceMapping))) {
                  convertMappingToXMLChoiceMapping(descriptor,jpaMapping,cl);
                }
              }
            }
          }
        }
      }
    }
    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;
            }
          }
        }
      }
    }
  }
}