try
{
int totalRows = studentSheet.getPhysicalNumberOfRows();
LOGGER.debug("Total Rows in Student Worksheet: " + totalRows);
// Verify the Header row exists and contains the right columns
XSSFRow headerRow = studentSheet.getRow(0);
// Cell A1: Year
String headerCell1 = headerRow.getCell(0).getStringCellValue();
// We're ignoring Cell B1 since it contains email--not stored at
// this time. Cell B1 should contain "Possible Email"
// Cell C1: Login Name
String headerCell2 = headerRow.getCell(2).getStringCellValue();
// Cell D1: First Name
String headerCell3 = headerRow.getCell(3).getStringCellValue();
// Cell E1: Last Name
String headerCell4 = headerRow.getCell(4).getStringCellValue();
// Cell F1: Section
String headerCell5 = headerRow.getCell(5).getStringCellValue();
if (headerCell1.isEmpty() || !headerCell1.equals("Year")
|| headerCell2.isEmpty() || !headerCell2.equals("Login Name")
|| headerCell3.isEmpty() || !headerCell3.equals("First Name")
|| headerCell4.isEmpty() || !headerCell4.equals("Last Name")
|| headerCell5.isEmpty() || !headerCell5.equals("Section"))
{
LOGGER.error("Student sheet is missing a proper header row");
} else
{
LOGGER.debug("Header information correct");
for (int i = 1; i < totalRows; i++)
{
LOGGER.debug("Parsing Student Row #" + i);
XSSFRow studentRow = studentSheet.getRow(i);
Student student = new Student();
student.setWebID(studentRow.getCell(2).getStringCellValue());
LOGGER.debug("Student Web ID: " + student.getWebID());
student.setFirstName(studentRow.getCell(3).getStringCellValue());
LOGGER.debug("Student First Name: " + student.getFirstName());
student.setLastName(studentRow.getCell(4).getStringCellValue());
LOGGER.debug("Student Last Name: " + student.getLastName());
Double tempClassYear = new Double(studentRow.getCell(0).getNumericCellValue());
LOGGER.debug("Class Year (Temp): " + tempClassYear);
student.setClassYear(new Integer(tempClassYear.intValue()));
LOGGER.debug("Student Class Year: " + student.getClassYear());
/**
* The assumption is that all Course Sections will be
* identified prior to loading students.
*/
Section importedSection = new Section();
importedSection.setName(studentRow.getCell(5).getStringCellValue());
importedSection.setCourse(course);
int sectionIndex = sections.indexOf(importedSection);
int studentIndex = students.indexOf(student);