Program: 66244
Project: 66244
Buggy source:
private Property buildNewProperty(TypeInfo info,JavaClass cls,JavaHasAnnotations javaHasAnnotations,String propertyName,JavaClass ptype){
  Property property=null;
  if (helper.isAnnotationPresent(javaHasAnnotations,XmlElements.class)) {
    property=buildChoiceProperty(javaHasAnnotations);
  }
 else   if (helper.isAnnotationPresent(javaHasAnnotations,XmlAnyElement.class)) {
    XmlAnyElement anyElement=(XmlAnyElement)helper.getAnnotation(javaHasAnnotations,XmlAnyElement.class);
    property=new Property(helper);
    property.setIsAny(true);
    if (anyElement.value() != null) {
      property.setDomHandlerClassName(anyElement.value().getName());
    }
    property.setLax(anyElement.lax());
    info.setAnyElementPropertyName(propertyName);
  }
 else   if (helper.isAnnotationPresent(javaHasAnnotations,XmlElementRef.class) || helper.isAnnotationPresent(javaHasAnnotations,XmlElementRefs.class)) {
    property=buildReferenceProperty(info,javaHasAnnotations,propertyName,ptype);
  }
 else   if (helper.isAnnotationPresent(javaHasAnnotations,org.eclipse.persistence.oxm.annotations.XmlTransformation.class)) {
    property=buildTransformationProperty(javaHasAnnotations,cls);
  }
 else {
    property=new Property(helper);
  }
  property.setPropertyName(propertyName);
  property.setElement(javaHasAnnotations);
  TypeInfo pTypeInfo=typeInfo.get(ptype.getQualifiedName());
  if ((pTypeInfo != null && !pTypeInfo.isTransient()) || !helper.isAnnotationPresent(ptype,XmlTransient.class)) {
    property.setType(ptype);
  }
 else {
    JavaClass parent=ptype.getSuperclass();
    while (parent != null) {
      if (parent.getName().equals("String_Node_Str")) {
        property.setType(parent);
        break;
      }
      TypeInfo parentTypeInfo=typeInfo.get(parent.getQualifiedName());
      if ((parentTypeInfo != null && !parentTypeInfo.isTransient()) || !helper.isAnnotationPresent(parent,XmlTransient.class)) {
        property.setType(parent);
        break;
      }
      parent=parent.getSuperclass();
    }
  }
  processPropertyAnnotations(info,cls,javaHasAnnotations,property);
  if (helper.isAnnotationPresent(javaHasAnnotations,XmlPath.class)) {
    XmlPath xmlPath=(XmlPath)helper.getAnnotation(javaHasAnnotations,XmlPath.class);
    property.setXmlPath(xmlPath.value());
    String schemaName=XMLProcessor.getNameFromXPath(xmlPath.value(),property.getPropertyName(),property.isAttribute());
    QName qName;
    NamespaceInfo nsInfo=getNamespaceInfoForPackage(cls);
    if (nsInfo.isElementFormQualified()) {
      qName=new QName(nsInfo.getNamespace(),schemaName);
    }
 else {
      qName=new QName(schemaName);
    }
    property.setSchemaName(qName);
  }
 else {
    property.setSchemaName(getQNameForProperty(propertyName,javaHasAnnotations,getNamespaceInfoForPackage(cls),info.getClassNamespace()));
  }
  ptype=property.getActualType();
  if (ptype.isPrimitive()) {
    property.setIsRequired(true);
  }
  if (!property.isSetXmlJavaTypeAdapter()) {
    TypeInfo refClassInfo=getTypeInfo().get(ptype.getQualifiedName());
    if (refClassInfo != null && refClassInfo.isSetXmlJavaTypeAdapter()) {
      org.eclipse.persistence.jaxb.xmlmodel.XmlJavaTypeAdapter xmlJavaTypeAdapter=null;
      try {
        xmlJavaTypeAdapter=refClassInfo.getXmlJavaTypeAdapter();
        property.setXmlJavaTypeAdapter(refClassInfo.getXmlJavaTypeAdapter());
      }
 catch (      JAXBException e) {
        String[] messageParams=new String[2];
        messageParams[0]=xmlJavaTypeAdapter.getValue();
        messageParams[1]=cls.getName();
        property.setXmlJavaTypeAdapter(null);
        this.getLogger().logWarning(JAXBMetadataLogger.INVALID_TYPE_LEVEL_XML_JAVA_TYPE_ADAPTER,messageParams);
      }
    }
  }
  return property;
}

Fixed version (ground truth):
private Property buildNewProperty(TypeInfo info,JavaClass cls,JavaHasAnnotations javaHasAnnotations,String propertyName,JavaClass ptype){
  Property property=null;
  if (helper.isAnnotationPresent(javaHasAnnotations,XmlElements.class)) {
    property=buildChoiceProperty(javaHasAnnotations);
  }
 else   if (helper.isAnnotationPresent(javaHasAnnotations,XmlAnyElement.class)) {
    XmlAnyElement anyElement=(XmlAnyElement)helper.getAnnotation(javaHasAnnotations,XmlAnyElement.class);
    property=new Property(helper);
    property.setIsAny(true);
    if (anyElement.value() != null) {
      property.setDomHandlerClassName(anyElement.value().getName());
    }
    property.setLax(anyElement.lax());
    info.setAnyElementPropertyName(propertyName);
  }
 else   if (helper.isAnnotationPresent(javaHasAnnotations,XmlElementRef.class) || helper.isAnnotationPresent(javaHasAnnotations,XmlElementRefs.class)) {
    property=buildReferenceProperty(info,javaHasAnnotations,propertyName,ptype);
  }
 else   if (helper.isAnnotationPresent(javaHasAnnotations,org.eclipse.persistence.oxm.annotations.XmlTransformation.class) || helper.isAnnotationPresent(javaHasAnnotations,org.eclipse.persistence.oxm.annotations.XmlReadTransformer.class) || helper.isAnnotationPresent(javaHasAnnotations,org.eclipse.persistence.oxm.annotations.XmlWriteTransformer.class)|| helper.isAnnotationPresent(javaHasAnnotations,XmlWriteTransformers.class)) {
    property=buildTransformationProperty(javaHasAnnotations,cls);
  }
 else {
    property=new Property(helper);
  }
  property.setPropertyName(propertyName);
  property.setElement(javaHasAnnotations);
  TypeInfo pTypeInfo=typeInfo.get(ptype.getQualifiedName());
  if ((pTypeInfo != null && !pTypeInfo.isTransient()) || !helper.isAnnotationPresent(ptype,XmlTransient.class)) {
    property.setType(ptype);
  }
 else {
    JavaClass parent=ptype.getSuperclass();
    while (parent != null) {
      if (parent.getName().equals("String_Node_Str")) {
        property.setType(parent);
        break;
      }
      TypeInfo parentTypeInfo=typeInfo.get(parent.getQualifiedName());
      if ((parentTypeInfo != null && !parentTypeInfo.isTransient()) || !helper.isAnnotationPresent(parent,XmlTransient.class)) {
        property.setType(parent);
        break;
      }
      parent=parent.getSuperclass();
    }
  }
  processPropertyAnnotations(info,cls,javaHasAnnotations,property);
  if (helper.isAnnotationPresent(javaHasAnnotations,XmlPath.class)) {
    XmlPath xmlPath=(XmlPath)helper.getAnnotation(javaHasAnnotations,XmlPath.class);
    property.setXmlPath(xmlPath.value());
    String schemaName=XMLProcessor.getNameFromXPath(xmlPath.value(),property.getPropertyName(),property.isAttribute());
    QName qName;
    NamespaceInfo nsInfo=getNamespaceInfoForPackage(cls);
    if (nsInfo.isElementFormQualified()) {
      qName=new QName(nsInfo.getNamespace(),schemaName);
    }
 else {
      qName=new QName(schemaName);
    }
    property.setSchemaName(qName);
  }
 else {
    property.setSchemaName(getQNameForProperty(propertyName,javaHasAnnotations,getNamespaceInfoForPackage(cls),info.getClassNamespace()));
  }
  ptype=property.getActualType();
  if (ptype.isPrimitive()) {
    property.setIsRequired(true);
  }
  if (!property.isSetXmlJavaTypeAdapter()) {
    TypeInfo refClassInfo=getTypeInfo().get(ptype.getQualifiedName());
    if (refClassInfo != null && refClassInfo.isSetXmlJavaTypeAdapter()) {
      org.eclipse.persistence.jaxb.xmlmodel.XmlJavaTypeAdapter xmlJavaTypeAdapter=null;
      try {
        xmlJavaTypeAdapter=refClassInfo.getXmlJavaTypeAdapter();
        property.setXmlJavaTypeAdapter(refClassInfo.getXmlJavaTypeAdapter());
      }
 catch (      JAXBException e) {
        String[] messageParams=new String[2];
        messageParams[0]=xmlJavaTypeAdapter.getValue();
        messageParams[1]=cls.getName();
        property.setXmlJavaTypeAdapter(null);
        this.getLogger().logWarning(JAXBMetadataLogger.INVALID_TYPE_LEVEL_XML_JAVA_TYPE_ADAPTER,messageParams);
      }
    }
  }
  return property;
}