From cc90994e17d0b1ce2c5b6e41a82f7d5fceb30e73 Mon Sep 17 00:00:00 2001 From: FuYouJ <1247908487@qq.com> Date: Fri, 7 Jul 2023 21:00:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=BC=BA=E5=B1=9E=E6=80=A7=E5=88=97?= =?UTF-8?q?=E5=92=8C=E6=BA=90=E6=95=B0=E6=8D=AE=E5=88=97=E7=9A=84=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=EF=BC=8C=E4=B8=8D=E5=8C=B9=E9=85=8D=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/writer/neo4jwriter/Neo4jClient.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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);