You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Galkin Alexey (Jira)" <ji...@apache.org> on 2024/04/22 12:35:00 UTC
[jira] [Created] (ARTEMIS-4738) OVERRIDING EQUALS NOT SYMMETRIC in ActiveMQQueue.java
Galkin Alexey created ARTEMIS-4738:
--------------------------------------
Summary: OVERRIDING EQUALS NOT SYMMETRIC in ActiveMQQueue.java
Key: ARTEMIS-4738
URL: https://issues.apache.org/jira/browse/ARTEMIS-4738
Project: ActiveMQ Artemis
Issue Type: Bug
Reporter: Galkin Alexey
The equals method is overridden in the ActiveMQQueue class and this method uses the instanceof operator to check the type of the object. However, this does not take into account the symmetry of the equals method. The equals method must be symmetric, that is, if a.equals(b) returns true, then b.equals(a) must return true.
In this case, if the object "o" is not an instance of the ActiveMQQueue class, the equals method immediately returns false([line 83|https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java]), without giving the opportunity to check, on the contrary, whether the current object is an instance of the object "o". Therefore, the equals method in this case does not satisfy the symmetry requirement and can lead to incorrect results when comparing objects.
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author Alexey Galkin.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)