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);
```
--
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