You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/10 07:28:02 UTC

[GitHub] [flink] wuchong commented on a change in pull request #11688: [FLINK-17080] Fix possible NPE in Utils.CollectHelper

wuchong commented on a change in pull request #11688: [FLINK-17080] Fix possible NPE in Utils.CollectHelper
URL: https://github.com/apache/flink/pull/11688#discussion_r406639484
 
 

 ##########
 File path: flink-java/src/main/java/org/apache/flink/api/java/Utils.java
 ##########
 @@ -138,6 +138,12 @@ public void writeRecord(T record) throws IOException {
 
 		@Override
 		public void close() {
+			// when the sink is up but not initialized and the job fails due to other operators,
+			// it is possible that close() is called when open() is not called,
+			// so we have to do this null check
+			if (accumulator == null) {
+				accumulator = new SerializedListAccumulator<>();
 
 Review comment:
   But the case is job failed, I think it's hard to make sure the accumulator is in result even if job is failed. What if the operator/task/container is never aroused?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services