Program: 68443
Project: 68443
Buggy source:
protected ClassDescriptor buildOneToOneMappingDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(OneToOneMapping.class);
  descriptor.getInheritancePolicy().setParentClass(ObjectReferenceMapping.class);
  XMLCompositeCollectionMapping sourceToTargetKeyFieldAssociationsMapping=new XMLCompositeCollectionMapping();
  sourceToTargetKeyFieldAssociationsMapping.setReferenceClass(Association.class);
  sourceToTargetKeyFieldAssociationsMapping.setAttributeAccessor(new AttributeAccessor(){
    public Object getAttributeValueFromObject(    Object object){
      Map sourceToTargetKeyFields=((OneToOneMapping)object).getSourceToTargetKeyFields();
      List associations=new ArrayList(sourceToTargetKeyFields.size());
      Iterator iterator=sourceToTargetKeyFields.entrySet().iterator();
      while (iterator.hasNext()) {
        Map.Entry entry=(Map.Entry)iterator.next();
        associations.add(new Association(entry.getKey(),entry.getValue()));
      }
      return associations;
    }
    public void setAttributeValueInObject(    Object object,    Object value){
      OneToOneMapping mapping=(OneToOneMapping)object;
      List associations=(List)value;
      mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1));
      mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1));
      Iterator iterator=associations.iterator();
      while (iterator.hasNext()) {
        Association association=(Association)iterator.next();
        mapping.getSourceToTargetKeyFields().put((DatabaseField)association.getKey(),(DatabaseField)association.getValue());
        mapping.getTargetToSourceKeyFields().put((DatabaseField)association.getValue(),(DatabaseField)association.getKey());
      }
    }
  }
);
  sourceToTargetKeyFieldAssociationsMapping.setAttributeName("String_Node_Str");
  sourceToTargetKeyFieldAssociationsMapping.setXPath(getSecondaryNamespaceXPath() + "String_Node_Str" + getSecondaryNamespaceXPath()+ "String_Node_Str");
  descriptor.addMapping(sourceToTargetKeyFieldAssociationsMapping);
  XMLCompositeCollectionMapping foreignKeyFieldNamesMapping=new XMLCompositeCollectionMapping();
  foreignKeyFieldNamesMapping.useCollectionClass(NonSynchronizedVector.class);
  foreignKeyFieldNamesMapping.setAttributeName("String_Node_Str");
  foreignKeyFieldNamesMapping.setGetMethodName("String_Node_Str");
  foreignKeyFieldNamesMapping.setSetMethodName("String_Node_Str");
  foreignKeyFieldNamesMapping.setXPath(getSecondaryNamespaceXPath() + "String_Node_Str" + getSecondaryNamespaceXPath()+ "String_Node_Str");
  foreignKeyFieldNamesMapping.setReferenceClass(DatabaseField.class);
  descriptor.addMapping(foreignKeyFieldNamesMapping);
  XMLDirectMapping relationshipPartnerAttributeNameMapping=new XMLDirectMapping();
  relationshipPartnerAttributeNameMapping.setAttributeName("String_Node_Str");
  relationshipPartnerAttributeNameMapping.setGetMethodName("String_Node_Str");
  relationshipPartnerAttributeNameMapping.setSetMethodName("String_Node_Str");
  relationshipPartnerAttributeNameMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(relationshipPartnerAttributeNameMapping);
  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);
  XMLDirectMapping usesJoiningMapping=new XMLDirectMapping();
  usesJoiningMapping.setAttributeName("String_Node_Str");
  usesJoiningMapping.setGetMethodName("String_Node_Str");
  usesJoiningMapping.setSetMethodName("String_Node_Str");
  usesJoiningMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  usesJoiningMapping.setNullValue(Boolean.FALSE);
  descriptor.addMapping(usesJoiningMapping);
  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);
  return descriptor;
}

Fixed version (ground truth):
protected ClassDescriptor buildOneToOneMappingDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(OneToOneMapping.class);
  descriptor.getInheritancePolicy().setParentClass(ObjectReferenceMapping.class);
  XMLCompositeCollectionMapping sourceToTargetKeyFieldAssociationsMapping=new XMLCompositeCollectionMapping();
  sourceToTargetKeyFieldAssociationsMapping.setReferenceClass(Association.class);
  sourceToTargetKeyFieldAssociationsMapping.setAttributeAccessor(new AttributeAccessor(){
    public Object getAttributeValueFromObject(    Object object){
      Map sourceToTargetKeyFields=((OneToOneMapping)object).getSourceToTargetKeyFields();
      List associations=new ArrayList(sourceToTargetKeyFields.size());
      Iterator iterator=sourceToTargetKeyFields.entrySet().iterator();
      while (iterator.hasNext()) {
        Map.Entry entry=(Map.Entry)iterator.next();
        associations.add(new Association(entry.getKey(),entry.getValue()));
      }
      return associations;
    }
    public void setAttributeValueInObject(    Object object,    Object value){
      OneToOneMapping mapping=(OneToOneMapping)object;
      List associations=(List)value;
      mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1));
      mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1));
      Iterator iterator=associations.iterator();
      while (iterator.hasNext()) {
        Association association=(Association)iterator.next();
        mapping.getSourceToTargetKeyFields().put((DatabaseField)association.getKey(),(DatabaseField)association.getValue());
        mapping.getTargetToSourceKeyFields().put((DatabaseField)association.getValue(),(DatabaseField)association.getKey());
      }
    }
  }
);
  sourceToTargetKeyFieldAssociationsMapping.setAttributeName("String_Node_Str");
  sourceToTargetKeyFieldAssociationsMapping.setXPath(getSecondaryNamespaceXPath() + "String_Node_Str" + getSecondaryNamespaceXPath()+ "String_Node_Str");
  descriptor.addMapping(sourceToTargetKeyFieldAssociationsMapping);
  XMLCompositeCollectionMapping foreignKeyFieldNamesMapping=new XMLCompositeCollectionMapping();
  foreignKeyFieldNamesMapping.useCollectionClass(NonSynchronizedVector.class);
  foreignKeyFieldNamesMapping.setAttributeName("String_Node_Str");
  foreignKeyFieldNamesMapping.setGetMethodName("String_Node_Str");
  foreignKeyFieldNamesMapping.setSetMethodName("String_Node_Str");
  foreignKeyFieldNamesMapping.setXPath(getSecondaryNamespaceXPath() + "String_Node_Str" + getSecondaryNamespaceXPath()+ "String_Node_Str");
  foreignKeyFieldNamesMapping.setReferenceClass(DatabaseField.class);
  descriptor.addMapping(foreignKeyFieldNamesMapping);
  XMLDirectMapping relationshipPartnerAttributeNameMapping=new XMLDirectMapping();
  relationshipPartnerAttributeNameMapping.setAttributeName("String_Node_Str");
  relationshipPartnerAttributeNameMapping.setGetMethodName("String_Node_Str");
  relationshipPartnerAttributeNameMapping.setSetMethodName("String_Node_Str");
  relationshipPartnerAttributeNameMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  descriptor.addMapping(relationshipPartnerAttributeNameMapping);
  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);
  XMLDirectMapping joinFetchMapping=new XMLDirectMapping();
  joinFetchMapping.setAttributeName("String_Node_Str");
  joinFetchMapping.setXPath(getPrimaryNamespaceXPath() + "String_Node_Str");
  ObjectTypeConverter joinFetchConverter=new ObjectTypeConverter();
  joinFetchConverter.addConversionValue("String_Node_Str",new Integer(ForeignReferenceMapping.INNER_JOIN));
  joinFetchConverter.addConversionValue("String_Node_Str",new Integer(ForeignReferenceMapping.NONE));
  joinFetchMapping.setConverter(joinFetchConverter);
  joinFetchMapping.setNullValue(ForeignReferenceMapping.NONE);
  descriptor.addMapping(joinFetchMapping);
  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);
  return descriptor;
}