diff --git a/src/main/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilder.java b/src/main/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilder.java index 1854446..275fb78 100644 --- a/src/main/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilder.java +++ b/src/main/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilder.java @@ -85,6 +85,10 @@ public void closeObject(SerializationContext ctx) { if (!ctx.isCurrentEmpty()) { currentNode.prependItem(ctx.getContextNode()); } + closeCurrentNode(); + } + + private void closeCurrentNode() { currentNode.close(); if (!nodeStack.empty()) { this.currentNode = nodeStack.pop(); @@ -126,7 +130,7 @@ public void openCollection(SerializationContext> ctx) { @Override public void closeCollection(SerializationContext ctx) { assert currentNode instanceof CollectionNode; - closeObject(ctx); + closeCurrentNode(); } public CompositeNode getTreeRoot() { diff --git a/src/test/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilderTest.java b/src/test/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilderTest.java index a0b6028..869ccfd 100644 --- a/src/test/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilderTest.java +++ b/src/test/java/cz/cvut/kbss/jsonld/serialization/JsonLdTreeBuilderTest.java @@ -23,7 +23,6 @@ import cz.cvut.kbss.jsonld.environment.Vocabulary; import cz.cvut.kbss.jsonld.environment.model.*; import cz.cvut.kbss.jsonld.serialization.context.DummyJsonLdContext; -import cz.cvut.kbss.jsonld.serialization.context.MappingJsonLdContextFactory; import cz.cvut.kbss.jsonld.serialization.model.*; import cz.cvut.kbss.jsonld.serialization.serializer.LiteralValueSerializers; import cz.cvut.kbss.jsonld.serialization.serializer.compact.DefaultValueSerializer;