beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [01/17] incubator-beam git commit: Fix Exception Unwrapping in TestFlinkRunner
Date Wed, 24 Aug 2016 19:52:39 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master a87015bfe -> 603f337b1


Fix Exception Unwrapping in TestFlinkRunner


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/695a80a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/695a80a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/695a80a7

Branch: refs/heads/master
Commit: 695a80a7df12887df088d0c094177a80edc69ae2
Parents: 79dcc6b
Author: Aljoscha Krettek <aljoscha.krettek@gmail.com>
Authored: Sat Aug 20 10:37:42 2016 +0200
Committer: Kenneth Knowles <klk@google.com>
Committed: Wed Aug 24 12:46:24 2016 -0700

----------------------------------------------------------------------
 .../beam/runners/flink/TestFlinkRunner.java      | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/695a80a7/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/TestFlinkRunner.java
----------------------------------------------------------------------
diff --git a/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/TestFlinkRunner.java
b/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/TestFlinkRunner.java
index 2a82749..6a4f990 100644
--- a/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/TestFlinkRunner.java
+++ b/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/TestFlinkRunner.java
@@ -62,13 +62,22 @@ public class TestFlinkRunner extends PipelineRunner<FlinkRunnerResult>
{
       FlinkRunnerResult result = delegate.run(pipeline);
 
       return result;
-    } catch (RuntimeException e) {
+    } catch (Throwable e) {
       // Special case hack to pull out assertion errors from PAssert; instead there should
       // probably be a better story along the lines of UserCodeException.
-      if (e.getCause() != null
-          && e.getCause() instanceof JobExecutionException
-          && e.getCause().getCause() instanceof AssertionError) {
-          throw (AssertionError) e.getCause().getCause();
+      Throwable cause = e;
+      Throwable oldCause = e;
+      do {
+        if (cause.getCause() == null) {
+          break;
+        }
+
+        oldCause = cause;
+        cause = cause.getCause();
+
+      } while (!oldCause.equals(cause));
+      if (cause instanceof AssertionError) {
+        throw (AssertionError) cause;
       } else {
         throw e;
       }


Mime
View raw message