From 9efc8e82e315ecba8e295a9e2f135e996b88fe4e Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Thu, 24 Jun 2010 14:47:11 +0000
Subject: [PATCH] minor fix: migration should not fail when the store is empty

SVN: 16724
---
 .../etlserver/plugins/ChainedDataSetMigrationTask.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/ChainedDataSetMigrationTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/ChainedDataSetMigrationTask.java
index f4b62ecebdb..0bce20159a0 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/ChainedDataSetMigrationTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/ChainedDataSetMigrationTask.java
@@ -101,9 +101,14 @@ public class ChainedDataSetMigrationTask implements IMaintenanceTask
                     return pathname.isDirectory() && UUID_PATTERN.matcher(name).matches();
                 }
             });
-        if (files == null || files.length != 1)
+        if (files == null || files.length == 0)
         {
-            throw new EnvironmentFailureException("Exactly one folder with UUID expected in "
+            operationLog.warn("Store is empty, there is nothing to migrate");
+            return;
+        }
+        if (files.length > 1)
+        {
+            throw new EnvironmentFailureException("At most one folder with UUID expected in "
                     + storeRoot);
         }
         File dbInstanceDir = files[0];
-- 
GitLab