jain-sip icon indicating copy to clipboard operation
jain-sip copied to clipboard

SIPMessage hashCode implementation just takes CallID

Open jaimecasero opened this issue 8 years ago • 3 comments

This is fundametally wrong, and can potentially create incorrect logic, and make collections containing SIPMessage to perform poor. This needs to be addressed ASAP.

Proposal on new impl is to consider (CallId + topmostVia.branchId + req/res). Probably better to implement diff hashCode on req and res level

jaimecasero avatar Mar 09 '16 12:03 jaimecasero

Implementing using firstLine + callid + topvia.branch

jaimecasero avatar Mar 09 '16 17:03 jaimecasero

Specified by spec https://jsip.ci.cloudbees.com/job/jsip/javadoc/javax/sip/message/Message.html#equals(java.lang.Object)

Request/Response line, From, To, CallID, MaxForwards, CSeq and Via headers

jaimecasero avatar Mar 10 '16 00:03 jaimecasero

TCK collisions with SPEC requirements at https://github.com/RestComm/jain-sip/blob/master/src/test/tck/factory/MessageFactoryTest.java#L76

Setting an extension header follows with an assertion checking Reqs are different. Since no mandatory header was changed, the Reqs are equal in terms of JAIN SIP Spec, but TCK assumed deep equality.

jaimecasero avatar Mar 10 '16 10:03 jaimecasero