Program: 88507
Project: 88507
Buggy source:
@SuppressWarnings("String_Node_Str") protected static String toXML(Object object,String tagName,int level,int maxLevel,boolean humanOutput,boolean includeNulls,boolean includeClass,boolean includeClassField,Map<String,Object> properties){
  StringBuilder sb=new StringBuilder();
  if (object == null) {
    if (includeNulls) {
      tagName=validate(tagName == null ? "String_Node_Str" : tagName);
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      sb.append(SLASH);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
  }
 else {
    Class<?> type=ConstructorUtils.getWrapper(object.getClass());
    if (ConstructorUtils.isClassSimple(type)) {
      tagName=validate(tagName == null ? makeElementName(type) : tagName);
      String value="String_Node_Str";
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      if (Date.class.isAssignableFrom(type) || Calendar.class.isAssignableFrom(type)) {
        Date d=null;
        if (Date.class.isAssignableFrom(type)) {
          d=(Date)object;
        }
 else {
          d=((Calendar)object).getTime();
        }
        value=d.getTime() + "String_Node_Str";
      }
 else       if (Number.class.isAssignableFrom(type)) {
        value=object.toString();
      }
 else       if (Boolean.class.isAssignableFrom(type)) {
        value=object.toString();
      }
 else {
        value=escapeForXML(object.toString());
      }
      sb.append(GT);
      sb.append(value);
      sb.append(LT);
      sb.append(SLASH);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
 else     if (ConstructorUtils.isClassArray(type)) {
      tagName=validate(tagName == null ? "String_Node_Str" : tagName);
      int length=ArrayUtils.size((Object[])object);
      Class<?> elementType=ArrayUtils.type((Object[])object);
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
      for (int i=0; i < length; ++i) {
        sb.append(toXML(Array.get(object,i),makeElementName(elementType),level + 1,maxLevel,humanOutput,includeNulls,includeClass,includeClassField,properties));
      }
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(SLASH);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
 else     if (ConstructorUtils.isClassCollection(type)) {
      tagName=validate(tagName == null ? "String_Node_Str" : tagName);
      Collection<Object> collection=(Collection)object;
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
      for (      Object element : collection) {
        Class<?> elementType=null;
        if (element != null) {
          elementType=element.getClass();
        }
        sb.append(toXML(element,makeElementName(elementType),level + 1,maxLevel,humanOutput,includeNulls,includeClass,includeClassField,properties));
      }
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(SLASH);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
 else {
      tagName=validate(makeElementName(type) == null ? tagName : makeElementName(type));
      if (tagName.indexOf("String_Node_Str") > 0) {
        tagName=tagName.substring(0,tagName.indexOf("String_Node_Str"));
      }
      String special=TranscoderUtils.checkObjectSpecial(object);
      if (special != null) {
        if ("String_Node_Str".equals(special)) {
        }
 else {
          makeLevelSpaces(sb,level,humanOutput);
          sb.append(LT);
          sb.append(tagName);
          sb.append(GT);
          sb.append(escapeForXML(special));
          sb.append(LT);
          sb.append(SLASH);
          sb.append(tagName);
          sb.append(GT);
          makeEOL(sb,humanOutput);
        }
      }
 else {
        if (maxLevel <= level) {
          sb.append(LT);
          sb.append(tagName);
          sb.append(GT);
          sb.append("String_Node_Str");
          sb.append(level);
          sb.append("String_Node_Str");
          sb.append(escapeForXML(object.toString()));
          sb.append(LT);
          sb.append(SLASH);
          sb.append(tagName);
          sb.append(GT);
          makeEOL(sb,humanOutput);
        }
 else {
          String xmlType="String_Node_Str";
          Map<String,Object> map=null;
          if (Map.class.isAssignableFrom(type)) {
            xmlType="String_Node_Str";
            map=(Map<String,Object>)object;
          }
 else {
            map=ReflectUtils.getInstance().getObjectValues(object,FieldsFilter.SERIALIZABLE,false);
          }
          if (level == 0 && properties != null && !properties.isEmpty()) {
            map.putAll(properties);
          }
          makeLevelSpaces(sb,level,humanOutput);
          sb.append(LT);
          sb.append(tagName);
          if (includeClass) {
            makeClassName(sb,ConstructorUtils.getTypeFromInnerCollection(type));
          }
          sb.append(GT);
          makeEOL(sb,humanOutput);
          for (          Entry<String,Object> entry : map.entrySet()) {
            if (entry.getKey() != null) {
              sb.append(toXML(entry.getValue(),entry.getKey().toString(),level + 1,maxLevel,humanOutput,includeNulls,includeClass,includeClassField,properties));
            }
          }
          makeLevelSpaces(sb,level,humanOutput);
          sb.append(LT);
          sb.append(SLASH);
          sb.append(tagName);
          sb.append(GT);
          makeEOL(sb,humanOutput);
        }
      }
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected static String toXML(Object object,String tagName,int level,int maxLevel,boolean humanOutput,boolean includeNulls,boolean includeClass,boolean includeClassField,Map<String,Object> properties){
  StringBuilder sb=new StringBuilder();
  if (object == null) {
    if (includeNulls) {
      tagName=validate(tagName == null ? "String_Node_Str" : tagName);
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      sb.append(SLASH);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
  }
 else {
    Class<?> type=ConstructorUtils.getWrapper(object.getClass());
    if (ConstructorUtils.isClassSimple(type)) {
      if (level == 0) {
        tagName="String_Node_Str";
      }
 else {
        tagName=validate(tagName == null ? makeElementName(type) : tagName);
      }
      String value="String_Node_Str";
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      if (Date.class.isAssignableFrom(type) || Calendar.class.isAssignableFrom(type)) {
        Date d=null;
        if (Date.class.isAssignableFrom(type)) {
          d=(Date)object;
        }
 else {
          d=((Calendar)object).getTime();
        }
        value=d.getTime() + "String_Node_Str";
      }
 else       if (Number.class.isAssignableFrom(type)) {
        value=object.toString();
      }
 else       if (Boolean.class.isAssignableFrom(type)) {
        value=object.toString();
      }
 else {
        value=escapeForXML(object.toString());
      }
      sb.append(GT);
      sb.append(value);
      sb.append(LT);
      sb.append(SLASH);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
 else     if (ConstructorUtils.isClassArray(type)) {
      tagName=validate(tagName == null ? "String_Node_Str" : tagName);
      int length=ArrayUtils.size((Object[])object);
      Class<?> elementType=ArrayUtils.type((Object[])object);
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
      for (int i=0; i < length; ++i) {
        sb.append(toXML(Array.get(object,i),makeElementName(elementType),level + 1,maxLevel,humanOutput,includeNulls,includeClass,includeClassField,properties));
      }
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(SLASH);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
 else     if (ConstructorUtils.isClassCollection(type)) {
      tagName=validate(tagName == null ? "String_Node_Str" : tagName);
      Collection<Object> collection=(Collection)object;
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
      for (      Object element : collection) {
        Class<?> elementType=null;
        if (element != null) {
          elementType=element.getClass();
        }
        sb.append(toXML(element,makeElementName(elementType),level + 1,maxLevel,humanOutput,includeNulls,includeClass,includeClassField,properties));
      }
      makeLevelSpaces(sb,level,humanOutput);
      sb.append(LT);
      sb.append(SLASH);
      sb.append(tagName);
      sb.append(GT);
      makeEOL(sb,humanOutput);
    }
 else {
      if (level == 0) {
        String eleName=makeElementName(type);
        tagName=validate(eleName == null ? tagName : eleName);
      }
 else {
        tagName=validate(tagName == null ? makeElementName(type) : tagName);
      }
      if (tagName.indexOf("String_Node_Str") > 0) {
        tagName=tagName.substring(0,tagName.indexOf("String_Node_Str"));
      }
      String special=TranscoderUtils.checkObjectSpecial(object);
      if (special != null) {
        if ("String_Node_Str".equals(special)) {
        }
 else {
          makeLevelSpaces(sb,level,humanOutput);
          sb.append(LT);
          sb.append(tagName);
          sb.append(GT);
          sb.append(escapeForXML(special));
          sb.append(LT);
          sb.append(SLASH);
          sb.append(tagName);
          sb.append(GT);
          makeEOL(sb,humanOutput);
        }
      }
 else {
        if (maxLevel <= level) {
          sb.append(LT);
          sb.append(tagName);
          sb.append(GT);
          sb.append("String_Node_Str");
          sb.append(level);
          sb.append("String_Node_Str");
          sb.append(escapeForXML(object.toString()));
          sb.append(LT);
          sb.append(SLASH);
          sb.append(tagName);
          sb.append(GT);
          makeEOL(sb,humanOutput);
        }
 else {
          String xmlType="String_Node_Str";
          Map<String,Object> map=null;
          if (Map.class.isAssignableFrom(type)) {
            xmlType="String_Node_Str";
            map=(Map<String,Object>)object;
          }
 else {
            map=ReflectUtils.getInstance().getObjectValues(object,FieldsFilter.SERIALIZABLE,false);
          }
          if (level == 0 && properties != null && !properties.isEmpty()) {
            map.putAll(properties);
          }
          makeLevelSpaces(sb,level,humanOutput);
          sb.append(LT);
          sb.append(tagName);
          if (includeClass) {
            makeClassName(sb,ConstructorUtils.getTypeFromInnerCollection(type));
          }
          sb.append(GT);
          makeEOL(sb,humanOutput);
          for (          Entry<String,Object> entry : map.entrySet()) {
            if (entry.getKey() != null) {
              sb.append(toXML(entry.getValue(),entry.getKey().toString(),level + 1,maxLevel,humanOutput,includeNulls,includeClass,includeClassField,properties));
            }
          }
          makeLevelSpaces(sb,level,humanOutput);
          sb.append(LT);
          sb.append(SLASH);
          sb.append(tagName);
          sb.append(GT);
          makeEOL(sb,humanOutput);
        }
      }
    }
  }
  return sb.toString();
}