[OSM-dev] Osmosis error read-xml (NullPointerException)

marcus.wolschon at googlemail.com marcus.wolschon at googlemail.com
Thu May 28 12:52:51 BST 2009


On Thu, 28 May 2009 17:42:02 +1000, Brett Henderson <brett at bretth.com>
wrote:
> Line 43 of RelationMemberWriter above deals with the relation member 
> role.  Your osm file above is missing all of the role attributes on 
> relation members which would cause this problem to occur.
> 
> Perhaps xapi doesn't include the role attribute if it is empty ... I 
> thought it was mandatory ...


So maybe we should add a

if (member.getRole() == null) {
   throw new IllegalArgumentException("no role for reltion-member "
   + member.getElementID() + " of relation " + relation.getID());
}

to give better error-messages in this case.

or much better, add this to 
RelationMenber:setRole(final String aRole)
so no illegal members can ever be created.
(and of cause call the setters from the constructor
 as is good practice to make subclassing easier.)

Marcus




More information about the dev mailing list