hayageek commented on PR #1432: URL: https://github.com/apache/wicket/pull/1432#issuecomment-4295614769
Hi @martin-g , I have implemented the code review comments. 1. mkdirs() result ignored Replaced uploadFieldFolder.mkdirs() (whose boolean return is silently ignored) with Files.createDirectories(target.toPath().getParent()), which throws IOException on failure — making errors impossible to miss. 2. Extract duplicated code The identical validation block that appeared in both save() and getFile() is now a single private helper: Both save() and getFile() now simply call resolveTargetFile(...). 3. Unit tests — already done in the previous round (5 tests total covering all three cases for both save() and getFile()). 4. IOException silently swallowed in getPathForComparison() Changed the broad catch (IOException e) to catch (NoSuchFileException e). The fallback to toAbsolutePath().normalize() is only valid for the case where the directory doesn't exist yet (sub-folder created during save()). All other IO errors (permissions, device failures, etc.) now propagate correctly instead of being hidden. -- 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]
