hmmm, i do not see what you mean. 

attributeName == null here doesn't mean that there is a null value for the attribute. It means that an id field has not been specified, so it should use the id that is asigned by geotools.