cadonna commented on code in PR #16433:
URL: https://github.com/apache/kafka/pull/16433#discussion_r1689346485


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/RecordCollectorImpl.java:
##########
@@ -217,16 +218,32 @@ public <K, V> void send(final String topic,
                     valueClass),
                 exception);
         } catch (final Exception exception) {
+            final ProductionExceptionHandler.SerializationExceptionOrigin 
origin;
+            if (keyBytes == null) {
+                origin = 
ProductionExceptionHandler.SerializationExceptionOrigin.KEY;
+            } else {
+                origin = 
ProductionExceptionHandler.SerializationExceptionOrigin.VALUE;
+            }

Review Comment:
   If you want to keep the `final` and make the code a bit better readable, you 
could rename `handleClassCastException()` to 
`createStreamsExceptionForClassCastException()` and return the 
`StreamsException` from there. Then you can do
   ```java
   } catch (final ClassCastException exception) {
               throw createStreamsExceptionForClassCastException()(
                   topic,
                   key,
                   value,
                   keySerializer,
                   valueSerializer,
                   exception);
   ```
   With this it is clear that the `catch`-branch terminates the method.



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