Program: 54874
Project: 54874
Buggy source:
/** 
 * Returns whether the customize parser has requested to stop or reached end of document. Otherwise, identical to   {@link #parseElement(XmlPullParser,Object,XmlNamespaceDictionary,CustomizeParser)} .
 */
private static boolean parseElementInternal(XmlPullParser parser,Object destination,XmlNamespaceDictionary namespaceDictionary,CustomizeParser customizeParser) throws IOException, XmlPullParserException {
  Class<?> destinationClass=destination == null ? null : destination.getClass();
  GenericXml genericXml=destination instanceof GenericXml ? (GenericXml)destination : null;
  boolean isMap=genericXml == null && destination instanceof Map<?,?>;
  @SuppressWarnings("String_Node_Str") Map<String,Object> destinationMap=isMap ? (Map<String,Object>)destination : null;
  ClassInfo classInfo=isMap || destination == null ? null : ClassInfo.of(destinationClass);
  int eventType=parser.getEventType();
  if (parser.getEventType() == XmlPullParser.START_DOCUMENT) {
    eventType=parser.next();
  }
  if (eventType != XmlPullParser.START_TAG) {
    throw new IllegalArgumentException("String_Node_Str" + eventType + "String_Node_Str");
  }
  String prefix=parser.getPrefix();
  String alias=prefix == null ? "String_Node_Str" : prefix;
  namespaceDictionary.addNamespace(alias,parser.getNamespace());
  if (genericXml != null) {
    genericXml.namespaceDictionary=namespaceDictionary;
    String name=parser.getName();
    genericXml.name=prefix == null ? name : prefix + "String_Node_Str" + name;
  }
  if (destination != null) {
    int attributeCount=parser.getAttributeCount();
    for (int i=0; i < attributeCount; i++) {
      String attributeName=parser.getAttributeName(i);
      String attributePrefix=parser.getAttributePrefix(i);
      String attributeNamespace=parser.getAttributeNamespace(i);
      if (attributePrefix != null) {
        namespaceDictionary.addNamespace(attributePrefix,attributeNamespace);
      }
      String fieldName=getFieldName(true,attributePrefix,attributeNamespace,attributeName);
      Field field=isMap ? null : classInfo.getField(fieldName);
      parseValue(parser.getAttributeValue(i),field,destination,genericXml,destinationMap,fieldName);
    }
  }
  Field field;
  while (true) {
    int event=parser.next();
switch (event) {
case XmlPullParser.END_DOCUMENT:
      return true;
case XmlPullParser.END_TAG:
    return customizeParser != null && customizeParser.stopAfterEndTag(parser.getNamespace(),parser.getName());
case XmlPullParser.TEXT:
  if (destination != null) {
    String textFieldName="String_Node_Str";
    field=isMap ? null : classInfo.getField(textFieldName);
    parseValue(parser.getText(),field,destination,genericXml,destinationMap,textFieldName);
  }
break;
case XmlPullParser.START_TAG:
if (customizeParser != null && customizeParser.stopBeforeStartTag(parser.getNamespace(),parser.getName())) {
return true;
}
if (destination == null) {
int level=1;
while (level != 0) {
switch (parser.next()) {
case XmlPullParser.END_DOCUMENT:
  return true;
case XmlPullParser.START_TAG:
level++;
break;
case XmlPullParser.END_TAG:
level--;
break;
}
}
continue;
}
String fieldName=getFieldName(false,parser.getPrefix(),parser.getNamespace(),parser.getName());
field=isMap ? null : classInfo.getField(fieldName);
Class<?> fieldClass=field == null ? null : field.getType();
boolean isStopped=false;
if (field == null && !isMap && genericXml == null || field != null && FieldInfo.isPrimitive(fieldClass)) {
int level=1;
while (level != 0) {
switch (parser.next()) {
case XmlPullParser.END_DOCUMENT:
return true;
case XmlPullParser.START_TAG:
level++;
break;
case XmlPullParser.END_TAG:
level--;
break;
case XmlPullParser.TEXT:
if (level == 1) {
parseValue(parser.getText(),field,destination,genericXml,destinationMap,fieldName);
}
break;
}
}
}
 else if (field == null || Map.class.isAssignableFrom(fieldClass)) {
Map<String,Object> mapValue=ClassInfo.newMapInstance(fieldClass);
isStopped=parseElementInternal(parser,mapValue,namespaceDictionary,customizeParser);
if (isMap) {
@SuppressWarnings("String_Node_Str") List<Object> list=(List<Object>)destinationMap.get(fieldName);
if (list == null) {
list=new ArrayList<Object>(1);
destinationMap.put(fieldName,list);
}
list.add(mapValue);
}
 else if (field != null) {
FieldInfo.setFieldValue(field,destination,mapValue);
}
 else {
GenericXml atom=(GenericXml)destination;
@SuppressWarnings("String_Node_Str") List<Object> list=(List<Object>)atom.get(fieldName);
if (list == null) {
list=new ArrayList<Object>(1);
atom.set(fieldName,list);
}
list.add(mapValue);
}
}
 else if (Collection.class.isAssignableFrom(fieldClass)) {
@SuppressWarnings("String_Node_Str") Collection<Object> collectionValue=(Collection<Object>)FieldInfo.getFieldValue(field,destination);
if (collectionValue == null) {
collectionValue=ClassInfo.newCollectionInstance(fieldClass);
FieldInfo.setFieldValue(field,destination,collectionValue);
}
Object elementValue=null;
Class<?> subFieldClass=ClassInfo.getCollectionParameter(field);
if (subFieldClass == null || FieldInfo.isPrimitive(subFieldClass)) {
int level=1;
while (level != 0) {
switch (parser.next()) {
case XmlPullParser.END_DOCUMENT:
return true;
case XmlPullParser.START_TAG:
level++;
break;
case XmlPullParser.END_TAG:
level--;
break;
case XmlPullParser.TEXT:
if (level == 1 && subFieldClass != null) {
elementValue=parseValue(parser.getText(),subFieldClass);
}
break;
}
}
}
 else {
elementValue=ClassInfo.newInstance(subFieldClass);
isStopped=parseElementInternal(parser,elementValue,namespaceDictionary,customizeParser);
}
collectionValue.add(elementValue);
}
 else {
Object value=ClassInfo.newInstance(fieldClass);
isStopped=parseElementInternal(parser,value,namespaceDictionary,customizeParser);
FieldInfo.setFieldValue(field,destination,value);
}
if (isStopped) {
return true;
}
break;
}
}
}

Fixed version (ground truth):
/** 
 * Returns whether the customize parser has requested to stop or reached end of document. Otherwise, identical to   {@link #parseElement(XmlPullParser,Object,XmlNamespaceDictionary,CustomizeParser)} .
 */
private static boolean parseElementInternal(XmlPullParser parser,Object destination,XmlNamespaceDictionary namespaceDictionary,CustomizeParser customizeParser) throws IOException, XmlPullParserException {
  Class<?> destinationClass=destination == null ? null : destination.getClass();
  GenericXml genericXml=destination instanceof GenericXml ? (GenericXml)destination : null;
  boolean isMap=genericXml == null && destination instanceof Map<?,?>;
  @SuppressWarnings("String_Node_Str") Map<String,Object> destinationMap=isMap ? (Map<String,Object>)destination : null;
  ClassInfo classInfo=isMap || destination == null ? null : ClassInfo.of(destinationClass);
  int eventType=parser.getEventType();
  if (parser.getEventType() == XmlPullParser.START_DOCUMENT) {
    eventType=parser.next();
  }
  if (eventType != XmlPullParser.START_TAG) {
    throw new IllegalArgumentException("String_Node_Str" + eventType + "String_Node_Str");
  }
  String prefix=parser.getPrefix();
  String alias=prefix == null ? "String_Node_Str" : prefix;
  namespaceDictionary.addNamespace(alias,parser.getNamespace());
  if (genericXml != null) {
    genericXml.namespaceDictionary=namespaceDictionary;
    String name=parser.getName();
    genericXml.name=prefix == null ? name : prefix + "String_Node_Str" + name;
  }
  if (destination != null) {
    int attributeCount=parser.getAttributeCount();
    for (int i=0; i < attributeCount; i++) {
      String attributeName=parser.getAttributeName(i);
      String attributePrefix=parser.getAttributePrefix(i);
      String attributeNamespace=parser.getAttributeNamespace(i);
      if (attributePrefix != null) {
        namespaceDictionary.addNamespace(attributePrefix,attributeNamespace);
      }
      String fieldName=getFieldName(true,attributePrefix,attributeNamespace,attributeName);
      Field field=isMap ? null : classInfo.getField(fieldName);
      parseValue(parser.getAttributeValue(i),field,destination,genericXml,destinationMap,fieldName);
    }
  }
  Field field;
  while (true) {
    int event=parser.next();
switch (event) {
case XmlPullParser.END_DOCUMENT:
      return true;
case XmlPullParser.END_TAG:
    return customizeParser != null && customizeParser.stopAfterEndTag(parser.getNamespace(),parser.getName());
case XmlPullParser.TEXT:
  if (destination != null) {
    String textFieldName="String_Node_Str";
    field=isMap ? null : classInfo.getField(textFieldName);
    parseValue(parser.getText(),field,destination,genericXml,destinationMap,textFieldName);
  }
break;
case XmlPullParser.START_TAG:
if (customizeParser != null && customizeParser.stopBeforeStartTag(parser.getNamespace(),parser.getName())) {
return true;
}
if (destination == null) {
int level=1;
while (level != 0) {
switch (parser.next()) {
case XmlPullParser.END_DOCUMENT:
  return true;
case XmlPullParser.START_TAG:
level++;
break;
case XmlPullParser.END_TAG:
level--;
break;
}
}
continue;
}
String fieldName=getFieldName(false,parser.getPrefix(),parser.getNamespace(),parser.getName());
field=isMap ? null : classInfo.getField(fieldName);
Class<?> fieldClass=field == null ? null : field.getType();
boolean isStopped=false;
if (field == null && !isMap && genericXml == null || field != null && FieldInfo.isPrimitive(fieldClass)) {
int level=1;
while (level != 0) {
switch (parser.next()) {
case XmlPullParser.END_DOCUMENT:
return true;
case XmlPullParser.START_TAG:
level++;
break;
case XmlPullParser.END_TAG:
level--;
break;
case XmlPullParser.TEXT:
if (level == 1) {
parseValue(parser.getText(),field,destination,genericXml,destinationMap,fieldName);
}
break;
}
}
}
 else if (field == null || Map.class.isAssignableFrom(fieldClass)) {
Map<String,Object> mapValue=ClassInfo.newMapInstance(fieldClass);
isStopped=parseElementInternal(parser,mapValue,namespaceDictionary,customizeParser);
if (isMap) {
@SuppressWarnings("String_Node_Str") Collection<Object> list=(Collection<Object>)destinationMap.get(fieldName);
if (list == null) {
list=new ArrayList<Object>(1);
destinationMap.put(fieldName,list);
}
list.add(mapValue);
}
 else if (field != null) {
FieldInfo.setFieldValue(field,destination,mapValue);
}
 else {
GenericXml atom=(GenericXml)destination;
@SuppressWarnings("String_Node_Str") Collection<Object> list=(Collection<Object>)atom.get(fieldName);
if (list == null) {
list=new ArrayList<Object>(1);
atom.set(fieldName,list);
}
list.add(mapValue);
}
}
 else if (Collection.class.isAssignableFrom(fieldClass)) {
@SuppressWarnings("String_Node_Str") Collection<Object> collectionValue=(Collection<Object>)FieldInfo.getFieldValue(field,destination);
if (collectionValue == null) {
collectionValue=ClassInfo.newCollectionInstance(fieldClass);
FieldInfo.setFieldValue(field,destination,collectionValue);
}
Object elementValue=null;
Class<?> subFieldClass=ClassInfo.getCollectionParameter(field);
if (subFieldClass == null || FieldInfo.isPrimitive(subFieldClass)) {
int level=1;
while (level != 0) {
switch (parser.next()) {
case XmlPullParser.END_DOCUMENT:
return true;
case XmlPullParser.START_TAG:
level++;
break;
case XmlPullParser.END_TAG:
level--;
break;
case XmlPullParser.TEXT:
if (level == 1 && subFieldClass != null) {
elementValue=parseValue(parser.getText(),subFieldClass);
}
break;
}
}
}
 else {
elementValue=ClassInfo.newInstance(subFieldClass);
isStopped=parseElementInternal(parser,elementValue,namespaceDictionary,customizeParser);
}
collectionValue.add(elementValue);
}
 else {
Object value=ClassInfo.newInstance(fieldClass);
isStopped=parseElementInternal(parser,value,namespaceDictionary,customizeParser);
FieldInfo.setFieldValue(field,destination,value);
}
if (isStopped) {
return true;
}
break;
}
}
}