merged from trunk to apply xtype test to the keyfield duplication handling.
Authored by: SeanZ 2012-05-31
Parent: [r6221]
Child: [r6223]