奇怪的空指针异常
程序代码:
public void commandAction(Command cmd, Displayable d) { if(cmd == cmdBack){ display.setCurrent(mainList); } else{ Form form = new Form("kchb"); String strWeek = listAll.getString(listAll.getSelectedIndex()); byte[] recordArray; ClassHandle ch = new ClassHandle(); ch.setWeek(strWeek); int numRecords; ClassInfo[] ci; StringItem[] si; try { RecordStore rs = RecordStore.openRecordStore("kchb", true); RecordEnumeration re = rs.enumerateRecords(null, null, false); numRecords = re.numRecords(); System.out.println(numRecords); ci = new ClassInfo[numRecords]; si = new StringItem[numRecords]; for(int i = 0;i<numRecords;i++){ recordArray = re.nextRecord(); ci[i] = ch.deserialize(recordArray); } rs.closeRecordStore(); for(int i= 0;i<numRecords;i++){ si[i].setText("\n 课程 " + ci[i].getName() + "\n 任课教师: " + ci[i].getTeacher() + "\n 教室: " + ci[i].getRoom() + "\n 时间: " + ci[i].getTime() +"\n 附加信息:"+ ci[i].getExtra() ); form.append(si[i]); form.append(new Spacer(1,10)); } display.setCurrent(form); } catch (RecordStoreFullException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RecordStoreNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RecordStoreNotOpenException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidRecordIDException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RecordStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }出现java.lang.NullPointerException
at curriculum.(+253)
at javax.microedition.lcdui.List.callKeyPressed(+80)
请问是怎么回事?所有的对象我都new了啊。