Skip to content

Commit 116b579

Browse files
committed
account for null reference names in validation
1 parent fa251ed commit 116b579

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

core-plugins/src/e2e-test/features/fileplugin/sink/FileSinkErrorScenarios.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ Feature:File Sink - Verify File Sink Plugin Error scenarios
88
Then Navigate to the properties page of plugin: "File"
99
Then Click on the Validate button
1010
Then Verify mandatory property error for below listed properties:
11-
| referenceName |
1211
| path |
1312
| format |

core-plugins/src/e2e-test/features/fileplugin/source/FileSourceErrorScenarios.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Feature:File Source - Verify File Source Plugin Error scenarios
88
Then Navigate to the properties page of plugin: "File"
99
Then Click on the Validate button
1010
Then Verify mandatory property error for below listed properties:
11-
| referenceName |
1211
| path |
1312
| format |
1413

format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSinkConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public abstract class AbstractFileSinkConfig extends PluginConfig implements Fil
4141
public static final String NAME_SUFFIX = "suffix";
4242

4343
@Description("Name be used to uniquely identify this sink for lineage, annotating metadata, etc.")
44+
@Nullable
4445
private String referenceName;
4546

4647
@Macro
@@ -85,7 +86,9 @@ public void validate(FailureCollector collector) {
8586
}
8687

8788
public void validate(FailureCollector collector, Map<String, String> arguments) {
88-
IdUtils.validateReferenceName(referenceName, collector);
89+
if (!Strings.isNullOrEmpty(referenceName)) {
90+
IdUtils.validateReferenceName(referenceName, collector);
91+
}
8992
if (suffix != null && !containsMacro(NAME_SUFFIX)) {
9093
try {
9194
new SimpleDateFormat(suffix);

format-common/src/main/java/io/cdap/plugin/format/plugin/AbstractFileSourceConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public abstract class AbstractFileSourceConfig extends PluginConfig implements F
4242
public static final String DEFAULT_FILE_ENCODING = "UTF-8";
4343

4444
@Description("Name be used to uniquely identify this source for lineage, annotating metadata, etc.")
45+
@Nullable
4546
private String referenceName;
4647

4748
@Macro
@@ -141,7 +142,9 @@ public void validate() {
141142
}
142143

143144
public void validate(FailureCollector collector) {
144-
IdUtils.validateReferenceName(referenceName, collector);
145+
if (!Strings.isNullOrEmpty(referenceName)) {
146+
IdUtils.validateReferenceName(referenceName, collector);
147+
}
145148
try {
146149
getSchema();
147150
} catch (IllegalArgumentException e) {

0 commit comments

Comments
 (0)