Skip to content

Commit aa29202

Browse files
author
salander85
committed
Add check for "null" - string for productTypeReference key attribute
1 parent 6044ba3 commit aa29202

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private static String getProductTypeKey(@Nonnull final AttributeNestedType neste
167167
throws InvalidReferenceException {
168168

169169
final String key = nestedAttributeType.getTypeReference().getId();
170-
if (isBlank(key)) {
170+
if (isBlank(key) || "null".equals(key)) {
171171
throw new InvalidReferenceException(BLANK_ID_VALUE_ON_REFERENCE);
172172
}
173173
return key;

src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeBatchValidatorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void validateAndCollectReferencedKeys_WithEmptyDraft_ShouldHaveEmptyResult() {
264264
attributeTypeBuilder
265265
.nestedBuilder()
266266
.typeReference(
267-
productTypeReferenceBuilder -> productTypeReferenceBuilder.id("")))
267+
productTypeReferenceBuilder -> productTypeReferenceBuilder.id("null")))
268268
.name("invalidNested")
269269
.label(ofEnglish("koko"))
270270
.isRequired(true)
@@ -282,7 +282,7 @@ void validateAndCollectReferencedKeys_WithEmptyDraft_ShouldHaveEmptyResult() {
282282
.nestedBuilder()
283283
.typeReference(
284284
productTypeReferenceBuilder ->
285-
productTypeReferenceBuilder.id(""))))
285+
productTypeReferenceBuilder.id("null"))))
286286
.name("setOfInvalidNested")
287287
.label(ofEnglish("koko"))
288288
.isRequired(true)

0 commit comments

Comments
 (0)