[Bug] IOTinyUtils.copyFile throws NullPointerException for a target file in the current directory
Maintainer thường phản hồi trong vòng 1 ngày
@hickey-ai đang làm issue này rồi.
Từ ngày 20/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
The issue points to IOTinyUtils.copyFile at line 84 and describes bare relative targets, nested targets, and missing sources. Read the existing IOTinyUtilsTest tests and run the native common test suite to see the current behavior. Done means regression coverage verifies copying to new and existing bare targets, nested directory creation, and preserving an existing target when the source is missing; PR #11464 is already open against this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Before Creating the Bug Report
-
I found a bug, not just asking a question, which should be created in GitHub Discussions.
-
I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
-
I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
Windows 11; local file utility tests using unique temporary filenames and cleanup. No broker deployment is required.
RocketMQ version
develop, revision 5.5.1, commit 57c2dc04f78cc7e73e6b8c9436ee0fff0d0f46c3.
JDK Version
OpenJDK 1.8.0_302 (GraalVM CE 21.2.0), Maven 3.6.3.
Describe the Bug
copyFile(source, "copy.bin") constructs a File for the target and unconditionally calls tf.getParentFile().mkdirs(). A bare relative filename has no parent File, so copying fails with NullPointerException before any bytes are copied. Both new and existing target files are affected.
Steps to Reproduce
- Create an ordinary source file with known bytes.
- Call IOTinyUtils.copyFile(source.toString(), "copy-unique-name.bin") with a filename that has no directory component.
- Repeat with an already existing bare target filename.
- Remove the unique test target in finally.
Both calls fail at the getParentFile().mkdirs() line; an absolute or nested target is the control case.
What Did You Expect to See?
A bare filename is a valid target in the current working directory. New files should be copied, existing files overwritten with the source bytes, and nested target directories should still be created when present.
What Did You See Instead?
NullPointerException at IOTinyUtils.copyFile line 84, before the copy starts.
Additional Context
The minimal correction only guards the optional parent directory. Four new regression methods cover new/overwritten relative targets, nested directory creation, and preserving an existing target when the source is missing. Two bare-target cases fail before the correction; all four pass after. The independent native common run executes the 8 existing IOTinyUtilsTest tests plus the 4 new tests: 12 passed, 0 failures/errors/skips, with Checkstyle/SpotBugs passing.
#10208 and PR #10210 concern resource closure in the same method, but their diff does not change the null-parent call. PR #10733 does not modify IOTinyUtils. No matching discussion or relative-target fix was found in the reviewed results.
AI assistance: OpenAI Codex was used for investigation, implementation and tests.
- Ngôn ngữ chính
- Java
- Star
- 22.7k
- Fork
- 12k
- Merge trung bình
- 3 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/rocketmq
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationCó thể đã có người làm @amalsaidov đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
CompressionType.of fails under the Turkish localeCó thể đã có người làm @sharanggupta đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initializationĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket firstCó thể đã có người làm @iloveeyjafjalla đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/rocketmq#11441 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack testsCó thể đã có người làm @chennaji9 đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
apache/rocketmq#11340 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/rocketmq
Issue tương tự
-
bug emitter:client:csharp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/typespec#12572 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-area-label
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
area/ai area/backend component/zeebe kind/task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
spAnser/reacharound#38 ·