// fixme todo change all to XML serialization, so class versions are NOT an issue ! public void saveSerializedData() { // saveXML(); try { lastRace.setName(getName()); lastRace.saveSerializedData(); String filename = getName() + ".ser"; FileOutputStream fileOut = new FileOutputStream(filename); ObjectOutputStream out = new ObjectOutputStream( fileOut); /// MUST FIX 2016 Nationals ERROR CONCurrentMpdificationException out.writeObject( this); // See Ref#20161008 This was Line 913 BELOW on 20161008 //// This was line 869 // in bwlow Log -->> Got CONCurrentMpdificationException ///20160727 in test /* PRIOR CRASH Prior to 20161008 See bottom of source file for new carsh dump at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:329) at com.tcay.slalom.Race.saveSerializedData(Race.java:869) at com.tcay.slalom.Race.updateResults(Race.java:1177) at com.tcay.slalom.Race.updateResults(Race.java:1168) at com.tcay.slalom.RaceRun.updateResults(RaceRun.java:535) at com.tcay.slalom.RaceRun.setPhotoCellRaceRun(RaceRun.java:139) at com.tcay.slalom.Race.associatePhotoCellRun(Race.java:1163) at com.tcay.slalom.timingDevices.PhotoCellAgent.saveResult(PhotoCellAgent.java:57) at com.tcay.slalom.timingDevices.tagHeuer.TagHeuerAgent.processDeviceOutput(TagHeuerAgent.java:174) at com.tcay.RS232.PhotoEyeListener.readAndProcess(PhotoEyeListener.java:241) at com.tcay.RS232.PhotoEyeListener.processPhotoEyeDataFromDevice(PhotoEyeListener.java:190) at com.tcay.RS232.PhotoEyeListener.listenAndProcessPortOutput(PhotoEyeListener.java:304) at com.tcay.RS232.PhotoEyeListener.run(PhotoEyeListener.java:76) */ out.close(); fileOut.close(); log.trace("Saved serialized data to " + filename); } catch (IOException i) { i.printStackTrace(); } }
public void loadSerializedData() { // fixme Race x = loadXML(); // return; // lastRace.getName(); // RaceRun run; try { // lastRace.loadSerializedData(); String fileName = lastRace.getName(); FileInputStream fileIn = new FileInputStream(fileName + ".ser"); // "RaceRun.ser"); try { ObjectInputStream in = new ObjectInputStream(fileIn); deSerialize(in); in.close(); fileIn.close(); tagHeuerConnected = new Boolean(false); // / make sure it exists - transient object microgateConnected = new Boolean(false); // / make sure it exists - transient object } catch (InvalidClassException ice) { log.info("Invalid Class from deserialization " + ice.classname); } catch (EOFException eof) { log.info("EOF on Serialized data"); } catch (IOException i) { i.printStackTrace(); // } catch (ClassNotFoundException cnf) { // cnf.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } catch (FileNotFoundException fnf) { // Empty block OK - ignore this exception } // load required transient members Log raceRunLog = Log.getInstance(); for (RaceRun r : activeRuns) { r.setLog(raceRunLog); } for (RaceRun r : completedRuns) { r.setLog(raceRunLog); } if (pendingRerun != null) { pendingRerun.setLog(raceRunLog); } // updateResults(); //todo OK Here ??? NO - didn't set }
public void setName(String name) { this.name = name; lastRace.setName(name); lastRace.saveSerializedData(); }