mhm.. I think you can add attributes with the same name - so no exception. So a check is worth to do, and I think some of the schema modifing plugins (i.e. transfer attributes?) do such a check. Because then one attribute name would receive a ending, saying that it is number 2 or so?
However, I didn't look into the code for this answer stefan Sunburned Surveyor schrieb: > OK. I've spent some time looking at the Javadoc and the source code > for the FeatureSchema class, and I can't find the answer to this > question: > > Would it make sense to check for the existence of an attribute in a > FeatureSchema with the same name as an attribute that is being added > to that schema, and to throw an IllegalArgumentException if this is > encountered? > > For example, you try to add an attribute named "inchesOfRain" to a > Feature schema that already has an attribute with the name > "inchesOfRain". > > As the code of the FeatureSchema is written now I think all we would > get is an exception from the underlying Map object in the > FeatureSchema that stores the attribute name. I'm thinking that > throwing an IllegalArgumentException with a more specific explanation > of the problem would be appropriate. > > Or, if we wanted to have more robust code, we could automatically add > an incremental integer to the end of the attribute name being added if > it was a dupliucate. We could then alert the user of this action if > appropriate. > > For example: inchesOfRain, inchesOfRain1, inchesOfRain2... > > At a minimum, I think we should modify the javadoc comments for the > FeatureSchema.addAttribute methpd to indicate that problems will arise > if an Attriubute is added when an attribute already is contained in > the schema with the same name? > > Any comments? Am I missing something here? > > If this code needs some tweaking to be more robust I can whip up the > modifications for others to review. > > The Sunburned Surveyor > > ------------------------------------------------------------------------------ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel