diff --git a/neo4jwriter/src/main/java/com/alibaba/datax/plugin/writer/neo4jwriter/Neo4jClient.java b/neo4jwriter/src/main/java/com/alibaba/datax/plugin/writer/neo4jwriter/Neo4jClient.java index fabcd0aa..baa309fc 100644 --- a/neo4jwriter/src/main/java/com/alibaba/datax/plugin/writer/neo4jwriter/Neo4jClient.java +++ b/neo4jwriter/src/main/java/com/alibaba/datax/plugin/writer/neo4jwriter/Neo4jClient.java @@ -198,13 +198,14 @@ public class Neo4jClient { private MapValue checkAndConvert(Record record) { int sourceColNum = record.getColumnNumber(); - List neo4JProperties = writeConfig.neo4jProperties; - - int len = Math.min(sourceColNum, neo4JProperties.size()); - Map data = new HashMap<>(len * 4 / 3); - for (int i = 0; i < len; i++) { + List neo4jProperties = writeConfig.neo4jProperties; + if (neo4jProperties == null || neo4jProperties.size() != sourceColNum){ + throw new DataXException(Neo4jErrorCode.CONFIG_INVALID,"the read and write columns do not match!"); + } + Map data = new HashMap<>(sourceColNum * 4 / 3); + for (int i = 0; i < sourceColNum; i++) { Column column = record.getColumn(i); - Neo4jProperty neo4jProperty = neo4JProperties.get(i); + Neo4jProperty neo4jProperty = neo4jProperties.get(i); try { Value value = ValueAdapter.column2Value(column, neo4jProperty);