Description
When field alias is used, I get NullPointerException in Schema.Field.hashCode() because Field.name is null. This is because Schema.getFieldAlias return null for non-aliased field. Currently the code is as below:
private static String getFieldAlias(Name record, String field,
Map<Name, Map<String, String>> fieldAliases) {
Map<String, String> recordAliases = fieldAliases.get(record);
if(recordAliases == null)
return recordAliases.get(field);
}
Given recordAliases only has aliases, it should return field itself if it's not in recordAliases as below:
private static String getFieldAlias(Name record, String field,
Map<Name, Map<String, String>> fieldAliases) {
Map<String, String> recordAliases = fieldAliases.get(record);
if(recordAliases == null) { return field; }
String ret = recordAliases.get(field);
if (ret == null) ret = field;
return ret;
}