dimitribekale opened a new issue, #2623: URL: https://github.com/apache/activemq/issues/2623
**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: - [line 208, `release()`](https://github.com/apache/activemq/blob/c339114e77e3614ea16f7fd81f6682611c7a4277/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java#L208) — `"Can't release non-received message."` (correct) - [line 221, `reject()`](https://github.com/apache/activemq/blob/c339114e77e3614ea16f7fd81f6682611c7a4277/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java#L221) — `"Can't release non-received message."` (should say "reject") The sibling guards each name their own operation, so the intended text is unambiguous: [148](https://github.com/apache/activemq/blob/c339114e77e3614ea16f7fd81f6682611c7a4277/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java#L148) and [177](https://github.com/apache/activemq/blob/c339114e77e3614ea16f7fd81f6682611c7a4277/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java#L177) `"Can't accept non-received message."`, [195](https://github.com/apache/activemq/blob/c339114e77e3614ea16f7fd81f6682611c7a4277/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java#L195) `"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 ```java 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 ```diff --- 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. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
