catch NPE for DwCA Export
authorKatja Luther <k.luther@bgbm.org>
Mon, 13 Mar 2017 14:37:13 +0000 (15:37 +0100)
committerKatja Luther <k.luther@bgbm.org>
Mon, 13 Mar 2017 14:37:13 +0000 (15:37 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/DarwinCoreArchiveExportWizard.java

index 7610fc8a96472da66e27eb20ed57606c0004b96a..ec77256c86c4b7cb24c409dbd1d0fc58843c328b 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -11,8 +11,10 @@ package eu.etaxonomy.taxeditor.io.wizard;
 
 import java.io.File;
 
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.progress.IProgressConstants;
 
 import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -30,7 +32,7 @@ public class DarwinCoreArchiveExportWizard extends
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
         * org.eclipse.jface.viewers.IStructuredSelection)
         */
@@ -38,10 +40,10 @@ public class DarwinCoreArchiveExportWizard extends
        public void init(IWorkbench workbench, IStructuredSelection selection) {
                configurator = DwcaTaxExportConfigurator.NewInstance(null, null, null);
        }
+
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
         */
@@ -52,7 +54,7 @@ public class DarwinCoreArchiveExportWizard extends
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.jface.wizard.Wizard#performFinish()
         */
        @Override
@@ -62,14 +64,18 @@ public class DarwinCoreArchiveExportWizard extends
 
                configurator.setDestination(new File(urlString));
 
-               CdmStore.getExportManager().run(configurator);
+               Job exportJob = CdmStore.getExportManager().createIOServiceJob(configurator, configurator.getDestination());
+               exportJob.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+               exportJob.setUser(true);
+        // schedule job
+               exportJob.schedule();
 
                return true;
        }
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
         */
        @Override