add ecxeptions to update result instead of throwing them in pollingRemotingProgressMo...
authorKatja Luther <k.luther@bgbm.org>
Thu, 24 May 2018 12:00:46 +0000 (14:00 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 24 May 2018 12:00:46 +0000 (14:00 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/util/ProgressMonitorClientManager.java

index e9b95c03abbdc95740e629e26739b3c8b977b2e8..bfc66e1bce43db36ddc1b7c9fc4b1f7ee87c3749 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
 import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
 import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
@@ -95,7 +96,10 @@ public class ProgressMonitorClientManager {
             }
             // if the total work is still not been set then we assume that the
             // operation has zero work units
-            if(remotingMonitor.getTotalWork() == 0) {
+            if(remotingMonitor.getTotalWork() == 0 && remotingMonitor.isDone()) {
+                return remotingMonitor;
+//                throw new InterruptedException("Monitor has zero work units");
+            }else if (remotingMonitor.getTotalWork() == 0 ){
                 throw new InterruptedException("Monitor has zero work units");
             }
             // start the client monitor
@@ -118,7 +122,12 @@ public class ProgressMonitorClientManager {
                         // the remoting monitor is waiting on feedback
                         // then throw exception
                         if(feedbackCount + 1 > feedbackGenerators.size()) {
-                            throw new IllegalStateException("Remoting monitor waiting on feedback that does not exist");
+                            IllegalStateException exception = new IllegalStateException("Remoting monitor waiting on feedback that does not exist");
+                            Object result = remotingMonitor.getResult();
+                            if (result instanceof UpdateResult){
+                                ((UpdateResult)result).addException(exception);
+                            }
+
                         }
                         feedbackGenerators.get(feedbackCount).setFeedbackForMonitor(uuid);
                         feedbackCount++;
@@ -138,7 +147,9 @@ public class ProgressMonitorClientManager {
                 editorTotalWorkDone = serverTotalWorkDone;
             }
             if(remotingMonitor.getResult() instanceof Exception) {
-                throw new IllegalStateException((Exception)remotingMonitor.getResult());
+                UpdateResult result = new UpdateResult();
+                result.addException((Exception) remotingMonitor.getResult());
+//                throw new IllegalStateException((Exception)remotingMonitor.getResult());
             }
             return remotingMonitor;
         } finally {