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

 ##########
 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:
   Why not just skipt adding this accumulator into context?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to