diff --git a/imixs-archive-service/src/main/java/org/imixs/archive/service/restore/RestoreService.java b/imixs-archive-service/src/main/java/org/imixs/archive/service/restore/RestoreService.java index 3f54c87..787f07e 100644 --- a/imixs-archive-service/src/main/java/org/imixs/archive/service/restore/RestoreService.java +++ b/imixs-archive-service/src/main/java/org/imixs/archive/service/restore/RestoreService.java @@ -32,12 +32,6 @@ import java.util.logging.Logger; import java.util.regex.Pattern; -import jakarta.annotation.Resource; -import jakarta.ejb.Stateless; -import jakarta.ejb.Timeout; -import jakarta.ejb.Timer; -import jakarta.inject.Inject; - import org.imixs.archive.service.ArchiveException; import org.imixs.archive.service.RemoteAPIService; import org.imixs.archive.service.cassandra.ClusterService; @@ -53,6 +47,12 @@ import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; +import jakarta.annotation.Resource; +import jakarta.ejb.Stateless; +import jakarta.ejb.Timeout; +import jakarta.ejb.Timer; +import jakarta.inject.Inject; + /** * The RestoreService restores the workflow data stored in the cassandra cluster * into a Imixs-Workflow instance. The service class runs in the background as a @@ -276,15 +276,18 @@ void onTimeout(jakarta.ejb.Timer timer) throws Exception { for (String snapshotID : snapshotIDs) { String latestSnapshot = findLatestSnapshotID(snapshotID, restoreFrom, restoreTo); - // did we found a snapshot to restore? ItemCollection snapshot; + String remoteSnapshotID = null; if (latestSnapshot != null) { - // yes! - // lets see if this snapshot is already restored or synced? - String remoteSnapshotID = remoteAPIService - .readSnapshotIDByUniqueID(dataService.getUniqueID(latestSnapshot)); - if (latestSnapshot.equals(remoteSnapshotID)) { + // yes, lets see if this snapshot is already restored or synced? + try { + remoteSnapshotID = remoteAPIService + .readSnapshotIDByUniqueID(dataService.getUniqueID(latestSnapshot)); + } catch (ArchiveException ae) { + // expected if not found + } + if (remoteSnapshotID != null && latestSnapshot.equals(remoteSnapshotID)) { logger.finest( "......no need to restore - snapshot:" + latestSnapshot + " is up to date!"); } else { @@ -311,7 +314,7 @@ void onTimeout(jakarta.ejb.Timer timer) throws Exception { } } else { logger.warning( - ".... unexpected data situation: we found no latest snapthost matching our restore time range!"); + ".... unexpected data situation: no latest snapshot found, matching requested restore time range!"); } } }