From d32626e9a920dfd20e4c3de8d6eccbb4cefc0ed5 Mon Sep 17 00:00:00 2001 From: Mehrdad Rahanjam Date: Thu, 6 Oct 2022 16:38:58 -0400 Subject: [PATCH] account for null reference names in validation --- .../io/cdap/plugin/format/plugin/AbstractFileSinkConfig.java | 4 +++- .../cdap/plugin/format/plugin/AbstractFileSourceConfig.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSinkConfig.java b/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSinkConfig.java index 4a337641c8..68e637b99a 100644 --- a/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSinkConfig.java +++ b/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSinkConfig.java @@ -85,7 +85,9 @@ public void validate(FailureCollector collector) { } public void validate(FailureCollector collector, Map arguments) { - IdUtils.validateReferenceName(referenceName, collector); + if (!Strings.isNullOrEmpty(referenceName)) { + IdUtils.validateReferenceName(referenceName, collector); + } if (suffix != null && !containsMacro(NAME_SUFFIX)) { try { new SimpleDateFormat(suffix); diff --git a/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSourceConfig.java b/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSourceConfig.java index 75a3095d68..41d4720686 100644 --- a/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSourceConfig.java +++ b/format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSourceConfig.java @@ -141,7 +141,9 @@ public void validate() { } public void validate(FailureCollector collector) { - IdUtils.validateReferenceName(referenceName, collector); + if (!Strings.isNullOrEmpty(referenceName)) { + IdUtils.validateReferenceName(referenceName, collector); + } try { getSchema(); } catch (IllegalArgumentException e) {