Program: 64809
Project: 64809
Buggy source:
/** 
 * Generate mappings for a given TypeInfo.
 * @param info
 * @param descriptor
 * @param namespaceInfo
 */
public void generateMappings(TypeInfo info,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  if (info.isAnonymousComplexType()) {
    generateInheritedMappingsForAnonymousType(info,descriptor,namespaceInfo);
  }
  List<Property> propertiesInOrder=info.getNonTransientPropertiesInPropOrder();
  for (int i=0; i < propertiesInOrder.size(); i++) {
    Property next=propertiesInOrder.get(i);
    if (next != null && (!next.isTransient() || (next.isTransient() && next.isXmlLocation()))) {
      DatabaseMapping mapping=generateMapping(next,descriptor,namespaceInfo);
      if (next.isVirtual()) {
        VirtualAttributeAccessor accessor=new VirtualAttributeAccessor();
        accessor.setAttributeName(mapping.getAttributeName());
        String getMethod=info.getXmlVirtualAccessMethods().getGetMethod();
        String setMethod=info.getXmlVirtualAccessMethods().getSetMethod();
        if (mapping.getAttributeAccessor().isMethodAttributeAccessor()) {
          getMethod=((MethodAttributeAccessor)mapping.getAttributeAccessor()).getGetMethodName();
          setMethod=((MethodAttributeAccessor)mapping.getAttributeAccessor()).getSetMethodName();
          accessor.setValueType(mapping.getAttributeClassification());
        }
        accessor.setGetMethodName(getMethod);
        accessor.setSetMethodName(setMethod);
        if (mapping.getAttributeAccessor() instanceof JAXBArrayAttributeAccessor) {
          JAXBArrayAttributeAccessor jaa=(JAXBArrayAttributeAccessor)mapping.getAttributeAccessor();
          jaa.setNestedAccessor(accessor);
        }
 else {
          mapping.setAttributeAccessor(accessor);
        }
      }
      if (mapping != null) {
        descriptor.addMapping(mapping);
      }
      if (next.isSetUserProperties()) {
        mapping.setProperties(next.getUserProperties());
      }
      JavaClass jClass=helper.getJavaClass(info.getJavaClassName());
      AccessorFactoryWrapper accessorFactory=info.getXmlAccessorFactory();
      if (accessorFactory == null) {
        accessorFactory=info.getPackageLevelXmlAccessorFactory();
      }
      if (accessorFactory != null) {
        try {
          Object accessor=CompilerHelper.createAccessorFor(jClass,next,helper,accessorFactory);
          if (accessor != null) {
            CustomAccessorAttributeAccessor attributeAccessor=new CustomAccessorAttributeAccessor(accessor);
            mapping.setAttributeAccessor(attributeAccessor);
          }
        }
 catch (        Exception ex) {
        }
      }
    }
    next.postInitialize();
  }
}

Fixed version (ground truth):
/** 
 * Generate mappings for a given TypeInfo.
 * @param info
 * @param descriptor
 * @param namespaceInfo
 */
public void generateMappings(TypeInfo info,XMLDescriptor descriptor,JavaClass descriptorJavaClass,NamespaceInfo namespaceInfo){
  if (info.isAnonymousComplexType()) {
    generateInheritedMappingsForAnonymousType(info,descriptor,descriptorJavaClass,namespaceInfo);
  }
  List<Property> propertiesInOrder=info.getNonTransientPropertiesInPropOrder();
  for (int i=0; i < propertiesInOrder.size(); i++) {
    Property next=propertiesInOrder.get(i);
    if (next != null && (!next.isTransient() || (next.isTransient() && next.isXmlLocation()))) {
      DatabaseMapping mapping=generateMapping(next,descriptor,descriptorJavaClass,namespaceInfo);
      if (next.isVirtual()) {
        VirtualAttributeAccessor accessor=new VirtualAttributeAccessor();
        accessor.setAttributeName(mapping.getAttributeName());
        String getMethod=info.getXmlVirtualAccessMethods().getGetMethod();
        String setMethod=info.getXmlVirtualAccessMethods().getSetMethod();
        if (mapping.getAttributeAccessor().isMethodAttributeAccessor()) {
          getMethod=((MethodAttributeAccessor)mapping.getAttributeAccessor()).getGetMethodName();
          setMethod=((MethodAttributeAccessor)mapping.getAttributeAccessor()).getSetMethodName();
          accessor.setValueType(mapping.getAttributeClassification());
        }
        accessor.setGetMethodName(getMethod);
        accessor.setSetMethodName(setMethod);
        if (mapping.getAttributeAccessor() instanceof JAXBArrayAttributeAccessor) {
          JAXBArrayAttributeAccessor jaa=(JAXBArrayAttributeAccessor)mapping.getAttributeAccessor();
          jaa.setNestedAccessor(accessor);
        }
 else {
          mapping.setAttributeAccessor(accessor);
        }
      }
      if (mapping != null) {
        descriptor.addMapping(mapping);
      }
      if (next.isSetUserProperties()) {
        mapping.setProperties(next.getUserProperties());
      }
      AccessorFactoryWrapper accessorFactory=info.getXmlAccessorFactory();
      if (accessorFactory == null) {
        accessorFactory=info.getPackageLevelXmlAccessorFactory();
      }
      if (accessorFactory != null) {
        try {
          Object accessor=CompilerHelper.createAccessorFor(descriptorJavaClass,next,helper,accessorFactory);
          if (accessor != null) {
            CustomAccessorAttributeAccessor attributeAccessor=new CustomAccessorAttributeAccessor(accessor);
            mapping.setAttributeAccessor(attributeAccessor);
          }
        }
 catch (        Exception ex) {
        }
      }
    }
    next.postInitialize();
  }
}