Chia-Ping Tsai created KAFKA-17270:
--------------------------------------

             Summary: 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: Chia-Ping Tsai


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)

Reply via email to