diff --git a/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidator.java b/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidator.java index d4895a7cd0..231d40d89a 100644 --- a/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidator.java +++ b/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidator.java @@ -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; diff --git a/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidatorTest.java b/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidatorTest.java index f091736bdc..dc809c313b 100644 --- a/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidatorTest.java +++ b/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidatorTest.java @@ -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) @@ -282,7 +282,7 @@ void validateAndCollectReferencedKeys_WithEmptyDraft_ShouldHaveEmptyResult() { .nestedBuilder() .typeReference( productTypeReferenceBuilder -> - productTypeReferenceBuilder.id("")))) + productTypeReferenceBuilder.id("null")))) .name("setOfInvalidNested") .label(ofEnglish("koko")) .isRequired(true)