diff --git a/Kitodo/src/main/java/org/kitodo/production/services/workflow/WorkflowControllerService.java b/Kitodo/src/main/java/org/kitodo/production/services/workflow/WorkflowControllerService.java index 032a0611810..a06106799a7 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/workflow/WorkflowControllerService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/workflow/WorkflowControllerService.java @@ -463,8 +463,12 @@ private void activateTasksForClosedTask(Task closedTask) throws DataException, I for (Task automaticTask : automaticTasks) { automaticTask.setProcessingBegin(new Date()); - TaskScriptThread thread = new TaskScriptThread(automaticTask); - TaskManager.addTask(thread); + if (automaticTask.isTypeExportDMS()) { + taskService.executeDmsExport(automaticTask); + } else { + TaskScriptThread thread = new TaskScriptThread(automaticTask); + TaskManager.addTask(thread); + } } closeParent(process); diff --git a/Kitodo/src/main/java/org/kitodo/production/thread/TaskScriptThread.java b/Kitodo/src/main/java/org/kitodo/production/thread/TaskScriptThread.java index 91c9320b094..d9e8d69f81e 100644 --- a/Kitodo/src/main/java/org/kitodo/production/thread/TaskScriptThread.java +++ b/Kitodo/src/main/java/org/kitodo/production/thread/TaskScriptThread.java @@ -73,13 +73,6 @@ public void run() { logger.error(e.getMessage(), e); } } - if (task.isTypeExportDMS()) { - try { - taskService.executeDmsExport(this.task); - } catch (DataException | IOException | DAOException e) { - logger.error("Data Exception occurred", e); - } - } super.setProgress(100); }