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

    https://github.com/apache/storm/pull/2426#discussion_r151887752
  
    --- Diff: 
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpoutConfig.java
 ---
    @@ -718,7 +718,13 @@ private static void setAutoCommitMode(Builder<?, ?> 
builder) {
                     + " This will be treated as an error in the next major 
release."
                     + " For now the spout will be configured to behave like it 
would have in pre-1.2.0 releases.");
     
    -            final boolean enableAutoCommit = 
(boolean)builder.kafkaProps.get(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG);
    +            Object enableAutoCommitValue = 
builder.kafkaProps.get(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG);
    --- End diff --
    
    @srdo I believe that this logic can be simplified to:
    
    ``` java
    final boolean isAutoCommitEnabled = 
Boolean.parseBoolean(builder.kafkaProps.get(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG).toString());
    ```
    or if you prefer it more explicit:
    
    ``` java
    final Object autoCommitConf = 
builder.kafkaProps.get(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG);
    final boolean isAutoCommitEnabled = 
Boolean.parseBoolean(autoCommitConf.toString());
    ```


---

Reply via email to