]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed migrating import temporary folder creation to prevent name overlap 00/1200/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 6 Nov 2017 10:53:36 +0000 (12:53 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 6 Nov 2017 10:53:36 +0000 (12:53 +0200)
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

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/MigrationStateImpl.java

index 06dae94d3fd796690f2ffc22ca18d33a6c0ca0b0..d7f6b4e95497fe0a1ac0991cf27c38720f316681 100644 (file)
@@ -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);