}
}
public void saveICal(SemesterTimetable t) {
FileOutputStream fout = null;
CalendarOutputter outputter;
String fileName, parent;
File f;
if (t.getOwnerName() != null && t.getSemester() != null) {
fileName = t.getOwnerName().toLowerCase().replace(" ", "-")
+ "_yr" + t.getAcademicYear().replace("/", "-")
+ t.getSemester().toLowerCase().replace(" ", "-") + "_";
} else {
fileName = "ntu_timetable";
}
fileName += ".ics";
f = new File(t.getPath());
parent = f.getParent();
if (!parent.endsWith(File.separator)) {
parent += File.separator;
}
fileName = parent + fileName;
try {
fout = new FileOutputStream(fileName);
outputter = new CalendarOutputter();
//System.out.println(t.toICal().toString());
outputter.output(t.toICal(), fout);
} catch (IOException e) {
e.printStackTrace();
} catch (ValidationException e) {
e.printStackTrace();
} finally {