Program: 5266
Project: 5266
Buggy source:
/** 
 * converts to a list.   will convert: Collection Enumeration Object[] String (will split based on delimiters). in all other cases: Will return null on null value. otherwise will return a list of length 1, with the value
 * @param obj
 * @param delimiters
 * @return
 */
public static List toList(Object obj,String... delimiters){
  Object val=obj;
  if (val == null)   return null;
  List list=new ArrayList();
  if (val instanceof List) {
    list=(List)val;
  }
 else   if (val instanceof String[]) {
    String str=TypeCast.cast(String.class,val);
    if (str != null && StringHelper.contains(str,delimiters)) {
      return toList(str,delimiters);
    }
    for (int i=0; i < ((Object[])val).length; i++) {
      Object tmp=(((Object[])val)[i]);
      if (tmp != null)       list.add(tmp);
    }
  }
 else   if (val instanceof Object[]) {
    for (int i=0; i < ((Object[])val).length; i++) {
      Object tmp=(((Object[])val)[i]);
      if (tmp != null)       list.add(tmp);
    }
  }
 else   if (val instanceof Collection) {
    for (    Object tmp : (Collection)val) {
      if (tmp != null)       list.add(tmp);
    }
  }
 else   if (obj instanceof String) {
    String str=TypeCast.cast(String.class,val);
    if (str == null || str.isEmpty())     return null;
    if (str.startsWith("String_Node_Str") && str.endsWith("String_Node_Str")) {
      try {
        Object jsonobj=JSONValue.parseWithException(str);
        return toList(jsonobj,delimiters);
      }
 catch (      Exception x) {
        return null;
      }
    }
    if (delimiters != null && delimiters.length > 0)     list.addAll(StringHelper.split(str,delimiters));
  }
 else   if (obj instanceof Enumeration) {
    Enumeration e=(Enumeration)obj;
    while (e.hasMoreElements()) {
      list.add(e.nextElement());
    }
  }
  if (list != null && list.isEmpty()) {
    list.add(obj);
  }
  if (list != null && !list.isEmpty())   return list;
  return null;
}

Fixed version (ground truth):
/** 
 * converts to a list.   will convert: Collection Enumeration Object[] String (will split based on the passed in delimiters). in all other cases: Will return null on null value or empty lists otherwise will return a list of length 1, with the value
 * @param obj
 * @param delimiters
 * @return
 */
public static List toList(Object obj,String... delimiters){
  Object val=obj;
  if (val == null)   return null;
  List list=new ArrayList();
  if (val instanceof List) {
    list=(List)val;
  }
 else   if (val instanceof String[]) {
    String str=TypeCast.cast(String.class,val);
    if (str != null && StringHelper.contains(str,delimiters)) {
      return toList(str,delimiters);
    }
    for (int i=0; i < ((Object[])val).length; i++) {
      Object tmp=(((Object[])val)[i]);
      if (tmp != null)       list.add(tmp);
    }
  }
 else   if (val instanceof Object[]) {
    for (int i=0; i < ((Object[])val).length; i++) {
      Object tmp=(((Object[])val)[i]);
      if (tmp != null)       list.add(tmp);
    }
  }
 else   if (val instanceof Collection) {
    for (    Object tmp : (Collection)val) {
      if (tmp != null)       list.add(tmp);
    }
  }
 else   if (obj instanceof String) {
    String str=TypeCast.cast(String.class,val);
    if (str == null || str.isEmpty())     return null;
    if (str.startsWith("String_Node_Str") && str.endsWith("String_Node_Str")) {
      try {
        Object jsonobj=JSONValue.parseWithException(str);
        return toList(jsonobj,delimiters);
      }
 catch (      Exception x) {
        return null;
      }
    }
    if (delimiters != null && delimiters.length > 0)     list.addAll(StringHelper.split(str,delimiters));
    if (list.isEmpty())     list.add(str);
  }
 else   if (obj instanceof Enumeration) {
    Enumeration e=(Enumeration)obj;
    while (e.hasMoreElements()) {
      list.add(e.nextElement());
    }
  }
 else {
    list.add(obj);
  }
  if (list != null && !list.isEmpty())   return list;
  return null;
}