I am trying to copy a DefaultListModel
contents into an array.
The following line causes the exception
testArray = (cGenIndicator[]) indObjList.toArray();
void testCasting() {
DefaultListModel<cGenIndicator> indObjList;
indObjList = new DefaultListModel<cGenIndicator>();
indObjList.addElement(new cGenIndicator(null, null));
cGenIndicator[] testArray;
try {
// This line causses exception saying
// [Ljava.lang.Object; cannot be cast to [LIndicator.cGenIndicator;
testArray = (cGenIndicator[]) indObjList.toArray();
} catch(Exception e) {
test++;
}
test++;
}