Program: 6442
Project: 6442
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 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. <p> If the Argument filePath is invalid (file non-existent) or null, parseIcsFile() will return null
 * @param filePath path to the .ics file to parse.
 * @return a linked list containing all WorkSessions extracted from inputfile.
 * @throws WaktuException
 */
public static ArrayList<WorkSession> parseIcsFile(final String filePath) throws WaktuException {
  ArrayList<WorkSession> calendar=new ArrayList<WorkSession>();
  BufferedReader br;
  try {
    br=new BufferedReader(new FileReader(new File(filePath)));
  }
 catch (  Exception e) {
    throw new WaktuException("String_Node_Str" + filePath);
  }
  String currentLine;
  try {
    while ((currentLine=br.readLine()) != null) {
      WorkSession tmpWs=null;
      if (currentLine.startsWith("String_Node_Str")) {
        tmpWs=new WorkSession();
        processEventLine(br,tmpWs);
        if (isValidWorkSession(tmpWs)) {
          calendar.add(tmpWs);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new WaktuException("String_Node_Str");
  }
  try {
    br.close();
  }
 catch (  IOException e) {
    throw new WaktuException("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. <p> If the Argument filePath is invalid (file non-existent) or null, parseIcsFile() will return null
 * @param filePath path to the .ics file to parse.
 * @return a linked list containing all WorkSessions extracted from inputfile.
 * @throws WaktuException
 */
public static ArrayList<WorkSession> parseIcsFile(final String filePath) throws WaktuException {
  ArrayList<WorkSession> calendar=new ArrayList<WorkSession>();
  BufferedReader br;
  try {
    br=new BufferedReader(new FileReader(new File(filePath)));
  }
 catch (  Exception e) {
    throw new WaktuException("String_Node_Str" + filePath);
  }
  String currentLine;
  try {
    while ((currentLine=br.readLine()) != null) {
      WorkSession tmpWs=null;
      if (currentLine.startsWith("String_Node_Str")) {
        tmpWs=new WorkSession();
        processEventLine(br,tmpWs);
        if (isValidWorkSession(tmpWs)) {
          calendar.add(tmpWs);
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  try {
    br.close();
  }
 catch (  IOException e) {
    throw new WaktuException("String_Node_Str");
  }
  return calendar;
}