On 15/06/10 16:45, Andrea Aime wrote:
> I would not blame Alice for Bob lack of skill (or simple oversight).
> She exposed a Map and made no promises on ordering, Bob took it and
> promised what he could not deliver.

How does finger pointing between Alice and Bob help Carol? A bit of 
defensive programming by Alice could have prevented Carol from being 
inconvenienced. I see HashMap iteration order leakage so often that I 
suspect a systemic problem in its use. Avoiding exposing HashMap 
iteration order (e.g. using LinkedHashMap) removes a common problem that 
is hard to detect on a single platform.

This one bit me today when I made the unreasonable assumption that an 
XSDSchema[] would be ordered:
Schemas.findSchemas (line 114) "new HashSet(":
http://svn.osgeo.org/geotools/trunk/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xml/Schemas.java

In this one, we see WFS responses in which the encoded namespace 
attribute and schemaLocation order is platform-dependent, which makes 
for interesting unit tests. We have not fixed all of them, and this 
breaks some of Christian's Hudson instances:
GeoServer FeatureTypeSchemaBuilder.build (line 119) "new HashMap(":
https://svn.codehaus.org/geoserver/trunk/src/wfs/src/main/java/org/geoserver/wfs/xml/FeatureTypeSchemaBuilder.java

I have previously removed other HashMap use in GeoTools. You will like 
this one, Andrea, as the solution was to use an ArrayList instead:
SimpleFeatureTypeImpl:
http://jira.codehaus.org/browse/GEOT-2338
ComplexTypeImpl:
http://jira.codehaus.org/browse/GEOT-2378

How do we configure Eclipse to make "new HashMap(" and "new HashSet(" 
blinking red 18-point text?  ;-)

Kind regards,

-- 
Ben Caradoc-Davies <ben.caradoc-dav...@csiro.au>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to