Program: 6486
Project: 6486
Buggy source:
/** 
 * Parses contents of an .ics file which is used in iCal, Outlook, etc. <p> <b>ICS FILE FORMAT:</b><br> An .ics file consists of multiple lines, each line beginning with a tag.  <p> <b>EXAMPLE WORKSESSION:</b> <br> BEGIN:VEVENT<br> CREATED:20100809T062219Z<br> UID:2DE909B3-96C6-4D7B-BB99-5CA7487C43A2<br> DTEND;TZID=Europe/Zurich:20100810T115000<br> TRANSP:OPAQUE<br> SUMMARY:Prog2<br> DTSTART;TZID=Europe/Zurich:20100810T101000<br> DTSTAMP:20100809T062304Z<br> SEQUENCE:4<br> END:VEVENT <p> An WorkSession starts with the tag "BEGIN:VEVENT" and should be closed by "END:VEVENT". A missing "END:VEVENT" could lead to missing WorkSessions as startTime and endTime might be overwritten. <p> Within a WorkSession the following tags may occur in any order: <ul> <li>SUMMARY:* 		WorkSession Name <li>DTEND;...:* 		End time <li>DTSTART;...:* 	Start time <li>RRULE:			Indicates a recurring WorkSession						 </ul> *: Mandatory tags <p> All other tags are ignored.
 * @param filePath path to the .ics file to parse.
 * @return a linked list containing all WorkSessions extracted from input file.
 */
public static LinkedList<WorkSession> parseIcsFile(String filePath){
  BufferedReader br;
  try {
    br=new BufferedReader(new FileReader(new File(filePath)));
    String currentLine;
    try {
      while ((currentLine=br.readLine()) != null) {
        WorkSession tmpWs=null;
        if (currentLine.startsWith("String_Node_Str")) {
          tmpWs=new WorkSession();
          int eventCount=1;
          int eventInterval=0;
          String eventFrequency="String_Node_Str";
          while (!((currentLine=br.readLine()) == null || currentLine.startsWith("String_Node_Str"))) {
            if (currentLine.contains("String_Node_Str")) {
              tmpWs.setDescription(stripTag(currentLine));
            }
 else             if (currentLine.startsWith("String_Node_Str")) {
              QDateTime startTime=stringToQDateTime(currentLine);
              tmpWs.setStart(TimeUtil.convertQDateTimeCalToGregorianCal(startTime));
            }
 else             if (currentLine.startsWith("String_Node_Str")) {
              QDateTime endTime=stringToQDateTime(currentLine);
              tmpWs.setEnd(TimeUtil.convertQDateTimeCalToGregorianCal(endTime));
            }
 else             if (currentLine.startsWith("String_Node_Str")) {
              eventCount=getRecurringEventCount(currentLine);
              eventFrequency=getRecurringEventFrequency(currentLine);
              eventInterval=getRecurringEventInterval(currentLine);
            }
          }
          for (int i=0; i < eventCount; i++) {
            calendar.add(tmpWs);
            if (eventCount > 1) {
              tmpWs=createSubsequentWorkSession(tmpWs,eventFrequency,eventInterval,eventCount);
            }
          }
        }
      }
    }
 catch (    Exception e) {
    }
    try {
      br.close();
    }
 catch (    IOException e) {
      System.out.println("String_Node_Str");
    }
  }
 catch (  FileNotFoundException e) {
    System.out.println("String_Node_Str" + filePath + "String_Node_Str");
  }
  return calendar;
}

Fixed version (ground truth):
/** 
 * Parses contents of an .ics file which is used in iCal, Outlook, etc. <p> <b>ICS FILE FORMAT:</b><br> An .ics file consists of multiple lines, each line beginning with a tag.  <p> <b>EXAMPLE EVENT:</b> <br> BEGIN:VEVENT<br> CREATED:20100809T062219Z<br> UID:2DE909B3-96C6-4D7B-BB99-5CA7487C43A2<br> DTEND;TZID=Europe/Zurich:20100810T115000<br> TRANSP:OPAQUE<br> SUMMARY:Prog2<br> DTSTART;TZID=Europe/Zurich:20100810T101000<br> DTSTAMP:20100809T062304Z<br> SEQUENCE:4<br> END:VEVENT <p> An WorkSession starts with the tag "BEGIN:VEVENT" and should be closed by "END:VEVENT". A missing "END:VEVENT" could lead to missing WorkSessions as startTime and endTime might be overwritten. <p> Within a WorkSession the following tags may occur in any order: <ul> <li>SUMMARY:* 		WorkSession Name <li>DTEND;...:* 		End time <li>DTSTART;...:* 	Start time </ul> *: Mandatory tags <p> All other tags are ignored.
 * @param filePath path to the .ics file to parse.
 * @return a linked list containing all WorkSessions extracted from input file.
 */
public static LinkedList<WorkSession> parseIcsFile(String filePath){
  BufferedReader br;
  try {
    br=new BufferedReader(new FileReader(new File(filePath)));
    String currentLine;
    try {
      while ((currentLine=br.readLine()) != null) {
        WorkSession tmpWs=null;
        if (currentLine.startsWith("String_Node_Str")) {
          tmpWs=new WorkSession();
          while (!((currentLine=br.readLine()) == null || currentLine.startsWith("String_Node_Str"))) {
            if (currentLine.contains("String_Node_Str")) {
              tmpWs.setDescription(stripTag(currentLine));
            }
 else             if (currentLine.startsWith("String_Node_Str")) {
              QDateTime startTime=stringToQDateTime(currentLine);
              tmpWs.setStart(TimeUtil.convertQDateTimeCalToGregorianCal(startTime));
            }
 else             if (currentLine.startsWith("String_Node_Str")) {
              QDateTime endTime=stringToQDateTime(currentLine);
              tmpWs.setEnd(TimeUtil.convertQDateTimeCalToGregorianCal(endTime));
            }
          }
          if (isValidWorkSession(tmpWs)) {
            calendar.add(tmpWs);
          }
        }
      }
    }
 catch (    Exception e) {
    }
    try {
      br.close();
    }
 catch (    IOException e) {
      System.out.println("String_Node_Str");
    }
  }
 catch (  FileNotFoundException e) {
    System.out.println("String_Node_Str" + filePath + "String_Node_Str");
  }
  return calendar;
}