Program: 67667
Project: 67667
Buggy source:
public void generateMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  if (property.getAdapterClass() != null) {
    JavaClass adapterClass=property.getAdapterClass();
    JavaClass valueType=helper.getJavaClass(Object.class);
    for (    JavaMethod method : new ArrayList<JavaMethod>(adapterClass.getDeclaredMethods())) {
      if (method.getName().equals("String_Node_Str")) {
        JavaClass returnType=(JavaClass)method.getReturnType();
        if (!returnType.getQualifiedName().equals(valueType.getQualifiedName())) {
          valueType=returnType;
          break;
        }
      }
    }
    if (typeInfo.containsKey(valueType.getQualifiedName())) {
      if (isCollectionType(property)) {
        generateCompositeCollectionMapping(property,descriptor,namespaceInfo,valueType).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
      }
 else {
        generateCompositeObjectMapping(property,descriptor,namespaceInfo,valueType).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
      }
    }
 else {
      if (isCollectionType(property)) {
        generateDirectCollectionMapping(property,descriptor,namespaceInfo).setValueConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
      }
 else {
        if (property.isSwaAttachmentRef() || property.isMtomAttachment()) {
          generateBinaryMapping(property,descriptor,namespaceInfo).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
        }
 else {
          generateDirectMapping(property,descriptor,namespaceInfo).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
        }
      }
    }
    return;
  }
  if (property.isChoice()) {
    if (this.isCollectionType(property)) {
      generateChoiceCollectionMapping(property,descriptor,namespaceInfo);
    }
 else {
      generateChoiceMapping(property,descriptor,namespaceInfo);
    }
  }
 else   if (property.isAny()) {
    generateAnyCollectionMapping(property,descriptor,namespaceInfo);
  }
 else   if (property.isReference()) {
    if (this.isCollectionType(property)) {
      generateCollectionMappingForReferenceProperty((ReferenceProperty)property,descriptor,namespaceInfo);
    }
 else {
      generateMappingForReferenceProperty((ReferenceProperty)property,descriptor,namespaceInfo);
    }
  }
 else   if (isMapType(property) && helper.isAnnotationPresent(property.getElement(),XmlAnyAttribute.class)) {
    generateAnyAttributeMapping(property,descriptor,namespaceInfo);
  }
 else   if (isCollectionType(property)) {
    generateCollectionMapping(property,descriptor,namespaceInfo);
  }
 else {
    JavaClass referenceClass=property.getType();
    TypeInfo reference=typeInfo.get(referenceClass.getQualifiedName());
    if (reference != null) {
      if (helper.isAnnotationPresent(property.getElement(),XmlIDREF.class)) {
        generateXMLObjectReferenceMapping(property,descriptor,namespaceInfo,referenceClass);
      }
 else {
        if (reference.isEnumerationType()) {
          generateDirectEnumerationMapping(property,descriptor,namespaceInfo,(EnumTypeInfo)reference);
        }
 else {
          generateCompositeObjectMapping(property,descriptor,namespaceInfo,referenceClass);
        }
      }
    }
 else {
      if (property.isSwaAttachmentRef() || property.isMtomAttachment()) {
        generateBinaryMapping(property,descriptor,namespaceInfo);
      }
 else {
        if (referenceClass.getQualifiedName().equals("String_Node_Str")) {
          generateAnyObjectMapping(property,descriptor,namespaceInfo);
        }
 else {
          generateDirectMapping(property,descriptor,namespaceInfo);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void generateMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  if (property.getAdapterClass() != null) {
    JavaClass adapterClass=property.getAdapterClass();
    JavaClass valueType=helper.getJavaClass(Object.class);
    for (    JavaMethod method : new ArrayList<JavaMethod>(adapterClass.getDeclaredMethods())) {
      if (method.getName().equals("String_Node_Str")) {
        JavaClass returnType=(JavaClass)method.getReturnType();
        if (!returnType.getQualifiedName().equals(valueType.getQualifiedName())) {
          valueType=returnType;
          break;
        }
      }
    }
    if (typeInfo.containsKey(valueType.getQualifiedName())) {
      if (isCollectionType(property)) {
        generateCompositeCollectionMapping(property,descriptor,namespaceInfo,valueType).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
      }
 else {
        generateCompositeObjectMapping(property,descriptor,namespaceInfo,valueType).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
      }
    }
 else {
      if (isCollectionType(property)) {
        generateDirectCollectionMapping(property,descriptor,namespaceInfo).setValueConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
      }
 else {
        if (property.isSwaAttachmentRef() || property.isMtomAttachment()) {
          generateBinaryMapping(property,descriptor,namespaceInfo).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
        }
 else {
          generateDirectMapping(property,descriptor,namespaceInfo).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
        }
      }
    }
    return;
  }
  if (property.isChoice()) {
    if (this.isCollectionType(property)) {
      generateChoiceCollectionMapping(property,descriptor,namespaceInfo);
    }
 else {
      generateChoiceMapping(property,descriptor,namespaceInfo);
    }
  }
 else   if (property.isAny()) {
    if (isCollectionType(property)) {
      generateAnyCollectionMapping(property,descriptor,namespaceInfo);
    }
 else {
      generateAnyObjectMapping(property,descriptor,namespaceInfo);
    }
  }
 else   if (property.isReference()) {
    if (this.isCollectionType(property)) {
      generateCollectionMappingForReferenceProperty((ReferenceProperty)property,descriptor,namespaceInfo);
    }
 else {
      generateMappingForReferenceProperty((ReferenceProperty)property,descriptor,namespaceInfo);
    }
  }
 else   if (isMapType(property) && helper.isAnnotationPresent(property.getElement(),XmlAnyAttribute.class)) {
    generateAnyAttributeMapping(property,descriptor,namespaceInfo);
  }
 else   if (isCollectionType(property)) {
    generateCollectionMapping(property,descriptor,namespaceInfo);
  }
 else {
    JavaClass referenceClass=property.getType();
    TypeInfo reference=typeInfo.get(referenceClass.getQualifiedName());
    if (reference != null) {
      if (helper.isAnnotationPresent(property.getElement(),XmlIDREF.class)) {
        generateXMLObjectReferenceMapping(property,descriptor,namespaceInfo,referenceClass);
      }
 else {
        if (reference.isEnumerationType()) {
          generateDirectEnumerationMapping(property,descriptor,namespaceInfo,(EnumTypeInfo)reference);
        }
 else {
          generateCompositeObjectMapping(property,descriptor,namespaceInfo,referenceClass);
        }
      }
    }
 else {
      if (property.isSwaAttachmentRef() || property.isMtomAttachment()) {
        generateBinaryMapping(property,descriptor,namespaceInfo);
      }
 else {
        if (referenceClass.getQualifiedName().equals("String_Node_Str")) {
          generateAnyObjectMapping(property,descriptor,namespaceInfo);
        }
 else {
          generateDirectMapping(property,descriptor,namespaceInfo);
        }
      }
    }
  }
}