From 0b8b0bcf0ad421541ee428613da3ff1697bd11ad Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Mon, 6 Nov 2017 12:53:36 +0200 Subject: [PATCH] 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 --- .../org/simantics/db/layer0/migration/MigrationStateImpl.java | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.1