From: Erik V. <eri...@xs...> - 2011-04-01 10:14:34
|
The 'rails' stack trace lines in question were: at rails.game.MapHex.addHome(MapHex.java:963) at rails.game.MapManager.finishConfiguration(MapManager.java:153) at rails.game.Game.setup(Game.java:188) at rails.ui.swing.GameSetupWindow.startNewGame(GameSetupWindow.java:481) at rails.ui.swing.GameSetupWindow.actionPerformed(GameSetupWindow.java:237) and usually the error is pointed to by the first of such lines. I have committed a fix that adds a check of the home city number against the number of cities in the current hex/tile. An error now throws a ConfigurationException, which will be catched and cause a popup to display an appropriate message. It might be a good idea to scan all 'finishConfiguration()' methods for such inconsistent XML values, and perhaps the 'configureFromXML()' methods may also need a sharper look. This fix may serve as an example. Volunteers? Erik. > -----Oorspronkelijk bericht----- > Van: Games on the Brain [mailto:gam...@gm...] > Verzonden: vrijdag 1 april 2011 2:15 > Aan: Development list for Rails: an 18xx game > CC: brett lentz > Onderwerp: Re: [Rails-devel] Tracking Down Errors > > Found it. The problem was actually in the CompanyManager, as I had > accidentally left a city="2" in a HomeHex attribute. > > Thanks! > > -Tim > > > > On Thu, Mar 31, 2011 at 7:30 PM, Games on the Brain > <gam...@gm...> wrote: > >> There's only three lines in the stack trace relevant to the rails > >> code itself, so those are likely to be where the error is. From > >> there, it's just a matter of understanding what the code is doing or > >> could have been doing that would have caused the failure. > > > > Which three lines in this case? > > > > -Tim > > > > > > > > > > On Thu, Mar 31, 2011 at 7:28 PM, brett lentz <bre...@gm...> > wrote: > >> Yes, the output that generates a list of related method/function > >> calls that caused the error is called a "stack trace". It traces > >> it's way up the call stack. > >> > >> There's only three lines in the stack trace relevant to the rails > >> code itself, so those are likely to be where the error is. From > >> there, it's just a matter of understanding what the code is doing or > >> could have been doing that would have caused the failure. > >> > >> ---Brett. > >> > >> > >> > >> On Thu, Mar 31, 2011 at 4:21 PM, Games on the Brain > >> <gam...@gm...> wrote: > >>> I presume you got that from the console lines that I copied? Is that > >>> what you call a stack trace? > >>> > >>> If so, could you explain how you found that one specific line from > >>> the list I gave you? > >>> > >>> -Tim > >>> > >>> > >>> > >>> On Thu, Mar 31, 2011 at 6:11 PM, Erik Vos <eri...@xs...> wrote: > >>>> The stack trace points to this line in the code where home cities > >>>> are > >>>> assigned: > >>>> > >>>> City homeCity = cities.get(Math.max(cityNumber - 1, > >>>> 0)); > >>>> > >>>> So It looks like city="2" has been specified for a tile that has > >>>> only one city. > >>>> > >>>> Erik. > >>>> > >>>>> -----Oorspronkelijk bericht----- > >>>>> Van: Games on the Brain [mailto:gam...@gm...] > >>>>> Verzonden: donderdag 31 maart 2011 23:24 > >>>>> Aan: Development list for Rails: an 18xx game > >>>>> Onderwerp: [Rails-devel] Tracking Down Errors > >>>>> > >>>>> I'm having a hard time tracking down an error in a prototype I'm > >>>> developing > >>>>> on Rails: > >>>>> > >>>>> Game setup from file Game.xml failed: > >>>>> Index: 1, Size: 1 > >>>>> > >>>>> I actually add lines to the Game.xml file one by one until I got > >>>>> that > >>>> error and it > >>>>> occurs when I add the following: > >>>>> > >>>>> <Component name="TileManager" class="rails.game.TileManager" > >>>>> file="TileSet.xml"/> > >>>>> > >>>>> Thus, I suspect the problem is either in the Tiles.xml file or the > >>>> TileSet.xml > >>>>> file. > >>>>> > >>>>> I copied those files from 1830 and removed all the <IfOption> > statements. > >>>>> I'm also pretty sure that all tiles that are in Tiles.xml are in > >>>> TileSet.xml as well. > >>>>> And all the tiles that are on my map are in them too. > >>>>> > >>>>> Any ideas how I can track it down? I don't know if it will help, > >>>>> but here > >>>> is what > >>>>> comes up in the Eclipse console: > >>>>> > >>>>> > >>>>> Loading games list from GamesList.xml > >>>>> Index: 1, Size: 1 > >>>>> java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 > >>>>> at java.util.ArrayList.RangeCheck(ArrayList.java:546) > >>>>> at java.util.ArrayList.get(ArrayList.java:321) > >>>>> at rails.game.MapHex.addHome(MapHex.java:963) > >>>>> at > >>>>> rails.game.MapManager.finishConfiguration(MapManager.java:153) > >>>>> at rails.game.Game.setup(Game.java:188) > >>>>> at > >>>>> > rails.ui.swing.GameSetupWindow.startNewGame(GameSetupWindow.java: > >>>>> 481) > >>>>> at > >>>>> > rails.ui.swing.GameSetupWindow.actionPerformed(GameSetupWindow.jav > >>>>> a:237) > >>>>> at > >>>>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java > >>>>> :1882) > >>>>> at > >>>>> > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton. > >>>>> java:2 > >>>>> 202) > >>>>> at > >>>>> > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel. > >>>>> java:420) > >>>>> at > >>>>> > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java: > >>>>> 258) > >>>>> at > >>>>> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButt > >>>>> onListe > >>>>> ner.java:246) > >>>>> at > java.awt.Component.processMouseEvent(Component.java:5617) > >>>>> at > >>>>> > javax.swing.JComponent.processMouseEvent(JComponent.java:3129) > >>>>> at java.awt.Component.processEvent(Component.java:5382) > >>>>> at java.awt.Container.processEvent(Container.java:2010) > >>>>> at java.awt.Component.dispatchEventImpl(Component.java:4083) > >>>>> at java.awt.Container.dispatchEventImpl(Container.java:2068) > >>>>> at java.awt.Component.dispatchEvent(Component.java:3918) > >>>>> at > >>>>> > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4 > >>>>> 256) > >>>>> at > >>>>> > java.awt.LightweightDispatcher.processMouseEvent(Container.java:39 > >>>>> 36) > >>>>> at > >>>>> java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866) > >>>>> at java.awt.Container.dispatchEventImpl(Container.java:2054) > >>>>> at java.awt.Window.dispatchEventImpl(Window.java:1801) > >>>>> at java.awt.Component.dispatchEvent(Component.java:3918) > >>>>> at > >>>>> java.awt.EventQueue.dispatchEventImpl(EventQueue.java:501) > >>>>> at java.awt.EventQueue.access$000(EventQueue.java:80) > >>>>> at java.awt.EventQueue$1.run(EventQueue.java:462) > >>>>> at java.awt.EventQueue$1.run(EventQueue.java:461) > >>>>> at java.security.AccessController.doPrivileged(Native > >>>>> Method) > >>>>> at > >>>>> java.security.AccessControlContext$1.doIntersectionPrivilege(Acces > >>>>> sControl > >>>>> Context.java:84) > >>>>> at > >>>>> java.security.AccessControlContext$1.doIntersectionPrivilege(Acces > >>>>> sControl > >>>>> Context.java:95) > >>>>> at java.awt.EventQueue$2.run(EventQueue.java:476) > >>>>> at java.awt.EventQueue$2.run(EventQueue.java:475) > >>>>> at java.security.AccessController.doPrivileged(Native > >>>>> Method) > >>>>> at > >>>>> java.security.AccessControlContext$1.doIntersectionPrivilege(Acces > >>>>> sControl > >>>>> Context.java:84) > >>>>> at java.awt.EventQueue.dispatchEvent(EventQueue.java:473) > >>>>> at > >>>>> > java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatc > >>>>> hT > >>>>> hread.java:269) > >>>>> at > >>>>> > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchT > >>>>> hre > >>>>> ad.java:190) > >>>>> at > >>>>> > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:1 > >>>>> 84) > >>>>> at > >>>>> > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:1 > >>>>> 76) > >>>>> at > >>>>> java.awt.EventDispatchThread.run(EventDispatchThread.java:110) > >>>>> > >>>>> > >>>> ------------------------------------------------------------------- > >>>> --------- > >>>> -- > >>>>> Create and publish websites with WebMatrix Use the most popular > >>>>> FREE web apps or write code yourself; WebMatrix provides all the > >>>>> features you need to develop and publish your website. > >>>>> http://p.sf.net/sfu/ms- webmatrix-sf > >>>>> _______________________________________________ > >>>>> Rails-devel mailing list > >>>>> Rai...@li... > >>>>> https://lists.sourceforge.net/lists/listinfo/rails-devel > >>>> > >>>> > >>>> ------------------------------------------------------------------- > >>>> ----------- Create and publish websites with WebMatrix Use the most > >>>> popular FREE web apps or write code yourself; WebMatrix provides > >>>> all the features you need to develop and publish your website. > >>>> http://p.sf.net/sfu/ms-webmatrix-sf > >>>> _______________________________________________ > >>>> Rails-devel mailing list > >>>> Rai...@li... > >>>> https://lists.sourceforge.net/lists/listinfo/rails-devel > >>>> > >>> > >>> -------------------------------------------------------------------- > >>> ---------- Create and publish websites with WebMatrix Use the most > >>> popular FREE web apps or write code yourself; WebMatrix provides all > >>> the features you need to develop and publish your website. > >>> http://p.sf.net/sfu/ms-webmatrix-sf > >>> _______________________________________________ > >>> Rails-devel mailing list > >>> Rai...@li... > >>> https://lists.sourceforge.net/lists/listinfo/rails-devel > >>> > >> > >> --------------------------------------------------------------------- > >> --------- Create and publish websites with WebMatrix Use the most > >> popular FREE web apps or write code yourself; WebMatrix provides all > >> the features you need to develop and publish your website. > >> http://p.sf.net/sfu/ms-webmatrix-sf > >> _______________________________________________ > >> Rails-devel mailing list > >> Rai...@li... > >> https://lists.sourceforge.net/lists/listinfo/rails-devel > >> > > > > ---------------------------------------------------------------------------- -- > Create and publish websites with WebMatrix Use the most popular FREE > web apps or write code yourself; WebMatrix provides all the features you > need to develop and publish your website. http://p.sf.net/sfu/ms- > webmatrix-sf > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |