From: Tuukka Lehtonen Date: Mon, 6 Nov 2017 10:53:36 +0000 (+0200) Subject: Fixed migrating import temporary folder creation to prevent name overlap X-Git-Tag: v1.31.0~54 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F00%2F1200%2F1;p=simantics%2Fplatform.git Fixed migrating import temporary folder creation to prevent name overlap Previously model imports could fail if they were small and contained one or more shared libraries imported at the same time because the imports could be done within the same second which triggered the folder name overlap. refs #7603 Change-Id: I0f559f2fe2e7bdb1a8852e7cd7a74cecd7bb6055 --- diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/MigrationStateImpl.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/MigrationStateImpl.java index 06dae94d3..d7f6b4e95 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/MigrationStateImpl.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/MigrationStateImpl.java @@ -33,6 +33,7 @@ import org.simantics.db.WriteGraph; import org.simantics.db.WriteOnlyGraph; import org.simantics.db.common.request.WriteResultRequest; import org.simantics.db.common.utils.Logger; +import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.AssumptionException; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.impl.DefaultPasteImportAdvisor; @@ -221,6 +222,7 @@ public class MigrationStateImpl implements MigrationState { Resource indexRoot = graph.newResource(); String indexRootName = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(new Date()); + indexRootName = NameUtils.findFreshName(graph, indexRootName, temp, L0.ConsistsOf, "%s-%d"); graph.claim(indexRoot, L0.InstanceOf, L0.IndexRoot); graph.addLiteral(indexRoot, L0.HasName, L0.String, indexRootName, Bindings.STRING); graph.claim(temp, L0.ConsistsOf, indexRoot);