Program: 68629
Project: 68629
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") || ((areEquals((JavaClass)next.getReturnType(),Boolean.class) || areEquals((JavaClass)next.getReturnType(),boolean.class)) && next.getName().startsWith("String_Node_Str"))) {
      if ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic) {
        getMethods.add(next);
      }
    }
  }
  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);
    }
    propertyName=Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
    String setMethodName="String_Node_Str" + Character.toUpperCase(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 {
      property=new Property(helper);
    }
    property.setElement(propertyMethod);
    property.setSchemaName(getQNameForProperty(propertyName,propertyMethod));
    property.setPropertyName(propertyName);
    property.setType((JavaClass)getMethod.getReturnType());
    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(XMLConstants.SCHEMA_INSTANCE_URL,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) || helper.isAnnotationPresent(property.getElement(),XmlAnyAttribute.class)) {
      property.setIsAttribute(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).setLax(anyElement.lax());
    }
    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") || ((areEquals((JavaClass)next.getReturnType(),Boolean.class) || areEquals((JavaClass)next.getReturnType(),boolean.class)) && next.getName().startsWith("String_Node_Str"))) {
      if ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic) {
        getMethods.add(next);
      }
    }
  }
  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);
    }
    propertyName=Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
    String setMethodName="String_Node_Str" + Character.toUpperCase(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 {
      property=new Property(helper);
    }
    property.setElement(propertyMethod);
    property.setSchemaName(getQNameForProperty(propertyName,propertyMethod));
    property.setPropertyName(propertyName);
    property.setType((JavaClass)getMethod.getReturnType());
    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(XMLConstants.SCHEMA_INSTANCE_URL,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) || helper.isAnnotationPresent(property.getElement(),XmlAnyAttribute.class)) {
      property.setIsAttribute(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(),XmlTransient.class)) {
      properties.add(property);
    }
    if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
      property.setIsRequired(((XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class)).required());
    }
  }
  return properties;
}