
I've now tracked down the problem. The tertiary way 114405617 and its copy C114405617 share the list of Coord objects. Not just the actual Coord's (which is correct) but the ArrayList too. Code in addRoadWithoutLoops() replaces the nodes that have a highwayCount greater than 1 with CoordNode objects. If the tertiary way is processed first then it will end up properly routable. When the copy is processed however, the nodes have already been replaced and have no highwayCount, so it appears to have no connection to other roads to the code. So you end up with a road without the correct routing information which happens to crash MapSource.
The previous workaround removed the piece of road that ended up without routing information. Sometimes that would be the MP copy and sometimes the original road - it just depends on which is done last.
Two solutions I can think of 1. Always ensure you have a (shallow) copy of the list. 2. Fix up the addRoadsWithoutLoops() to recognise that a way has already been processed and do everything that would have been done anyway.
I favour 1) hoping that there is no intentional sharing of lists anywhere.
Attached is a patch that copies the list in the Way constructor. I'll check all call sites to make sure there is no duplicate copying later. This patch is instead of the previous workaround.
Steve, I could also create a copy of the points list in the mp algorithm (I would call it a bug that it hasn't been done :-). But having a look at the signature of the constructor I would expect that it takes a copy of the points list. On the other side copying the points list will create some temporary lists but I think that's ok. I have removed three copies of the points list that are unneccessary now. See attached patch Routing_error3.patch.
This kind of tagging that produces the problem is particularly common in Spain, in the UK I couldn't find any examples and in Germany there are only a few; perhaps one per tile. In fact the only German example I tried to trace had been changed since I downloaded it and was no longer a problem. Every Spanish example I looked at was a sure routing failure however.
..Steve
What do you think of Felix proposal to add a special handling for highways in multipolygons? I doesn't feel good to me but I could add it if required. WanMil