[
https://issues.apache.org/jira/browse/ARTEMIS-5266?focusedWorklogId=954506&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-954506
]
ASF GitHub Bot logged work on ARTEMIS-5266:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 29/Jan/25 17:09
Start Date: 29/Jan/25 17:09
Worklog Time Spent: 10m
Work Description: gemmellr commented on code in PR #5477:
URL: https://github.com/apache/activemq-artemis/pull/5477#discussion_r1934275466
##########
artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java:
##########
@@ -549,27 +549,27 @@ public void
sendAcknowledged(org.apache.activemq.artemis.api.core.Message client
@Override
public void sendFailed(org.apache.activemq.artemis.api.core.Message
clientMessage, Exception exception) {
- if (jmsMessage instanceof StreamMessage) {
+ if (jmsMessage instanceof StreamMessage message) {
try {
- ((StreamMessage) jmsMessage).reset();
+ message.reset();
} catch (JMSException e) {
// HORNETQ-1209 XXX ignore?
}
}
- if (jmsMessage instanceof BytesMessage) {
+ if (jmsMessage instanceof BytesMessage message) {
try {
- ((BytesMessage) jmsMessage).reset();
+ message.reset();
} catch (JMSException e) {
// HORNETQ-1209 XXX ignore?
}
}
try {
producer.connection.getThreadAwareContext().setCurrentThread(true);
- if (exception instanceof ActiveMQException) {
- exception =
JMSExceptionHelper.convertFromActiveMQException((ActiveMQException) exception);
- } else if (exception instanceof ActiveMQInterruptedException) {
- exception =
JMSExceptionHelper.convertFromActiveMQException((ActiveMQInterruptedException)
exception);
+ if (exception instanceof ActiveMQException qException) {
+ exception =
JMSExceptionHelper.convertFromActiveMQException(qException);
Review Comment:
```suggestion
if (exception instanceof ActiveMQException amqException) {
exception =
JMSExceptionHelper.convertFromActiveMQException(amqException);
```
Issue Time Tracking
-------------------
Worklog Id: (was: 954506)
Time Spent: 2h (was: 1h 50m)
> Code gardening after move to Java 17
> ------------------------------------
>
> Key: ARTEMIS-5266
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5266
> Project: ActiveMQ Artemis
> Issue Type: Task
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2h
> Remaining Estimate: 0h
>
> With the recent move to Java 17 now is a good time to do some code gardening
> to leverage new language features (e.g. text blocks) and deal with old issue
> (e.g. unused variables, etc.).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact