On Fri, 9 Jan 2026 00:54:23 GMT, Alexey Semenyuk <[email protected]> wrote:
>> You need to document it or adjust unit test. It does not make sense to use >> one approach here and different approach in `AppImageFile` below. > > The test code bails out on the first unexpected exception. It doesn't > transform internal exceptions into localized user-friendly messages, etc. > Implementation does. Using the same API in these particular cases solves no > problem. I can just use `Files#readAllBytes(Path)` in the test code to > satisfy the request for the same approach. It will make no difference, but > make the code bulkier than it needs to be. What I mean that our code expects specific set of exception and `final Document doc = XmlUtils.initDocumentBuilder().parse(new ByteArrayInputStream(Files.readAllBytes(appImageFilePath)));` will throw different set of exception than `final Document doc = XmlUtils.initDocumentBuilder().parse(appImageFilePath.toFile());`. Such difference needs to be documented or code adjusted. Is it possible that `parse()` will change exception being thrown in case if file does not exist? If possible then our code will be broken. If we depend on `java.nio.file.NoSuchFileException` vs `java.io.FileNotFoundException`, then lets throw exception we need by checking if file exist first. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29007#discussion_r2674472974
