Marcel & Olaf, thank you very much for confirming!

Johannes

On 01/22/15 02:16, Marcel Reutegger wrote:
Hi,

thanks for reporting this. There is indeed a problem with the
equals implementation. I created an issue:
https://issues.apache.org/jira/browse/OAK-2435

Regards
  Marcel

On 22/01/15 06:55, "Johannes Birgmeier" <[email protected]> wrote:

Dear Jackrabbit/Oak developers,

to keep this very short: I'm a new Stanford computer science PhD student
working on verification. To get started, I've written a program to
verify the hashCode/equals contract in Java. I let this run on Apache
projects. In Apache Jackrabbit-Oak, in the following class:

https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java
/org/apache/jackrabbit/oak/plugins/document/UpdateOp.java

in the equals method, somebody wrote:
return name.equals(other.name) &&
        revision != null ? revision.equals(other.revision) : other.revision ==
null;

However, the ternary operator has lower precedence than "&&". Therefore,
to maintain the hashCode/equals contract, this should be:
return name.equals(other.name) &&
        (revision != null ? revision.equals(other.revision) : other.revision ==
null);

Could you perhaps get back to me with a very quick acknowledgement if
you think this is sound? I'm going to send my verifier to a conference
on computer aided verification, and bug acknowledgements help a lot to
sell a paper. Thanks a lot in advance for any kind of feedback!

Best regards,
Johannes Birgmeier



Reply via email to