From 30b2657b2c3cb532c6c890f37e6cb7618d008231 Mon Sep 17 00:00:00 2001 From: aiceflower Date: Wed, 26 Jul 2023 16:02:46 +0800 Subject: [PATCH] fix NPE --- .../java/org/apache/linkis/storage/csv/StorageCSVWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/csv/StorageCSVWriter.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/csv/StorageCSVWriter.java index ed7527bcbc..ba4d877f3a 100644 --- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/csv/StorageCSVWriter.java +++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/csv/StorageCSVWriter.java @@ -102,8 +102,8 @@ private String compact(String[] row) { rowBuilder.append(decoratedValue).append(delimiter); } if (rowBuilder.length() > 0 && rowBuilder.toString().endsWith(delimiter)) { - int index = rowBuilder.lastIndexOf(separator); - rowBuilder.delete(index, index + separator.length()); + int index = rowBuilder.lastIndexOf(delimiter); + rowBuilder.delete(index, index + delimiter.length()); } rowBuilder.append("\n"); if (logger.isDebugEnabled()) {