[錯誤]java.lang.IllegalArgumentException: Index for header 'XXX' is 1 but CSVRecord only has 1 val

NIFI使用過程中報錯,查看源碼發現越界後會報此錯誤

    public String get(final String name) {
        if (mapping == null) {
            throw new IllegalStateException(
                "No header mapping was specified, the record values can't be accessed by name");
        }
        final Integer index = mapping.get(name);
        if (index == null) {
            throw new IllegalArgumentException(String.format("Mapping for %s not found, expected one of %s", name,
                mapping.keySet()));
        }
        try {
            return values[index.intValue()];
        } catch (final ArrayIndexOutOfBoundsException e) {
            throw new IllegalArgumentException(String.format(
                "Index for header '%s' is %d but CSVRecord only has %d values!", name, index,
                Integer.valueOf(values.length)));
        }
    }

繼續檢查發現配置CSVReader時Value Separator屬性填寫錯誤,修改後執行成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章