Description
When an exception is thrown in kafka-delete-records, it propagates through `main` to the JVM, producing the following message:
bin/kafka-delete-records.sh --bootstrap-server localhost:9092 --offset-json-file /tmp/does-not-exist Exception in thread "main" java.io.IOException: Unable to read file /tmp/does-not-exist at org.apache.kafka.common.utils.Utils.readFileAsString(Utils.java:787) at org.apache.kafka.tools.DeleteRecordsCommand.execute(DeleteRecordsCommand.java:105) at org.apache.kafka.tools.DeleteRecordsCommand.main(DeleteRecordsCommand.java:64) Caused by: java.nio.file.NoSuchFileException: /tmp/does-not-exist at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214) at java.nio.file.Files.newByteChannel(Files.java:361) at java.nio.file.Files.newByteChannel(Files.java:407) at java.nio.file.Files.readAllBytes(Files.java:3152) at org.apache.kafka.common.utils.Utils.readFileAsString(Utils.java:784) ... 2 more
This is in contrast to the error handling used in other tools, such as the kafka-log-dirs:
bin/kafka-log-dirs.sh --bootstrap-server localhost:9092 --describe --command-config /tmp/does-not-exist /tmp/does-not-exist java.nio.file.NoSuchFileException: /tmp/does-not-exist at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214) at java.nio.file.Files.newByteChannel(Files.java:361) at java.nio.file.Files.newByteChannel(Files.java:407) at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384) at java.nio.file.Files.newInputStream(Files.java:152) at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:686) at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:673) at org.apache.kafka.tools.LogDirsCommand.createAdminClient(LogDirsCommand.java:149) at org.apache.kafka.tools.LogDirsCommand.execute(LogDirsCommand.java:68) at org.apache.kafka.tools.LogDirsCommand.mainNoExit(LogDirsCommand.java:54) at org.apache.kafka.tools.LogDirsCommand.main(LogDirsCommand.java:49)
Attachments
Issue Links
- links to