Program: 67690
Project: 67690
Buggy source:
public ArrayList<Property> getFieldPropertiesForClass(JavaClass cls,TypeInfo info,boolean onlyPublic){
  ArrayList properties=new ArrayList();
  if (cls == null) {
    return properties;
  }
  boolean hasAnyAttribteProperty=false;
  for (Iterator<JavaField> fieldIt=cls.getDeclaredFields().iterator(); fieldIt.hasNext(); ) {
    JavaField nextField=fieldIt.next();
    if (!helper.isAnnotationPresent(nextField,XmlTransient.class)) {
      int modifiers=nextField.getModifiers();
      if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((Modifier.isPublic(nextField.getModifiers()) && onlyPublic) || !onlyPublic)) {
        Property property=null;
        if (helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlElements.class)) {
          property=new ChoiceProperty(helper);
          property.setElement((JavaHasAnnotations)nextField);
          XmlElements xmlElements=(XmlElements)helper.getAnnotation(property.getElement(),XmlElements.class);
          XmlElement[] elements=xmlElements.value();
          ArrayList<Property> choiceProperties=new ArrayList<Property>(elements.length);
          for (int i=0; i < elements.length; i++) {
            XmlElement next=elements[i];
            Property choiceProp=new Property();
            String name=next.name();
            String namespace=next.namespace();
            QName qName=null;
            if (!namespace.equals("String_Node_Str")) {
              qName=new QName(namespace,name);
            }
 else {
              qName=new QName(name);
            }
            choiceProp.setPropertyName(property.getPropertyName());
            choiceProp.setType(helper.getJavaClass(next.type()));
            choiceProp.setSchemaName(qName);
            choiceProp.setSchemaType(getSchemaTypeFor(helper.getJavaClass(next.type())));
            choiceProp.setElement(property.getElement());
            choiceProperties.add(choiceProp);
          }
          ((ChoiceProperty)property).setChoiceProperties(choiceProperties);
        }
 else         if (helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlAnyElement.class)) {
          property=new AnyProperty(helper);
          property.setElement((JavaHasAnnotations)nextField);
          XmlAnyElement anyElement=(XmlAnyElement)helper.getAnnotation((JavaHasAnnotations)nextField,XmlAnyElement.class);
          ((AnyProperty)property).setLax(anyElement.lax());
          ((AnyProperty)property).setDomHandlerClass(anyElement.value());
        }
 else         if (helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlElementRef.class) || helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlElementRefs.class)) {
          property=new ReferenceProperty(helper);
          property.setElement(nextField);
          XmlElementRef[] elementRefs;
          XmlElementRef ref=(XmlElementRef)helper.getAnnotation((JavaHasAnnotations)nextField,XmlElementRef.class);
          if (ref != null) {
            elementRefs=new XmlElementRef[]{ref};
          }
 else {
            XmlElementRefs refs=(XmlElementRefs)helper.getAnnotation((JavaHasAnnotations)nextField,XmlElementRefs.class);
            elementRefs=refs.value();
            info.setHasElementRefs(true);
          }
          for (          XmlElementRef nextRef : elementRefs) {
            JavaClass type=nextField.getResolvedType();
            String typeName=type.getQualifiedName();
            property.setType(type);
            if (isCollectionType(property)) {
              if (type.hasActualTypeArguments()) {
                type=(JavaClass)type.getActualTypeArguments().toArray()[0];
                typeName=type.getQualifiedName();
              }
            }
            if (nextRef.type() != XmlElementRef.DEFAULT.class) {
              typeName=helper.getJavaClass(nextRef.type()).getQualifiedName();
            }
            ElementDeclaration referencedElement=this.xmlRootElements.get(typeName);
            if (referencedElement != null) {
              addReferencedElement((ReferenceProperty)property,referencedElement);
            }
 else {
              String name=nextRef.name();
              String namespace=nextRef.namespace();
              if (namespace.equals("String_Node_Str")) {
                namespace="String_Node_Str";
              }
              QName qname=new QName(namespace,name);
              referencedElement=this.globalElements.get(qname);
              if (referencedElement != null) {
                addReferencedElement((ReferenceProperty)property,referencedElement);
              }
 else {
                throw org.eclipse.persistence.exceptions.JAXBException.invalidElementRef(property.getPropertyName(),cls.getName());
              }
            }
          }
        }
 else {
          property=new Property(helper);
          property.setElement((JavaHasAnnotations)nextField);
        }
        JavaClass ptype=(JavaClass)nextField.getResolvedType();
        property.setType(ptype);
        if (helper.isAnnotationPresent(property.getElement(),XmlJavaTypeAdapter.class)) {
          XmlJavaTypeAdapter adapter=(XmlJavaTypeAdapter)helper.getAnnotation(property.getElement(),XmlJavaTypeAdapter.class);
          property.setAdapterClass(adapter.value());
        }
 else         if (info.getAdaptersByClass().get(ptype) != null) {
          property.setAdapterClass(info.getAdapterClass(ptype));
        }
        if (property.hasAdapterClass()) {
          ptype=property.getValueType();
        }
        property.setGenericType(helper.getGenericType(nextField));
        property.setPropertyName(nextField.getName());
        if (helper.isAnnotationPresent(property.getElement(),XmlAttachmentRef.class) && areEquals(ptype,JAVAX_ACTIVATION_DATAHANDLER)) {
          property.setIsSwaAttachmentRef(true);
          property.setSchemaType(XMLConstants.SWA_REF_QNAME);
        }
 else         if (areEquals(ptype,JAVAX_ACTIVATION_DATAHANDLER) || areEquals(ptype,byte[].class) || areEquals(ptype,Byte[].class)|| areEquals(ptype,Image.class)|| areEquals(ptype,Source.class)|| areEquals(ptype,JAVAX_MAIL_INTERNET_MIMEMULTIPART)) {
          property.setIsMtomAttachment(true);
          property.setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlMimeType.class)) {
          property.setMimeType(((XmlMimeType)helper.getAnnotation(property.getElement(),XmlMimeType.class)).value());
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlSchemaType.class)) {
          XmlSchemaType schemaType=(XmlSchemaType)helper.getAnnotation(property.getElement(),XmlSchemaType.class);
          QName schemaTypeQname=new QName(schemaType.namespace(),schemaType.name());
          property.setSchemaType(schemaTypeQname);
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlAttribute.class)) {
          property.setIsAttribute(true);
          property.setIsRequired(((XmlAttribute)helper.getAnnotation(property.getElement(),XmlAttribute.class)).required());
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlAnyAttribute.class)) {
          if (hasAnyAttribteProperty) {
            throw org.eclipse.persistence.exceptions.JAXBException.multipleAnyAttributeMapping(cls.getName());
          }
          if (!ptype.getName().equals("String_Node_Str")) {
            throw org.eclipse.persistence.exceptions.JAXBException.anyAttributeOnNonMap(property.getPropertyName());
          }
          property.setIsAttribute(true);
          hasAnyAttribteProperty=true;
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
          property.setIsRequired(((XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class)).required());
        }
        property.setSchemaName(getQNameForProperty(Introspector.decapitalize(nextField.getName()),nextField,getNamespaceInfoForPackage(cls.getPackage())));
        properties.add(property);
      }
    }
  }
  return properties;
}

Fixed version (ground truth):
public ArrayList<Property> getFieldPropertiesForClass(JavaClass cls,TypeInfo info,boolean onlyPublic){
  ArrayList properties=new ArrayList();
  if (cls == null) {
    return properties;
  }
  boolean hasAnyAttribteProperty=false;
  for (Iterator<JavaField> fieldIt=cls.getDeclaredFields().iterator(); fieldIt.hasNext(); ) {
    JavaField nextField=fieldIt.next();
    if (!helper.isAnnotationPresent(nextField,XmlTransient.class)) {
      int modifiers=nextField.getModifiers();
      if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((Modifier.isPublic(nextField.getModifiers()) && onlyPublic) || !onlyPublic)) {
        Property property=null;
        if (helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlElements.class)) {
          property=new ChoiceProperty(helper);
          property.setElement((JavaHasAnnotations)nextField);
          XmlElements xmlElements=(XmlElements)helper.getAnnotation(property.getElement(),XmlElements.class);
          XmlElement[] elements=xmlElements.value();
          ArrayList<Property> choiceProperties=new ArrayList<Property>(elements.length);
          for (int i=0; i < elements.length; i++) {
            XmlElement next=elements[i];
            Property choiceProp=new Property();
            String name=next.name();
            String namespace=next.namespace();
            QName qName=null;
            if (!namespace.equals("String_Node_Str")) {
              qName=new QName(namespace,name);
            }
 else {
              NamespaceInfo namespaceInfo=getNamespaceInfoForPackage(cls.getPackage());
              if (namespaceInfo.isElementFormQualified()) {
                qName=new QName(namespaceInfo.getNamespace(),name);
              }
 else {
                qName=new QName(name);
              }
            }
            choiceProp.setPropertyName(property.getPropertyName());
            choiceProp.setType(helper.getJavaClass(next.type()));
            choiceProp.setSchemaName(qName);
            choiceProp.setSchemaType(getSchemaTypeFor(helper.getJavaClass(next.type())));
            choiceProp.setElement(property.getElement());
            choiceProperties.add(choiceProp);
          }
          ((ChoiceProperty)property).setChoiceProperties(choiceProperties);
        }
 else         if (helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlAnyElement.class)) {
          property=new AnyProperty(helper);
          property.setElement((JavaHasAnnotations)nextField);
          XmlAnyElement anyElement=(XmlAnyElement)helper.getAnnotation((JavaHasAnnotations)nextField,XmlAnyElement.class);
          ((AnyProperty)property).setLax(anyElement.lax());
          ((AnyProperty)property).setDomHandlerClass(anyElement.value());
        }
 else         if (helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlElementRef.class) || helper.isAnnotationPresent((JavaHasAnnotations)nextField,XmlElementRefs.class)) {
          property=new ReferenceProperty(helper);
          property.setElement(nextField);
          XmlElementRef[] elementRefs;
          XmlElementRef ref=(XmlElementRef)helper.getAnnotation((JavaHasAnnotations)nextField,XmlElementRef.class);
          if (ref != null) {
            elementRefs=new XmlElementRef[]{ref};
          }
 else {
            XmlElementRefs refs=(XmlElementRefs)helper.getAnnotation((JavaHasAnnotations)nextField,XmlElementRefs.class);
            elementRefs=refs.value();
            info.setHasElementRefs(true);
          }
          for (          XmlElementRef nextRef : elementRefs) {
            JavaClass type=nextField.getResolvedType();
            String typeName=type.getQualifiedName();
            property.setType(type);
            if (isCollectionType(property)) {
              if (type.hasActualTypeArguments()) {
                type=(JavaClass)type.getActualTypeArguments().toArray()[0];
                typeName=type.getQualifiedName();
              }
            }
            if (nextRef.type() != XmlElementRef.DEFAULT.class) {
              typeName=helper.getJavaClass(nextRef.type()).getQualifiedName();
            }
            ElementDeclaration referencedElement=this.xmlRootElements.get(typeName);
            if (referencedElement != null) {
              addReferencedElement((ReferenceProperty)property,referencedElement);
            }
 else {
              String name=nextRef.name();
              String namespace=nextRef.namespace();
              if (namespace.equals("String_Node_Str")) {
                namespace="String_Node_Str";
              }
              QName qname=new QName(namespace,name);
              referencedElement=this.globalElements.get(qname);
              if (referencedElement != null) {
                addReferencedElement((ReferenceProperty)property,referencedElement);
              }
 else {
                throw org.eclipse.persistence.exceptions.JAXBException.invalidElementRef(property.getPropertyName(),cls.getName());
              }
            }
          }
        }
 else {
          property=new Property(helper);
          property.setElement((JavaHasAnnotations)nextField);
        }
        JavaClass ptype=(JavaClass)nextField.getResolvedType();
        property.setType(ptype);
        if (helper.isAnnotationPresent(property.getElement(),XmlJavaTypeAdapter.class)) {
          XmlJavaTypeAdapter adapter=(XmlJavaTypeAdapter)helper.getAnnotation(property.getElement(),XmlJavaTypeAdapter.class);
          property.setAdapterClass(adapter.value());
        }
 else         if (info.getAdaptersByClass().get(ptype) != null) {
          property.setAdapterClass(info.getAdapterClass(ptype));
        }
        if (property.hasAdapterClass()) {
          ptype=property.getValueType();
        }
        property.setGenericType(helper.getGenericType(nextField));
        property.setPropertyName(nextField.getName());
        if (helper.isAnnotationPresent(property.getElement(),XmlAttachmentRef.class) && areEquals(ptype,JAVAX_ACTIVATION_DATAHANDLER)) {
          property.setIsSwaAttachmentRef(true);
          property.setSchemaType(XMLConstants.SWA_REF_QNAME);
        }
 else         if (areEquals(ptype,JAVAX_ACTIVATION_DATAHANDLER) || areEquals(ptype,byte[].class) || areEquals(ptype,Byte[].class)|| areEquals(ptype,Image.class)|| areEquals(ptype,Source.class)|| areEquals(ptype,JAVAX_MAIL_INTERNET_MIMEMULTIPART)) {
          property.setIsMtomAttachment(true);
          property.setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlMimeType.class)) {
          property.setMimeType(((XmlMimeType)helper.getAnnotation(property.getElement(),XmlMimeType.class)).value());
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlSchemaType.class)) {
          XmlSchemaType schemaType=(XmlSchemaType)helper.getAnnotation(property.getElement(),XmlSchemaType.class);
          QName schemaTypeQname=new QName(schemaType.namespace(),schemaType.name());
          property.setSchemaType(schemaTypeQname);
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlAttribute.class)) {
          property.setIsAttribute(true);
          property.setIsRequired(((XmlAttribute)helper.getAnnotation(property.getElement(),XmlAttribute.class)).required());
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlAnyAttribute.class)) {
          if (hasAnyAttribteProperty) {
            throw org.eclipse.persistence.exceptions.JAXBException.multipleAnyAttributeMapping(cls.getName());
          }
          if (!ptype.getName().equals("String_Node_Str")) {
            throw org.eclipse.persistence.exceptions.JAXBException.anyAttributeOnNonMap(property.getPropertyName());
          }
          property.setIsAttribute(true);
          hasAnyAttribteProperty=true;
        }
        if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
          property.setIsRequired(((XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class)).required());
        }
        property.setSchemaName(getQNameForProperty(Introspector.decapitalize(nextField.getName()),nextField,getNamespaceInfoForPackage(cls.getPackage())));
        properties.add(property);
      }
    }
  }
  return properties;
}