On Sun, 16 Sep 2012 04:42:54 PM Michael Vehrs wrote:
> Sounds sensible. I hope I have not introduced any new serialization
> bugs

I am afraid serialization is still a problem.  I think it is triggered by a 
unit animation,
but I am seeing these:

net.sf.freecol.client.control.InGameInputHandler multiple
        WARNING: Caught crash in multiple item 0, continuing.
        Mon Sep 17 10:00:58 CST 2012
        Thread ID: 221
        Stack trace:
java.lang.NullPointerException
        at net.sf.freecol.common.model.Unit.readAttributes(Unit.java:3833)
        at 
net.sf.freecol.common.model.FreeColObject.readFromXML(FreeColObject.java:519)
        at 
net.sf.freecol.common.model.FreeColGameObject.readFromXML(FreeColGameObject.java:469)
        at 
net.sf.freecol.common.model.FreeColObject.readFromXMLElement(FreeColObject.java:467)
        at 
net.sf.freecol.common.model.UnitLocation.<init>(UnitLocation.java:144)
        at 
net.sf.freecol.common.model.GoodsLocation.<init>(GoodsLocation.java:84)
        at net.sf.freecol.common.model.Unit.<init>(Unit.java:386)
        at 
net.sf.freecol.client.control.InGameInputHandler.selectUnitFromElement(InGameInputHandler.java:307)
        at 
net.sf.freecol.client.control.InGameInputHandler.animateMove(InGameInputHandler.java:328)
        at 
net.sf.freecol.client.control.InGameInputHandler.handle(InGameInputHandler.java:121)
        at 
net.sf.freecol.client.control.InGameInputHandler.multiple(InGameInputHandler.java:1170)
        at 
net.sf.freecol.client.control.InGameInputHandler.handle(InGameInputHandler.java:171)
        at 
net.sf.freecol.common.networking.Connection$1.run(Connection.java:424)


The line that is crashing is "equipment.clear();".  equipment is a
TypeCountMap that has a valid initialization, but as the stack trace
shows the Unit constructor has not yet completed at this point so
equipment is presumably still null.  ISTM that Goods/UnitLocation are
starting to read XML prematurely.  There seems to be some
acknowledgement that something strange is happening in that the new
code contains these:

    // Only Unit needs this
    public UnitLocation(Game game, Element e) {
        super(game, e);
        readFromXMLElement(e);
    }

in both UnitLocation and GoodsLocation.  Now obviously we could paper
over the bug with an "if (equipment != null) ..." but can we do this
better?

Cheers,
Mike Pope

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Freecol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to