Program: 66390
Project: 66390
Buggy source:
protected ClassDescriptor buildDirectCollectionMappingDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(DirectCollectionMapping.class);
  descriptor.getInheritancePolicy().setParentClass(DatabaseMapping.class);
  XMLDirectMapping usesBatchReadingMapping=new XMLDirectMapping();
  usesBatchReadingMapping.setAttributeName("String_Node_Str");
  usesBatchReadingMapping.setGetMethodName("String_Node_Str");
  usesBatchReadingMapping.setSetMethodName("String_Node_Str");
  usesBatchReadingMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  usesBatchReadingMapping.setNullValue(Boolean.FALSE);
  descriptor.addMapping(usesBatchReadingMapping);
  XMLCompositeObjectMapping containerPolicyMapping=new XMLCompositeObjectMapping();
  containerPolicyMapping.setAttributeName("String_Node_Str");
  containerPolicyMapping.setGetMethodName("String_Node_Str");
  containerPolicyMapping.setSetMethodName("String_Node_Str");
  containerPolicyMapping.setReferenceClass(ContainerPolicy.class);
  containerPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(containerPolicyMapping);
  XMLCompositeObjectMapping indirectionPolicyMapping=new XMLCompositeObjectMapping();
  indirectionPolicyMapping.setReferenceClass(IndirectionPolicy.class);
  indirectionPolicyMapping.setAttributeAccessor(new AttributeAccessor(){
    public Object getAttributeValueFromObject(    Object object){
      IndirectionPolicy policy=((ForeignReferenceMapping)object).getIndirectionPolicy();
      if (policy instanceof NoIndirectionPolicy) {
        return null;
      }
      return policy;
    }
    public void setAttributeValueInObject(    Object object,    Object value){
      IndirectionPolicy policy=(IndirectionPolicy)value;
      if (value == null) {
        policy=new NoIndirectionPolicy();
      }
      ((ForeignReferenceMapping)object).setIndirectionPolicy(policy);
    }
  }
);
  indirectionPolicyMapping.setAttributeName("String_Node_Str");
  indirectionPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(indirectionPolicyMapping);
  XMLCompositeObjectMapping selectionQueryMapping=new XMLCompositeObjectMapping();
  selectionQueryMapping.setAttributeName("String_Node_Str");
  selectionQueryMapping.setGetMethodName("String_Node_Str");
  selectionQueryMapping.setSetMethodName("String_Node_Str");
  selectionQueryMapping.setReferenceClass(ReadQuery.class);
  selectionQueryMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(selectionQueryMapping);
  XMLDirectMapping referenceTableMapping=new XMLDirectMapping();
  referenceTableMapping.setAttributeName("String_Node_Str");
  referenceTableMapping.setGetMethodName("String_Node_Str");
  referenceTableMapping.setSetMethodName("String_Node_Str");
  referenceTableMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(referenceTableMapping);
  XMLCompositeObjectMapping directFieldMapping=new XMLCompositeObjectMapping();
  directFieldMapping.setAttributeName("String_Node_Str");
  directFieldMapping.setGetMethodName("String_Node_Str");
  directFieldMapping.setSetMethodName("String_Node_Str");
  directFieldMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  directFieldMapping.setReferenceClass(DatabaseField.class);
  descriptor.addMapping(directFieldMapping);
  XMLCompositeCollectionMapping sourceToReferenceKeyFieldAssociationsMapping=new XMLCompositeCollectionMapping();
  sourceToReferenceKeyFieldAssociationsMapping.setReferenceClass(Association.class);
  sourceToReferenceKeyFieldAssociationsMapping.setAttributeAccessor(new AttributeAccessor(){
    public Object getAttributeValueFromObject(    Object object){
      List sourceFields=((DirectCollectionMapping)object).getSourceKeyFields();
      List referenceFields=((DirectCollectionMapping)object).getReferenceKeyFields();
      List associations=new ArrayList(sourceFields.size());
      for (int index=0; index < sourceFields.size(); index++) {
        associations.add(new Association(referenceFields.get(index),sourceFields.get(index)));
      }
      return associations;
    }
    public void setAttributeValueInObject(    Object object,    Object value){
      DirectCollectionMapping mapping=(DirectCollectionMapping)object;
      List associations=(List)value;
      mapping.setSourceKeyFields(NonSynchronizedVector.newInstance(associations.size()));
      mapping.setReferenceKeyFields(NonSynchronizedVector.newInstance(associations.size()));
      Iterator iterator=associations.iterator();
      while (iterator.hasNext()) {
        Association association=(Association)iterator.next();
        mapping.getSourceKeyFields().add((DatabaseField)association.getValue());
        mapping.getReferenceKeyFields().add((DatabaseField)association.getKey());
      }
    }
  }
);
  sourceToReferenceKeyFieldAssociationsMapping.setAttributeName("String_Node_Str");
  sourceToReferenceKeyFieldAssociationsMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str" + getSecondaryNamespaceXPath()+ "String_Node_Str");
  descriptor.addMapping(sourceToReferenceKeyFieldAssociationsMapping);
  XMLCompositeObjectMapping valueConverterMapping=new XMLCompositeObjectMapping();
  valueConverterMapping.setAttributeName("String_Node_Str");
  valueConverterMapping.setGetMethodName("String_Node_Str");
  valueConverterMapping.setSetMethodName("String_Node_Str");
  valueConverterMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  valueConverterMapping.setReferenceClass(Converter.class);
  descriptor.addMapping(valueConverterMapping);
  XMLCompositeObjectMapping historyPolicyMapping=new XMLCompositeObjectMapping();
  historyPolicyMapping.setAttributeName("String_Node_Str");
  historyPolicyMapping.setGetMethodName("String_Node_Str");
  historyPolicyMapping.setSetMethodName("String_Node_Str");
  historyPolicyMapping.setReferenceClass(HistoryPolicy.class);
  historyPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(historyPolicyMapping);
  return descriptor;
}

Fixed version (ground truth):
protected ClassDescriptor buildDirectCollectionMappingDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(DirectCollectionMapping.class);
  descriptor.getInheritancePolicy().setParentClass(DatabaseMapping.class);
  XMLDirectMapping usesBatchReadingMapping=new XMLDirectMapping();
  usesBatchReadingMapping.setAttributeName("String_Node_Str");
  usesBatchReadingMapping.setGetMethodName("String_Node_Str");
  usesBatchReadingMapping.setSetMethodName("String_Node_Str");
  usesBatchReadingMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  usesBatchReadingMapping.setNullValue(Boolean.FALSE);
  descriptor.addMapping(usesBatchReadingMapping);
  XMLCompositeObjectMapping containerPolicyMapping=new XMLCompositeObjectMapping();
  containerPolicyMapping.setAttributeName("String_Node_Str");
  containerPolicyMapping.setGetMethodName("String_Node_Str");
  containerPolicyMapping.setSetMethodName("String_Node_Str");
  containerPolicyMapping.setReferenceClass(ContainerPolicy.class);
  containerPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(containerPolicyMapping);
  XMLCompositeObjectMapping indirectionPolicyMapping=new XMLCompositeObjectMapping();
  indirectionPolicyMapping.setReferenceClass(IndirectionPolicy.class);
  indirectionPolicyMapping.setAttributeAccessor(new AttributeAccessor(){
    public Object getAttributeValueFromObject(    Object object){
      IndirectionPolicy policy=((ForeignReferenceMapping)object).getIndirectionPolicy();
      if (policy instanceof NoIndirectionPolicy) {
        return null;
      }
      return policy;
    }
    public void setAttributeValueInObject(    Object object,    Object value){
      IndirectionPolicy policy=(IndirectionPolicy)value;
      if (value == null) {
        policy=new NoIndirectionPolicy();
      }
      ((ForeignReferenceMapping)object).setIndirectionPolicy(policy);
    }
  }
);
  indirectionPolicyMapping.setAttributeName("String_Node_Str");
  indirectionPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(indirectionPolicyMapping);
  XMLCompositeObjectMapping selectionQueryMapping=new XMLCompositeObjectMapping();
  selectionQueryMapping.setAttributeName("String_Node_Str");
  selectionQueryMapping.setGetMethodName("String_Node_Str");
  selectionQueryMapping.setSetMethodName("String_Node_Str");
  selectionQueryMapping.setReferenceClass(ReadQuery.class);
  selectionQueryMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(selectionQueryMapping);
  XMLDirectMapping referenceTableMapping=new XMLDirectMapping();
  referenceTableMapping.setAttributeName("String_Node_Str");
  referenceTableMapping.setGetMethodName("String_Node_Str");
  referenceTableMapping.setSetMethodName("String_Node_Str");
  referenceTableMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(referenceTableMapping);
  XMLCompositeObjectMapping directFieldMapping=new XMLCompositeObjectMapping();
  directFieldMapping.setAttributeName("String_Node_Str");
  directFieldMapping.setGetMethodName("String_Node_Str");
  directFieldMapping.setSetMethodName("String_Node_Str");
  directFieldMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  directFieldMapping.setReferenceClass(DatabaseField.class);
  ((XMLField)directFieldMapping.getField()).setLeafElementType(fieldQname);
  descriptor.addMapping(directFieldMapping);
  XMLCompositeCollectionMapping sourceToReferenceKeyFieldAssociationsMapping=new XMLCompositeCollectionMapping();
  sourceToReferenceKeyFieldAssociationsMapping.setReferenceClass(Association.class);
  sourceToReferenceKeyFieldAssociationsMapping.setAttributeAccessor(new AttributeAccessor(){
    public Object getAttributeValueFromObject(    Object object){
      List sourceFields=((DirectCollectionMapping)object).getSourceKeyFields();
      List referenceFields=((DirectCollectionMapping)object).getReferenceKeyFields();
      List associations=new ArrayList(sourceFields.size());
      for (int index=0; index < sourceFields.size(); index++) {
        associations.add(new Association(referenceFields.get(index),sourceFields.get(index)));
      }
      return associations;
    }
    public void setAttributeValueInObject(    Object object,    Object value){
      DirectCollectionMapping mapping=(DirectCollectionMapping)object;
      List associations=(List)value;
      mapping.setSourceKeyFields(NonSynchronizedVector.newInstance(associations.size()));
      mapping.setReferenceKeyFields(NonSynchronizedVector.newInstance(associations.size()));
      Iterator iterator=associations.iterator();
      while (iterator.hasNext()) {
        Association association=(Association)iterator.next();
        mapping.getSourceKeyFields().add((DatabaseField)association.getValue());
        mapping.getReferenceKeyFields().add((DatabaseField)association.getKey());
      }
    }
  }
);
  sourceToReferenceKeyFieldAssociationsMapping.setAttributeName("String_Node_Str");
  sourceToReferenceKeyFieldAssociationsMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str" + getSecondaryNamespaceXPath()+ "String_Node_Str");
  descriptor.addMapping(sourceToReferenceKeyFieldAssociationsMapping);
  XMLCompositeObjectMapping valueConverterMapping=new XMLCompositeObjectMapping();
  valueConverterMapping.setAttributeName("String_Node_Str");
  valueConverterMapping.setGetMethodName("String_Node_Str");
  valueConverterMapping.setSetMethodName("String_Node_Str");
  valueConverterMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  valueConverterMapping.setReferenceClass(Converter.class);
  descriptor.addMapping(valueConverterMapping);
  XMLCompositeObjectMapping historyPolicyMapping=new XMLCompositeObjectMapping();
  historyPolicyMapping.setAttributeName("String_Node_Str");
  historyPolicyMapping.setGetMethodName("String_Node_Str");
  historyPolicyMapping.setSetMethodName("String_Node_Str");
  historyPolicyMapping.setReferenceClass(HistoryPolicy.class);
  historyPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(historyPolicyMapping);
  return descriptor;
}