Program: 96220
Project: 96220
Buggy source:
/** 
 * @return the parsed out CSS, or NULL
 */
public static Css parse(final String css){
  if (css == null) {
    return null;
  }
  List<Entry> colorDefinitions=getColorDefinition(css);
  int endOfColorDefinitions=css.indexOf("String_Node_Str");
  for (int lineStart=endOfColorDefinitions; lineStart > 0; lineStart--) {
    if (css.charAt(lineStart) == '\n') {
      endOfColorDefinitions=lineStart + 1;
      break;
    }
  }
  List<CssNode> sections=new ArrayList<CssNode>();
  int index=endOfColorDefinitions;
  int length=css.length();
  do {
    int endOfNodeLabels=css.indexOf("String_Node_Str",index);
    if (endOfNodeLabels == -1) {
      break;
    }
    int endOfSection=css.indexOf("String_Node_Str",endOfNodeLabels + 1) + 1;
    int endOfSectionTest=css.indexOf("String_Node_Str",index) + 1;
    if (endOfSection != endOfSectionTest) {
      index=endOfSection;
      continue;
    }
    for (int lineStart=index; lineStart > 0; lineStart--) {
      if (css.charAt(lineStart) == '\n') {
        index=lineStart + 1;
        break;
      }
    }
    String nodeLabel=css.substring(index,endOfNodeLabels).trim();
    List<Entry> attributes=new ArrayList<Entry>();
    String nodeSection=css.substring(endOfNodeLabels,endOfSection);
    int sectionStart=nodeSection.indexOf('{') + 1;
    int sectionEnd=nodeSection.indexOf('}');
    while (sectionStart != -1) {
      int end=nodeSection.indexOf(';',sectionStart);
      if (end != -1) {
        int separator=nodeSection.indexOf(':',sectionStart);
        if (separator < end) {
          short parenCount=0;
          int j=separator;
          while (j < end) {
            j++;
            char c=nodeSection.charAt(j);
            if (c == '(') {
              parenCount++;
            }
 else             if (c == ')') {
              parenCount--;
            }
          }
          j--;
          if (parenCount > 0) {
            do {
              if (nodeSection.charAt(j) == ')') {
                parenCount--;
              }
              j++;
            }
 while (parenCount > 0 && j < sectionEnd);
          }
          end=j + 1;
          String key=nodeSection.substring(sectionStart,separator);
          String value=nodeSection.substring(separator + 1,end);
          attributes.add(new Entry(key,value));
        }
        sectionStart=end + 1;
      }
 else {
        break;
      }
    }
    int multiIndex=nodeLabel.indexOf(',');
    if (multiIndex != -1) {
      multiIndex=0;
      while (multiIndex != -1) {
        int multiEndIndex=nodeLabel.indexOf(',',multiIndex);
        if (multiEndIndex != -1) {
          String newLabel=nodeLabel.substring(multiIndex,multiEndIndex);
          sections.add(new CssNode(newLabel,attributes));
          multiIndex=multiEndIndex + 1;
        }
 else {
          String newLabel=nodeLabel.substring(multiIndex);
          sections.add(new CssNode(newLabel,attributes));
          multiIndex=-1;
        }
      }
    }
 else {
      sections.add(new CssNode(nodeLabel,attributes));
    }
    index=endOfSection;
  }
 while (index < length);
  for (Iterator<CssNode> iterator=sections.iterator(); iterator.hasNext(); ) {
    final CssNode section=iterator.next();
    if (section != null) {
      String label=section.label;
      for (int i=0; i < sections.size(); i++) {
        final CssNode section2=sections.get(i);
        if (section != section2 && section2 != null && label.equals(section2.label)) {
          sections.set(i,null);
          for (          Entry attribute : section.attributes) {
            for (Iterator<Entry> iterator2=section2.attributes.iterator(); iterator2.hasNext(); ) {
              final Entry attribute2=iterator2.next();
              if (attribute.equals(attribute2)) {
                iterator2.remove();
                break;
              }
            }
          }
          section.attributes.addAll(section2.attributes);
        }
      }
    }
 else {
      iterator.remove();
    }
  }
  for (Iterator<CssNode> iterator=sections.iterator(); iterator.hasNext(); ) {
    final CssNode section=iterator.next();
    for (Iterator<Entry> iterator1=section.attributes.iterator(); iterator1.hasNext(); ) {
      final Entry attribute=iterator1.next();
      if (attribute == null) {
        iterator1.remove();
      }
    }
    if (section.attributes.isEmpty()) {
      iterator.remove();
    }
  }
  return new Css(colorDefinitions,sections);
}

Fixed version (ground truth):
/** 
 * @return the parsed out CSS, or NULL
 */
public static Css parse(final String css){
  if (css == null) {
    return null;
  }
  List<Entry> colorDefinitions=getColorDefinition(css);
  int endOfColorDefinitions=css.indexOf("String_Node_Str");
  for (int lineStart=endOfColorDefinitions; lineStart > 0; lineStart--) {
    if (css.charAt(lineStart) == '\n') {
      endOfColorDefinitions=lineStart + 1;
      break;
    }
  }
  List<CssNode> sections=new ArrayList<CssNode>();
  int index=endOfColorDefinitions;
  int length=css.length();
  do {
    int endOfNodeLabels=css.indexOf("String_Node_Str",index);
    if (endOfNodeLabels == -1) {
      break;
    }
    int endOfSection=css.indexOf("String_Node_Str",endOfNodeLabels + 1) + 1;
    int endOfSectionTest=css.indexOf("String_Node_Str",index) + 1;
    if (endOfSection != endOfSectionTest) {
      index=endOfSection;
      continue;
    }
    for (int lineStart=index; lineStart > 0; lineStart--) {
      if (css.charAt(lineStart) == '\n') {
        index=lineStart + 1;
        break;
      }
    }
    String nodeLabel=css.substring(index,endOfNodeLabels).trim();
    List<Entry> attributes=new ArrayList<Entry>();
    String nodeSection=css.substring(endOfNodeLabels,endOfSection);
    int sectionStart=nodeSection.indexOf('{') + 1;
    int sectionEnd=nodeSection.indexOf('}');
    while (sectionStart != -1) {
      int end=nodeSection.indexOf(';',sectionStart);
      if (end != -1) {
        int separator=nodeSection.indexOf(':',sectionStart);
        if (separator < end) {
          short parenCount=0;
          int j=separator;
          while (j < end) {
            j++;
            char c=nodeSection.charAt(j);
            if (c == '(') {
              parenCount++;
            }
 else             if (c == ')') {
              parenCount--;
            }
          }
          j--;
          if (parenCount > 0) {
            do {
              if (nodeSection.charAt(j) == ')') {
                parenCount--;
              }
              j++;
            }
 while (parenCount > 0 && j < sectionEnd);
          }
          end=j + 1;
          String key=nodeSection.substring(sectionStart,separator);
          String value=nodeSection.substring(separator + 1,end);
          attributes.add(new Entry(key,value));
        }
        sectionStart=end + 1;
      }
 else {
        break;
      }
    }
    int multiIndex=nodeLabel.indexOf(',');
    if (multiIndex != -1) {
      multiIndex=0;
      while (multiIndex != -1) {
        int multiEndIndex=nodeLabel.indexOf(',',multiIndex);
        if (multiEndIndex != -1) {
          String newLabel=nodeLabel.substring(multiIndex,multiEndIndex);
          sections.add(new CssNode(newLabel,attributes));
          multiIndex=multiEndIndex + 1;
        }
 else {
          String newLabel=nodeLabel.substring(multiIndex);
          sections.add(new CssNode(newLabel,attributes));
          multiIndex=-1;
        }
      }
    }
 else {
      sections.add(new CssNode(nodeLabel,attributes));
    }
    index=endOfSection;
  }
 while (index < length);
  for (Iterator<CssNode> iterator=sections.iterator(); iterator.hasNext(); ) {
    final CssNode section=iterator.next();
    if (section != null) {
      String label=section.label;
      for (int i=0; i < sections.size(); i++) {
        final CssNode section2=sections.get(i);
        if (section != section2 && section2 != null && label.equals(section2.label)) {
          sections.set(i,null);
          final List<Entry> attributes=section.attributes;
          for (int i1=0; i1 < attributes.size(); i1++) {
            final Entry attribute=attributes.get(i1);
            for (Iterator<Entry> iterator2=section2.attributes.iterator(); iterator2.hasNext(); ) {
              final Entry attribute2=iterator2.next();
              if (attribute.equals(attribute2)) {
                iterator2.remove();
                break;
              }
            }
          }
          section.attributes.addAll(section2.attributes);
        }
      }
    }
 else {
      iterator.remove();
    }
  }
  for (Iterator<CssNode> iterator=sections.iterator(); iterator.hasNext(); ) {
    final CssNode section=iterator.next();
    for (Iterator<Entry> iterator1=section.attributes.iterator(); iterator1.hasNext(); ) {
      final Entry attribute=iterator1.next();
      if (attribute == null) {
        iterator1.remove();
      }
    }
    if (section.attributes.isEmpty()) {
      iterator.remove();
    }
  }
  return new Css(colorDefinitions,sections);
}