mjsax commented on code in PR #18152:
URL: https://github.com/apache/kafka/pull/18152#discussion_r1884355860


##########
streams/src/main/java/org/apache/kafka/streams/internals/AutoOffsetResetInternal.java:
##########
@@ -31,6 +31,13 @@ public StrategyType offsetResetStrategy() {
         return offsetResetStrategy;
     }
 
+    // calling `Optional.get()` w/o checking `isPresent()` results in a 
warning that we suppress
+    // (there is unfortunately no speficif suppression for `Optional.get()` 
warnings)
+    //
+    // we do call `get()` unconditionally on purpose here, as it should only 
be called before `offsetResetStrategy()`
+    // was used to verify that the strategy is "by_duration"
+    // if the strategy is not "by_duration" and `duration()` is called,
+    // we want to fail right away to surface the bug in the caller code

Review Comment:
   Works for me -- I did consider it at some point, but thought just hitting a 
`NoSuchElementException` would be good enough... Will update.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to