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 6, 2022
1 parent fa251ed commit 02dcc23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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 02dcc23

Please sign in to comment.