Skip to content

Commit

Permalink
account for null reference names in validation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrahanjam committed Oct 7, 2022
1 parent fa251ed commit 116b579
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ Feature:File Sink - Verify File Sink Plugin Error scenarios
Then Navigate to the properties page of plugin: "File"
Then Click on the Validate button
Then Verify mandatory property error for below listed properties:
| referenceName |
| path |
| format |
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Feature:File Source - Verify File Source Plugin Error scenarios
Then Navigate to the properties page of plugin: "File"
Then Click on the Validate button
Then Verify mandatory property error for below listed properties:
| referenceName |
| path |
| format |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public abstract class AbstractFileSinkConfig extends PluginConfig implements Fil
public static final String NAME_SUFFIX = "suffix";

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

@Macro
Expand Down Expand Up @@ -85,7 +86,9 @@ public void validate(FailureCollector collector) {
}

public void validate(FailureCollector collector, Map<String, String> arguments) {
IdUtils.validateReferenceName(referenceName, collector);
if (!Strings.isNullOrEmpty(referenceName)) {
IdUtils.validateReferenceName(referenceName, collector);
}
if (suffix != null && !containsMacro(NAME_SUFFIX)) {
try {
new SimpleDateFormat(suffix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public abstract class AbstractFileSourceConfig extends PluginConfig implements F
public static final String DEFAULT_FILE_ENCODING = "UTF-8";

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

@Macro
Expand Down Expand Up @@ -141,7 +142,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) {
Expand Down

0 comments on commit 116b579

Please sign in to comment.