SourceForge has been redesigned. Learn more.

#56 Case insensitive mapping.


According to feature request 2344526, case insensitive mapping strategy was added as of v2.0. There are some case insensitive pieces of code; however, adding a lower-case mapping and trying to map a mixed or upper-case heading does not produce valid results. The getColumnName method inside HeaderColumnNameTranslateMappingStrategy receives an index of the column to map. This index is used to find the appropriate header on line 24:

return getColumnMapping().get(header[col]);

The array contains a mixed or upper-case value and the columnMapping contains lower-case values. Hence, the line returns a null as it tries to find a mixed or upper-case value in a map filled with lower-case keys. An example, if the columnMapping contains "given name" as key at index 2 and the input CSV contains "Given Name", no match is found.


  • Nobody/Anonymous

    Here is a potential fix:

    public class CaseInsensitiveHeaderColumnNameTranslateMappingStrategy<T> extends
    HeaderColumnNameTranslateMappingStrategy<T> {

    protected String getColumnName(int col) {
    return getColumnMapping().get(StringUtils.upperCase(header[col]));

    public void setColumnMapping(Map<String, String> columnMapping) {
    Map<String, String> upperColumnMapping = new HashMap<String, String>();

    for (String columnMappingKey : columnMapping.keySet()) {


  • durcek

    durcek - 2010-11-09

    Sorry for the nobody sender - forgot to login before the post.

  • Scott Conway

    Scott Conway - 2010-12-25
    • assigned_to: nobody --> sconway
    • status: open --> closed-fixed
  • Scott Conway

    Scott Conway - 2010-12-25

    Fixed. I modified the setColumnMapping to be similar to the fix suggested by pdurcek. This is in revision 77 if you want to check out the source or it will be in the next version which I will try and have out after the Xmas vacation.



Log in to post a comment.