// types may be missing, but fieldSchema will return a nullable string
List<Schema.Field> fields = Lists.newArrayList();
for (int i = 0; i < header.length; i += 1) {
if (header[i] == null) {
throw new DatasetException("Bad header for field " + i + ": null");
} else if (header[i].trim().isEmpty()) {
throw new DatasetException(
"Bad header for field " + i + ": \"" + header[i] + "\"");
} else if(!Compatibility.isAvroCompatibleName(header[i].trim())) {
throw new DatasetException(
"Bad header for field, should start with a character " +
"or _ and can contain only alphanumerics and _ " +
i + ": \"" + header[i] + "\"");
}
fields.add(new Schema.Field(