Program: 67658
Project: 67658
Buggy source:
public ArrayList<Property> getPropertyPropertiesForClass(JavaClass cls,TypeInfo info,boolean onlyPublic){
  ArrayList properties=new ArrayList();
  if (cls == null) {
    return properties;
  }
  ArrayList<JavaMethod> getMethods=new ArrayList<JavaMethod>();
  for (  JavaMethod next : new ArrayList<JavaMethod>(cls.getDeclaredMethods())) {
    if ((next.getName().startsWith("String_Node_Str") && next.getName().length() > 3) || (next.getName().startsWith("String_Node_Str") && next.getName().length() > 2)) {
      int modifiers=next.getModifiers();
      if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic)) {
        getMethods.add(next);
      }
    }
  }
  boolean hasAnyAttribteProperty=false;
  for (int i=0; i < getMethods.size(); i++) {
    JavaMethod getMethod=getMethods.get(i);
    String propertyName="String_Node_Str";
    if (getMethod.getName().startsWith("String_Node_Str")) {
      propertyName=getMethod.getName().substring(3);
    }
 else     if (getMethod.getName().startsWith("String_Node_Str")) {
      propertyName=getMethod.getName().substring(2);
    }
    String setMethodName="String_Node_Str" + propertyName;
    propertyName=Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
    JavaClass[] paramTypes={(JavaClass)getMethod.getReturnType()};
    JavaMethod setMethod=cls.getMethod(setMethodName,paramTypes);
    JavaMethod propertyMethod=null;
    if (setMethod != null && !setMethod.getAnnotations().isEmpty()) {
      if (!helper.isAnnotationPresent(setMethod,XmlTransient.class)) {
        propertyMethod=setMethod;
      }
    }
 else {
      if (!helper.isAnnotationPresent(getMethod,XmlTransient.class)) {
        propertyMethod=getMethod;
      }
    }
    Property property=null;
    if (helper.isAnnotationPresent(propertyMethod,XmlElements.class)) {
      property=new ChoiceProperty(helper);
    }
 else     if (helper.isAnnotationPresent(propertyMethod,XmlAnyElement.class)) {
      property=new AnyProperty(helper);
    }
 else     if (helper.isAnnotationPresent(propertyMethod,XmlElementRef.class) || helper.isAnnotationPresent(propertyMethod,XmlElementRefs.class)) {
      property=new ReferenceProperty(helper);
    }
 else {
      property=new Property(helper);
    }
    property.setElement(propertyMethod);
    property.setSchemaName(getQNameForProperty(propertyName,propertyMethod,getNamespaceInfoForPackage(cls.getPackage())));
    property.setPropertyName(propertyName);
    JavaClass returnClass=(JavaClass)getMethod.getReturnType();
    if (!helper.isAnnotationPresent(returnClass,XmlTransient.class)) {
      property.setType(returnClass);
    }
 else {
      JavaClass parent=returnClass.getSuperclass();
      while (parent != null) {
        if (parent.getClass().getName().equals("String_Node_Str")) {
          property.setType(parent);
          break;
        }
        if (!helper.isAnnotationPresent(parent,XmlTransient.class)) {
          property.setType(parent);
          break;
        }
        parent=parent.getSuperclass();
      }
    }
    property.setGenericType(helper.getGenericReturnType(getMethod));
    property.setGetMethodName(getMethod.getName());
    property.setSetMethodName(setMethodName);
    property.setMethodProperty(true);
    JavaClass ptype=property.getType();
    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.getAdaptersByClass().get(ptype));
    }
    if (property.hasAdapterClass()) {
      ptype=property.getValueType();
    }
    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(),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(),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.getAdaptersByClass().get(ptype));
    }
    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(),XmlElements.class)) {
      XmlElements xmlElements=(XmlElements)helper.getAnnotation(property.getElement(),XmlElements.class);
      XmlElement[] elements=xmlElements.value();
      ArrayList<Property> choiceProperties=new ArrayList<Property>(elements.length);
      for (int j=0; j < elements.length; j++) {
        XmlElement next=elements[j];
        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);
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlAnyElement.class)) {
      XmlAnyElement anyElement=(XmlAnyElement)helper.getAnnotation(property.getElement(),XmlAnyElement.class);
      ((AnyProperty)property).setDomHandlerClass(anyElement.value());
      ((AnyProperty)property).setLax(anyElement.lax());
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlElementRef.class) || helper.isAnnotationPresent(property.getElement(),XmlElementRefs.class)) {
      XmlElementRef[] elementRefs;
      XmlElementRef ref=(XmlElementRef)helper.getAnnotation(property.getElement(),XmlElementRef.class);
      if (ref != null) {
        elementRefs=new XmlElementRef[]{ref};
      }
 else {
        XmlElementRefs refs=(XmlElementRefs)helper.getAnnotation(property.getElement(),XmlElementRefs.class);
        elementRefs=refs.value();
        info.setHasElementRefs(true);
      }
      for (      XmlElementRef nextRef : elementRefs) {
        JavaClass type=ptype;
        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());
          }
        }
      }
    }
    if (!helper.isAnnotationPresent(property.getElement(),XmlTransient.class)) {
      properties.add(property);
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
      property.setIsRequired(((XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class)).required());
    }
  }
  return properties;
}

Fixed version (ground truth):
public ArrayList<Property> getPropertyPropertiesForClass(JavaClass cls,TypeInfo info,boolean onlyPublic){
  ArrayList properties=new ArrayList();
  if (cls == null) {
    return properties;
  }
  ArrayList<JavaMethod> getMethods=new ArrayList<JavaMethod>();
  for (  JavaMethod next : new ArrayList<JavaMethod>(cls.getDeclaredMethods())) {
    if ((next.getName().startsWith("String_Node_Str") && next.getName().length() > 3) || (next.getName().startsWith("String_Node_Str") && next.getName().length() > 2)) {
      int modifiers=next.getModifiers();
      if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic)) {
        getMethods.add(next);
      }
    }
  }
  boolean hasAnyAttribteProperty=false;
  for (int i=0; i < getMethods.size(); i++) {
    JavaMethod getMethod=getMethods.get(i);
    String propertyName="String_Node_Str";
    if (getMethod.getName().startsWith("String_Node_Str")) {
      propertyName=getMethod.getName().substring(3);
    }
 else     if (getMethod.getName().startsWith("String_Node_Str")) {
      propertyName=getMethod.getName().substring(2);
    }
    String setMethodName="String_Node_Str" + propertyName;
    propertyName=Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
    JavaClass[] paramTypes={(JavaClass)getMethod.getReturnType()};
    JavaMethod setMethod=cls.getDeclaredMethod(setMethodName,paramTypes);
    JavaMethod propertyMethod=null;
    if (setMethod != null && !setMethod.getAnnotations().isEmpty()) {
      if (!helper.isAnnotationPresent(setMethod,XmlTransient.class)) {
        propertyMethod=setMethod;
      }
    }
 else {
      if (!helper.isAnnotationPresent(getMethod,XmlTransient.class)) {
        propertyMethod=getMethod;
      }
    }
    Property property=null;
    if (helper.isAnnotationPresent(propertyMethod,XmlElements.class)) {
      property=new ChoiceProperty(helper);
    }
 else     if (helper.isAnnotationPresent(propertyMethod,XmlAnyElement.class)) {
      property=new AnyProperty(helper);
    }
 else     if (helper.isAnnotationPresent(propertyMethod,XmlElementRef.class) || helper.isAnnotationPresent(propertyMethod,XmlElementRefs.class)) {
      property=new ReferenceProperty(helper);
    }
 else {
      property=new Property(helper);
    }
    property.setElement(propertyMethod);
    property.setSchemaName(getQNameForProperty(propertyName,propertyMethod,getNamespaceInfoForPackage(cls.getPackage())));
    property.setPropertyName(propertyName);
    JavaClass returnClass=(JavaClass)getMethod.getReturnType();
    if (!helper.isAnnotationPresent(returnClass,XmlTransient.class)) {
      property.setType(returnClass);
    }
 else {
      JavaClass parent=returnClass.getSuperclass();
      while (parent != null) {
        if (parent.getClass().getName().equals("String_Node_Str")) {
          property.setType(parent);
          break;
        }
        if (!helper.isAnnotationPresent(parent,XmlTransient.class)) {
          property.setType(parent);
          break;
        }
        parent=parent.getSuperclass();
      }
    }
    property.setGenericType(helper.getGenericReturnType(getMethod));
    property.setGetMethodName(getMethod.getName());
    property.setSetMethodName(setMethodName);
    property.setMethodProperty(true);
    JavaClass ptype=property.getType();
    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.getAdaptersByClass().get(ptype));
    }
    if (property.hasAdapterClass()) {
      ptype=property.getValueType();
    }
    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(),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(),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.getAdaptersByClass().get(ptype));
    }
    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(),XmlElements.class)) {
      XmlElements xmlElements=(XmlElements)helper.getAnnotation(property.getElement(),XmlElements.class);
      XmlElement[] elements=xmlElements.value();
      ArrayList<Property> choiceProperties=new ArrayList<Property>(elements.length);
      for (int j=0; j < elements.length; j++) {
        XmlElement next=elements[j];
        Property choiceProp=new Property();
        String name=next.name();
        String namespace=next.namespace();
        QName qName=null;
        if (name.equals("String_Node_Str")) {
          name=propertyName;
        }
        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);
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlAnyElement.class)) {
      XmlAnyElement anyElement=(XmlAnyElement)helper.getAnnotation(property.getElement(),XmlAnyElement.class);
      ((AnyProperty)property).setDomHandlerClass(anyElement.value());
      ((AnyProperty)property).setLax(anyElement.lax());
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlElementRef.class) || helper.isAnnotationPresent(property.getElement(),XmlElementRefs.class)) {
      XmlElementRef[] elementRefs;
      XmlElementRef ref=(XmlElementRef)helper.getAnnotation(property.getElement(),XmlElementRef.class);
      if (ref != null) {
        elementRefs=new XmlElementRef[]{ref};
      }
 else {
        XmlElementRefs refs=(XmlElementRefs)helper.getAnnotation(property.getElement(),XmlElementRefs.class);
        elementRefs=refs.value();
        info.setHasElementRefs(true);
      }
      for (      XmlElementRef nextRef : elementRefs) {
        JavaClass type=ptype;
        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());
          }
        }
      }
    }
    if (!helper.isAnnotationPresent(property.getElement(),XmlTransient.class)) {
      properties.add(property);
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
      property.setIsRequired(((XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class)).required());
    }
  }
  return properties;
}