From: Nick C. <ni...@sr...> - 2001-08-06 15:06:37
|
We've had email problems (fixed now) and this didn't go through, so I've resent it. Hi, What's probably happening here is that because the sim hasn't actually started yet, fireStopSim() doesn't stop it. I'll check this out on monday. What you can do is a System.exit(0) in place of fireStopSim which will shut the whole thing down. If this also closes the dos terminal that you used to start the sim (clicking on a bat file), you can add pause as the last line of the batch file. You could also do a SimUtilities.showError(...) before System.exit which will show the error in dialog. See the api docs for SimUtilities. Regardeless, fireStopSim should stop the sim when called in begin so I'll check it out and fix it if necessary. Nick On Fri, Aug 03, 2001 at 02:16:17PM -0600, Wim Hordijk wrote: > I have a question about when something goes wrong in the buildModel > routine. I'm still learning about exception handling in Java, so maybe I > am just doing something wrong (but so far I still prefer the good-old > c-style of returning error codes...). Anyway, the begin routine calls > buildModel, but suppose something goes wrong for example when buildModel > needs to read something from a file and it can't find the file. It throws > an IOException, which is then caught by the begin routine. Since the model > could not be setup correctly, it should not be running. So I tried the > following (somewhat simplified here for clarity): > > public void begin () > { > try > { > buildModel (); > } > catch (IOException e) > { > System.out.println ("Error: " + e); > this.fireStopSim (); > return; > } > buildDisplay (); > buildSchedule (); > : > : // display stuff here... > } > > When an IOException occurs, it indeed skips the buildDisplay and > buildSchedule part, as expected, but the tick count in the Repast panel is > running! Is there a better way to do what I am trying to do here, or am I > just not understanding exception handling well enough? > > Wim > > > > _______________________________________________ > Repast-interest mailing list > Rep...@li... > http://lists.sourceforge.net/lists/listinfo/repast-interest -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |