class CSVSheetParser implements SheetParser {

    private final CSVParser parser;

    public CSVSheetParser(CSVParser parser) {
        this.parser = parser;
    }

    @Override
    public Map<String, Integer> getHeaderMap() {<FILL_FUNCTION_BODY>}

    @Override
    public long getCurrentRecordNumber() {
        return parser.getRecordNumber();
    }

    @Override
    public Iterator<SheetRow> iterator() {
        return new CSVIterator();
    }

    @Override
    public void close() throws IOException {
        parser.close();
    }

    private class CSVIterator implements Iterator<SheetRow> {

        private final Iterator<CSVRecord> iterator;
        private ErrorRow errorFound = null;

        public CSVIterator() {
            iterator = parser.iterator();
        }

        @Override
        public boolean hasNext() {
            if (errorFound != null) {
                return false;
            }

            try {
                return iterator.hasNext();
            } catch (Exception e) {
                //In case of malformed CSV or bad delimiter
                errorFound = new ErrorRow(e.getMessage());
                Logger.getLogger("").severe(e.getMessage());
                return true;
            }
        }

        @Override
        public SheetRow next() {
            if (errorFound != null) {
                return errorFound;
            } else {
                return new CSVSheetRow(iterator.next());
            }
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }

    private class ErrorRow implements SheetRow {

        private final String errorMessage;

        public ErrorRow(String errorMessage) {
            this.errorMessage = errorMessage;
        }

        @Override
        public boolean isConsistent() {
            return false;
        }

        @Override
        public int size() {
            return 1;
        }

        @Override
        public String get(int index) {
            if (index == 0) {
                return errorMessage;
            } else {
                return null;
            }
        }
    }
}

        Map<String, Integer> map = parser.getHeaderMap();
        if (map == null) {
            return Collections.emptyMap();
        } else {
            //Ignore columns without header
            map.remove(null);
            return map;
        }
    
<no_super_class>