You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by rm...@apache.org on 2015/11/10 14:33:44 UTC

[2/2] flink git commit: [hotfix] Check for null in StreamSource.cancel()

[hotfix] Check for null in StreamSource.cancel()


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/c0983773
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/c0983773
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/c0983773

Branch: refs/heads/release-0.10
Commit: c09837732fdc7fdb3a65a9d4bffaff38887cee5d
Parents: 5716659
Author: Robert Metzger <rm...@apache.org>
Authored: Tue Nov 10 11:32:20 2015 +0100
Committer: Robert Metzger <rm...@apache.org>
Committed: Tue Nov 10 12:40:45 2015 +0100

----------------------------------------------------------------------
 .../org/apache/flink/streaming/api/operators/StreamSource.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/c0983773/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
index fbecbd1..65c11b6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
@@ -64,7 +64,10 @@ public class StreamSource<T> extends AbstractUdfStreamOperator<T, SourceFunction
 
 	public void cancel() {
 		userFunction.cancel();
-		ctx.close();
+		// the context may not be initialized if the source was never running.
+		if(ctx != null) {
+			ctx.close();
+		}
 	}
 
 	/**