In the "Building SIF Data Objects Dynamically" part, there is a line said:
String sifField = (ElementDef)m.get( field );
where I think the parameter "field" should be localField.