The ObjectInputStre am in this code is giving a EOFException. Do I need to do anything special to get this to work withou the EOF exception? It gives the exception at the line of the first instance of ObjectInputStre am.
public static ArrayListSerial getList() {
try {
try{
try {
ObjectInputStre am in = new ObjectInputStre am(new BufferedInputSt ream(new FileInputStream ("J:\\collectib les.dat")));
Object inObject;
inObject = in.readObject() ;
if(inObject instanceof ArrayListSerial ){
ArrayListSerial inObject2 = (ArrayListSeria l)inObject;
return inObject2;
}
}catch(EOFExcep tion z){
System.out.prin tln("Not");
z.printStackTra ce();
}
} catch (ClassNotFoundE xception e) {
e.printStackTra ce();
}
} catch (FileNotFoundEx ception e) {
ArrayListSerial collectibles = new ArrayListSerial (100);
item item = new item();
item.changeName ("test");
collectibles.ad d(item);
saveList(collec tibles);
e.printStackTra ce();
return collectibles;
}
return null;
}
public static ArrayListSerial getList() {
try {
try{
try {
ObjectInputStre am in = new ObjectInputStre am(new BufferedInputSt ream(new FileInputStream ("J:\\collectib les.dat")));
Object inObject;
inObject = in.readObject() ;
if(inObject instanceof ArrayListSerial ){
ArrayListSerial inObject2 = (ArrayListSeria l)inObject;
return inObject2;
}
}catch(EOFExcep tion z){
System.out.prin tln("Not");
z.printStackTra ce();
}
} catch (ClassNotFoundE xception e) {
e.printStackTra ce();
}
} catch (FileNotFoundEx ception e) {
ArrayListSerial collectibles = new ArrayListSerial (100);
item item = new item();
item.changeName ("test");
collectibles.ad d(item);
saveList(collec tibles);
e.printStackTra ce();
return collectibles;
}
return null;
}
Comment