Review Request -- 5045147 : When TreeMap is empty explicitly check for null keys in put()

Mike Duigou mike.duigou at
Fri Mar 11 00:15:37 UTC 2011

This is a review request for an issue which was previously committed in 2006 but was quickly withdrawn because it was believed to cause a regression in other software. That removal was mistaken and this fix appears to be bona-fide beneficial.

Note that this fix impacts both TreeMap and TreeSet. Prior to this fix both have allowed "null" to be added to the collection when the map/set is empty. I've personally run across this issue in usage. Diagnosing and fixing the broken application wasn't initially obvious because of this bug in TreeMap/TreeSet. Only after some frustrating sleuthing were we able to conclude that the problem was in TreeMap.



More information about the core-libs-dev mailing list