]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/utils/AsyncUtils.java
Catch Throwable instead of Exception in SCL AsyncUtils
[simantics/platform.git] / bundles / org.simantics.scl.runtime / src / org / simantics / scl / runtime / utils / AsyncUtils.java
index fcab99c20ae632f4b26320bdafecf66fbd46334b..f0edd2c99e9f07423a1d9dd543bc6696e6884cd7 100644 (file)
@@ -2,7 +2,6 @@ package org.simantics.scl.runtime.utils;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -44,9 +43,9 @@ public class AsyncUtils {
             SCLContext.push(context);
             try {
                 f.apply(Tuple0.INSTANCE);
-            } catch (Exception e) {
-                LOGGER.error("Could not execute async", e);
-                printError(e);
+            } catch (Throwable t) {
+                LOGGER.error("Could not execute async", t);
+                printError(t);
             } finally {
                 SCLContext.pop();
             }
@@ -55,7 +54,7 @@ public class AsyncUtils {
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
     public static List<Object> pmap(Function f, List<Object> l) {
-        return Arrays.asList(l.parallelStream().map(a -> f.apply(a)).toArray());
+        return l.parallelStream().map(f::apply).collect(Collectors.toList());
     }
 
     @SuppressWarnings({ "rawtypes", "unchecked" })