Skip to content

Commit

Permalink
Add check for "null" - string for productTypeReference key attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
salander85 committed Oct 23, 2023
1 parent 6044ba3 commit aa29202
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static String getProductTypeKey(@Nonnull final AttributeNestedType neste
throws InvalidReferenceException {

final String key = nestedAttributeType.getTypeReference().getId();
if (isBlank(key)) {
if (isBlank(key) || "null".equals(key)) {
throw new InvalidReferenceException(BLANK_ID_VALUE_ON_REFERENCE);
}
return key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void validateAndCollectReferencedKeys_WithEmptyDraft_ShouldHaveEmptyResult() {
attributeTypeBuilder
.nestedBuilder()
.typeReference(
productTypeReferenceBuilder -> productTypeReferenceBuilder.id("")))
productTypeReferenceBuilder -> productTypeReferenceBuilder.id("null")))
.name("invalidNested")
.label(ofEnglish("koko"))
.isRequired(true)
Expand All @@ -282,7 +282,7 @@ void validateAndCollectReferencedKeys_WithEmptyDraft_ShouldHaveEmptyResult() {
.nestedBuilder()
.typeReference(
productTypeReferenceBuilder ->
productTypeReferenceBuilder.id(""))))
productTypeReferenceBuilder.id("null"))))
.name("setOfInvalidNested")
.label(ofEnglish("koko"))
.isRequired(true)
Expand Down

0 comments on commit aa29202

Please sign in to comment.