널 포인터 예외가 발생하지만 이유는 알 수 없습니다. 문자열을 읽기 전에 셀이 null인지 확인했습니다. 그래서, 왜 그 문자열은 null입니까?Null 포인터 예외
private void fillArray()
{
try
{
readBook = new HSSFWorkbook(readFile);
}
catch (IOException e)
{
System.out.println("If we know what we're doing, no one should ever see this line.");
}
if (readBook != null)
{HSSFSheet infoSheet = readBook.getSheetAt(0);
HSSFRow headingsRow = infoSheet.getRow(0);
int i = 0;
HSSFCell cell = headingsRow.getCell(i);
String columnHeading = cell.toString();
while (cell != null && !(cell.toString().equals("")))
{
cell = headingsRow.getCell(i);
columnHeading = cell.toString();
columnHeadings.add(columnHeading);
i++;
}
if(columnListIsSetup == false)
{
createList();
columnListIsSetup = true;
}
}
NullPointerException이 던지는 * 수 * 많은 장소가있다 - 무엇을 스택 트레이스가 말하는가? –
예외 추적은 columnHeading = cell.toString(); – user1507835
그러면'cell'이 null인지 아니면'toString' 내에 던져 졌는지 보여줍니다. –