diff --git a/metafix/src/main/java/org/metafacture/metafix/FixMethod.java b/metafix/src/main/java/org/metafacture/metafix/FixMethod.java index 8eddcfe5..38e538fa 100644 --- a/metafix/src/main/java/org/metafacture/metafix/FixMethod.java +++ b/metafix/src/main/java/org/metafacture/metafix/FixMethod.java @@ -180,7 +180,7 @@ public void apply(final Metafix metafix, final Record record, final List h.forEach((subField, value) -> { record.addNested(field, new Value(subField)); - record.addNested(field, value); + record.addNested(field, value.withPathSet(null)); }); }))); } @@ -210,9 +210,9 @@ public void apply(final Metafix metafix, final Record record, final List oldValue.matchType() .ifArray(a -> { record.remove(newName); - a.forEach(v -> record.addNested(newName, v)); + a.forEach(v -> record.addNested(newName, v.withPathSet(null))); }) - .orElse(v -> record.set(newName, v)); + .orElse(v -> record.set(newName, v.withPathSet(null))); } } }, diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java index 8b167257..edba4f05 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java @@ -2190,8 +2190,17 @@ public void inDoBindCopyFieldWithVarInSourceAndTarget() { @Test public void replaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTarget() { + replaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTarget(true); + } + + @Test + public void replaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTargetImplicitArray() { + replaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTarget(false); + } + + private void replaceAllWithWildcardAfterCopyFieldWithVarInSourceAndTarget(final boolean explicitArray) { MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( - "set_array('RSWK[]')", + explicitArray ? "set_array('RSWK[]')" : "", "do list(path: '650??', 'var': '$i')", " copy_field('$i.a', 'RSWK[].$append.subjectTopicName')", " copy_field('$i.v', 'RSWK[].$last.subjectGenre')", diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromXml/toJson/replace_allInOptionalSubfieldOfRepeatedObjectsWithAsteriskImplicitArray/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromXml/toJson/replace_allInOptionalSubfieldOfRepeatedObjectsWithAsteriskImplicitArray/todo.txt deleted file mode 100644 index bb2574a2..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromXml/toJson/replace_allInOptionalSubfieldOfRepeatedObjectsWithAsteriskImplicitArray/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #377