From: Michał B. <ba...@tl...> - 2008-02-17 17:58:34
|
Hi, I have recently played a game of 18AL, found 4 or 5 bugs, and decided to try to see if I can fix some of them... I downloaded sources from cvs, and kept on getting a NullPointer right after clicking 'New Game'. I tracked that down to some code in PublicCompany.java that is a cut and paste code from CompanyManager.java: // BaseToken Tag baseTokenTag = tag.getChild("BaseTokens"); // Cost of laying a token Tag layCostTag = baseTokenTag.getChild("LayCost"); String costMethod = layCostTag.getAttributeAsString("method"); // Must validate the cost method! baseTokenLayCost = layCostTag.getAttributeAsIntegerArray("cost"); /* Cost of buying a token (mutually exclusive with laying cost) */ Tag buyCostTag = tag.getChild("BuyCost"); // We don't have this yet - ignore for now. Tag tokenLayTimeTag = tag.getChild("HomeBase"); if (tokenLayTimeTag != null) { String layTimeString = tokenLayTimeTag.getAttributeAsString("lay"); if (Util.hasValue(layTimeString)) { for (int i = 0; i < tokenLayTimeNames.length; i++) { if (tokenLayTimeNames[i].equalsIgnoreCase(layTimeString)) { homeBaseTokensLayTime = i; break; } } } } (lines 463 to 488 in PublicCompany.java). Commenting this code out results in everything seemingly working fine... So my question: what am I doing wrong? Did I checkout code I wasn't supposed to, and I should check out a branch of a stable version (how?)? Or is the code fine as it is and my NullPointer is me doing something wrong along the way? I am a bit reluctant to try fixing anything while not understatnding what's the deal with this NullPointer... Best regards, Mike Bazynski |
From: brett l. <wak...@gm...> - 2008-02-17 18:11:50
|
On Feb 17, 2008 9:57 AM, Michał Bażyński <ba...@tl...> wrote: > > Hi, > I have recently played a game of 18AL, found 4 or 5 bugs, and decided > to try to see if I can fix some of them... I downloaded sources from > cvs, and kept on getting a NullPointer right after clicking 'New Game'. Welcome! If you read through the archives for the last two weeks, you'll see a few posts that will shed light on this. There's some work being done to get 18EU up and running that has likely destabilized things a bit. I'm not aware of this particular NPE happening during the last release version, so it's likely to be recent commits that did this. > So my question: what am I doing wrong? Did I checkout code I wasn't > supposed to, and I should check out a branch of a stable version (how?)? > Or is the code fine as it is and my NullPointer is me doing something > wrong along the way? I am a bit reluctant to try fixing anything while > not understatnding what's the deal with this NullPointer... It sounds like you didn't do anything wrong. Just find which variable is unexpectedly null, and see if you can put together a patch that fixes it. If you want to send us a stack trace, that will help significantly more than a code segment. > > Best regards, > Mike Bazynski > ---Brett. |
From: Erik V. <eri...@hc...> - 2008-02-17 22:44:02
|
Apologies for this error. It was caused by work in progress. I have somewhat reorganized the various XML fragments that dealt with tile laying and base token costing, and moved the latter into PublicCompany. You catched me halfway this move.... I have just committed the above changes and some more bug fixes, and things look well, although I haven't tested very extensively yet. Side-effects on games completed before occasionally happen, and we're always grateful for bug reports. Erik. > -----Original Message----- > From: rai...@li... > [mailto:rai...@li...] On Behalf > Of brett lentz > Sent: Sunday 17 February 2008 19:12 > To: Development list for Rails: an 18xx game > Subject: Re: [Rails-devel] [newbie] null pointer in PublicCompany? > > On Feb 17, 2008 9:57 AM, Michał Bażyński <ba...@tl...> wrote: > > > > Hi, > > I have recently played a game of 18AL, found 4 or 5 > bugs, and decided > > to try to see if I can fix some of them... I downloaded sources from > > cvs, and kept on getting a NullPointer right after clicking > 'New Game'. > > > Welcome! If you read through the archives for the last two weeks, > you'll see a > few posts that will shed light on this. There's some work being done > to get 18EU > up and running that has likely destabilized things a bit. > > I'm not aware of this particular NPE happening during the last release > version, so > it's likely to be recent commits that did this. > > > So my question: what am I doing wrong? Did I checkout code I wasn't > > supposed to, and I should check out a branch of a stable > version (how?)? > > Or is the code fine as it is and my NullPointer is me doing > something > > wrong along the way? I am a bit reluctant to try fixing > anything while > > not understatnding what's the deal with this NullPointer... > > It sounds like you didn't do anything wrong. Just find which > variable is > unexpectedly null, and see if you can put together a patch > that fixes it. If > you want to send us a stack trace, that will help > significantly more than a > code segment. > > > > > Best regards, > > Mike Bazynski > > > > > ---Brett. > -------------------------------------------------------------- > ----------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > |