JC created GERONIMO-6563:
----------------------------
Summary: Code smell in equals implementation
Key: GERONIMO-6563
URL: https://issues.apache.org/jira/browse/GERONIMO-6563
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: transaction manager
Reporter: JC
Priority: Trivial
Hi
In recent github mirror for geronimo-txmanager, I've found the following
problem.
Path:
geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RecoveryImpl.java
{code}
199
200 private boolean equals(Xid xid1, Xid xid2) {
201 return xid1.getFormatId() == xid1.getFormatId()
202 && Arrays.equals(xid1.getBranchQualifier(),
xid2.getBranchQualifier())
203 && Arrays.equals(xid1.getGlobalTransactionId(),
xid2.getGlobalTransactionId());
204 }
205
{code}
In Line 201, xd1.getFormatId() is comapred to itself. Since I don't have domain
knowledge about the project, I have no idea if only comparing branch qualifiers
and global transaction ids are enough to make sure xd1 and x2 be same. But, I
wanted to report just in case.
Thanks!
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)