Program: 65974
Project: 65974
Buggy source:
/** 
 * Build an Element based on a given Property.
 * @param property the Property used to build the Element
 * @param isAll true if the Element will be added to an All structure
 * @param schema the schema currently being built
 * @param typeInfo the TypeInfo that owns the given Property
 * @return
 */
private Element buildElement(Property property,boolean isAll,Schema schema,TypeInfo typeInfo){
  Element element=new Element();
  element.setMinOccurs(property.isRequired() ? Occurs.ONE : Occurs.ZERO);
  if (property.shouldSetNillable()) {
    element.setNillable(true);
  }
  if (property.isSetDefaultValue()) {
    element.setDefaultValue(property.getDefaultValue());
  }
  if (property.getMimeType() != null) {
    element.getAttributesMap().put(XMLConstants.EXPECTED_CONTENT_TYPES_QNAME,property.getMimeType());
  }
  QName elementName=property.getSchemaName();
  JavaClass javaType=property.getActualType();
  element.setName(elementName.getLocalPart());
  String typeName=getTypeNameForElement(property,schema,javaType,element);
  if (property.getGenericType() != null) {
    if (property.isXmlList()) {
      SimpleType localSimpleType=new SimpleType();
      org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
      list.setItemType(typeName);
      localSimpleType.setList(list);
      element.setSimpleType(localSimpleType);
    }
 else {
      element.setMaxOccurs(Occurs.UNBOUNDED);
      element.setType(typeName);
    }
  }
 else   if (property.isMap()) {
    addMapToSchema(property,element,schema,typeInfo);
  }
 else {
    element.setType(typeName);
  }
  return element;
}

Fixed version (ground truth):
/** 
 * Build an Element based on a given Property.
 * @param property the Property used to build the Element
 * @param isAll true if the Element will be added to an All structure
 * @param schema the schema currently being built
 * @param typeInfo the TypeInfo that owns the given Property
 * @return
 */
private Element buildElement(Property property,boolean isAll,Schema schema,TypeInfo typeInfo){
  Element element=new Element();
  element.setMinOccurs(property.isRequired() ? Occurs.ONE : Occurs.ZERO);
  if (property.shouldSetNillable()) {
    element.setNillable(true);
  }
  if (property.isSetDefaultValue()) {
    element.setDefaultValue(property.getDefaultValue());
  }
  if (property.getMimeType() != null) {
    element.getAttributesMap().put(XMLConstants.EXPECTED_CONTENT_TYPES_QNAME,property.getMimeType());
  }
  QName elementName=property.getSchemaName();
  String elementNamespace=elementName.getNamespaceURI();
  String lookupNamespace=schema.getTargetNamespace();
  if (lookupNamespace == null) {
    lookupNamespace=EMPTY_STRING;
  }
  NamespaceInfo namespaceInfo=getNamespaceInfoForNamespace(lookupNamespace);
  boolean isElementFormQualified=false;
  if (namespaceInfo != null) {
    isElementFormQualified=namespaceInfo.isElementFormQualified();
  }
  if ((isElementFormQualified && !elementNamespace.equals(lookupNamespace)) || (!isElementFormQualified && !elementNamespace.equals(EMPTY_STRING))) {
    schema=this.getSchemaForNamespace(elementNamespace);
  }
  JavaClass javaType=property.getActualType();
  element.setName(elementName.getLocalPart());
  String typeName=getTypeNameForElement(property,schema,javaType,element);
  if (property.getGenericType() != null) {
    if (property.isXmlList()) {
      SimpleType localSimpleType=new SimpleType();
      org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
      list.setItemType(typeName);
      localSimpleType.setList(list);
      element.setSimpleType(localSimpleType);
    }
 else {
      element.setMaxOccurs(Occurs.UNBOUNDED);
      element.setType(typeName);
    }
  }
 else   if (property.isMap()) {
    addMapToSchema(property,element,schema,typeInfo);
  }
 else {
    element.setType(typeName);
  }
  return element;
}