|
From: Michael P. <mp...@co...> - 2008-08-27 11:18:26
|
Following up my own problem... On Tue, 26 Aug 2008 21:19:31 Michael T. Pope wrote: > I am repeatably seeing this failure with current 0.8.0 from svn. > net.sf.freecol.server.FreeColServer saveGame > WARNING: java.lang.NullPointerException ...caused by this object... > net.sf.freecol.common.model.FreeColObject toXMLImpl > INFO: toXMLImpl, getXMLElementTagName==null: model.goods.bells > (model.monarch.colonyGoodsParty) PERCENTAGE 50.0 Tue Aug 26 16:46:52 CST > 2008 which is a Modifier. The trouble is that a Modifier is a Feature which is a FreeColObject, and Modifier (or Feature) does not supply its own version of toXMLImpl(XMLStreamWriter), unlike all the immediate subclasses of FreeColObject. This is not a problem for Feature as it is abstract, but Modifiers end up calling FreeColObject.toXMLImpl(), which in turn calls the wrong getXMLElementTagName(). Adding the obvious implementation of toXMLImpl() to Modifier makes saving work again. Ability is also a Feature with this problem, although I have not seen it triggered. This could be made robust against recurrence by making FreeColObject.toXMLImpl(XMLStreamWriter) an abstract method (indeed, its right next to a couple of other routines with a "// TODO: make these abstract" comment:-). AFAICT the existing routine is only ever called in the course of the above error. For the present though I have kept the fix to the minimum, being new here. Cheers, Mike Pope |