Program: 65870
Project: 65870
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) {
      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);
        }
      }
      descriptor.addMapping(mapping);
      if (next.isSetUserProperties()) {
        mapping.setProperties(next.getUserProperties());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * 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()) {
      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);
        }
      }
      descriptor.addMapping(mapping);
      if (next.isSetUserProperties()) {
        mapping.setProperties(next.getUserProperties());
      }
    }
  }
}