[ https://issues.apache.org/jira/browse/KAFKA-17270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17871394#comment-17871394 ]
Greg Harris commented on KAFKA-17270: ------------------------------------- Also, if you're only changing the setExitProcedure/setHaltProcedure types, then you're just substituting the ClassCastException for AssertionError [https://github.com/apache/kafka/blob/1db84c1a113cb3b115ff3565b5b368643338b6c9/core/src/main/scala/kafka/utils/Exit.scala#L29] so an exception is still going to appear in the logs. It would probably be better to get this ClassCastException than the AssertionError just because it happens deeper in the call tree, where test-specific code is being run. > the input function of Exit#setHaltProcedure/Exit#setExitProcedure should > return `Unit` rather than `Nothing` > ------------------------------------------------------------------------------------------------------------ > > Key: KAFKA-17270 > URL: https://issues.apache.org/jira/browse/KAFKA-17270 > Project: Kafka > Issue Type: Test > Reporter: Chia-Ping Tsai > Assignee: Ming-Yen Chung > Priority: Minor > > I noticed it due to following exception. > {code:java} > java.lang.ClassCastException: class scala.runtime.BoxedUnit cannot be cast to > class scala.runtime.Nothing$ (scala.runtime.BoxedUnit and > scala.runtime.Nothing$ are in unnamed module of loader 'app') > at > kafka.server.ServerShutdownTest.$anonfun$testNoCleanShutdownAfterFailedStartupDueToCorruptLogs$3(ServerShutdownTest.scala:176) > at > kafka.server.ServerShutdownTest.$anonfun$testNoCleanShutdownAfterFailedStartupDueToCorruptLogs$3$adapted(ServerShutdownTest.scala:174) > at kafka.utils.Exit$$anon$1.execute(Exit.scala:81) > at org.apache.kafka.common.utils.Exit.halt(Exit.java:71) > at kafka.utils.Exit$.halt(Exit.scala:33) > at kafka.log.LogManager.handleLogDirFailure(LogManager.scala:230) > at > kafka.server.ReplicaManager.handleLogDirFailure(ReplicaManager.scala:2501) > at > kafka.server.ReplicaManager$LogDirFailureHandler.doWork(ReplicaManager.scala:325) > at > org.apache.kafka.server.util.ShutdownableThread.run(ShutdownableThread.java:136) > {code} > It seems to me using `Nothing` as returned type is weird and in this case the > suitable type should be `Unit` (same as other methods). Also, that can fix > the casting error in `testNoCleanShutdownAfterFailedStartupDueToCorruptLogs` > [0] > https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/utils/Exit.scala#44 > [1] > https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/utils/Exit.scala#50 -- This message was sent by Atlassian Jira (v8.20.10#820010)