Drifter-yh opened a new pull request, #11501: URL: https://github.com/apache/rocketmq/pull/11501
### Which Issue(s) This PR Fixes Fixes #11500 ### Brief Description Opening the target truncates it before the source is opened. If the two paths refer to the same existing file, including a hard link, this silently destroys the source. Reject that case with an IOException before opening the destination. Normal copies retain their existing behavior. This public utility has no production call sites in this repository; no broker-level data-loss scenario is claimed. This does not address the separate relative-target issue #11461. ### How Did You Test This Change? - On `592d59d12db356f8c98332d9e355a89d92590db3`, the same-path regression failed before the fix: expected 14 bytes, got zero. - Compiled the production utility and focused JUnit 4 tests with Microsoft OpenJDK 17.0.14; all 3 passed after the change: same path, hard link, and a distinct target. - `git diff --check` passed. - Maven reactor test is currently running; results will be updated when available. No broker integration test is claimed. AI assistance: OpenAI Codex was used for analysis, implementation, and tests; the changes were reviewed and tested as described above. -- 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]
