Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1437#discussion_r46814334
  
    --- Diff: 
flink-streaming-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumer.java
 ---
    @@ -516,10 +510,12 @@ public void close() throws Exception {
     
                if (LOG.isDebugEnabled()) {
                        LOG.debug("Snapshotting state. Offsets: {}, checkpoint 
id: {}, timestamp: {}",
    -                                   Arrays.toString(lastOffsets), 
checkpointId, checkpointTimestamp);
    +                                   
KafkaTopicPartition.toString(lastOffsets), checkpointId, checkpointTimestamp);
                }
     
    -           long[] currentOffsets = Arrays.copyOf(lastOffsets, 
lastOffsets.length);
    +           // the use of clone() is okay here is okay, we just need a new 
map, the keys are not changed
    +           //noinspection unchecked
    +           HashMap<KafkaTopicPartition, Long> currentOffsets = 
(HashMap<KafkaTopicPartition, Long>) lastOffsets.clone();
    --- End diff --
    
    Why don't you use `new HashMap<>(lastOffsets)` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to