AmqpMessage.reject() throws "Can't release non-received message." (copy-paste from release())

Đang mở Phù hợp với người mới
#2,623 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@dimitribekale đang làm issue này rồi.

Từ ngày 20/10/2026.

  • #2705 của @dimitribekale — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
95/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
testing-qa

Hướng nghiên cứu

Mở activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java và đọc guard của reject() cùng với release(), accept() và modify(). Tái hiện kịch bản không có receiver trong issue, sau đó xác minh rằng reject() báo cáo thao tác reject và hành vi hiện có của IllegalStateException vẫn không thay đổi trong các trường hợp khác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Component: activemq-amqp — AMQP test client (src/test/java)
Version: present on main as of 2026-09-28, commit c339114e
Environment: not applicable — the defect is a compile-time string constant, independent of JVM, container and configuration.

Description

In AmqpMessage.java, the guard in reject() throws an IllegalStateException whose message names
the wrong operation. It is identical to the one thrown by release() directly above it:

The sibling guards each name their own operation, so the intended text is unambiguous:
148
and 177
"Can't accept non-received message.",
195
"Can't modify non-received message.".

git blame traces the line to f71e0ee15b2c456dac28cf456deafb764221afa6 (2016-10-11), the commit
that added reject(), so the wording appears to be a copy-paste from release() rather than a
later regression.

Impact

Test-only and minor. This is the AMQP test client, not broker code, so there is no runtime effect on
users. The cost is diagnostic: a test that calls reject() on a message that was never received
reports a release failure, pointing whoever debugs it at the wrong method.

Steps to reproduce
AmqpMessage msg = new AmqpMessage();   // no receiver
try {
    msg.reject();
    fail("expected IllegalStateException");
} catch (IllegalStateException e) {
    // actual:   "Can't release non-received message."
    // expected: "Can't reject non-received message."
}
Proposed fix
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
@@ (reject(), line 221)
     public void reject() throws Exception {
         if (receiver == null) {
-            throw new IllegalStateException("Can't release non-received message.");
+            throw new IllegalStateException("Can't reject non-received message.");
         }

I searched the open and closed GitHub issues and the AMQ JIRA project and did not find an existing
report. Happy to open a PR with this if it is welcome.

Provenance

This was found during an academic study of LLM-assisted code review at Jeonbuk National University, Jeonju, South Korea. An
automated LLM-based reviewer produced the initial analysis, and I verified it by reading the source at
c339114e. I am disclosing the origin in line with project norms on AI-assisted reports. I believe
it is a genuine, if trivial, defect and will respect your triage either way.

Ngôn ngữ chính
Java
Star
2.5k
Fork
1.5k
Merge trung bình
23 giờ 10 phút
Pull request đã merge (30 ngày)
81

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/activemq

Tất cả issue của apache/activemq

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.