[JAVA-472] WriteConcern equals uses == instead of equals() for _w object and no hashcode() impl Created: 15/Nov/11  Updated: 18/Jun/12  Resolved: 11/Mar/12

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.7
Fix Version/s: 2.8.0

Type: Bug Priority: Minor - P4
Reporter: Mark Pollack Assignee: Jeffrey Yemin
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7


Backwards Compatibility: Minor Change

 Description   

This test will fail since WriteConcern's equals methods uses == and not equals() for the _w field. I noticed this when testing the new API to pass a string into the WriteConcern constructor. Here is a failing test case

	public void testWriteConcernEquality() {
		String s1 =  new String("rack1");
		String s2 =  new String("rack1");
		WriteConcern wc1 = new WriteConcern(s1);
		WriteConcern wc2 = new WriteConcern(s2);
		assertThat(wc1, equalTo(wc2));
	}
	



 Comments   
Comment by Jeffrey Yemin [ 18/Jun/12 ]

Closing for 2.8.0 release.

Comment by auto [ 11/Mar/12 ]

Author:

{u'login': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-472: Fixed equals and hashCode for WriteConcern
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/31223fdc47b505b4e9be73365b238b178a41c786

Generated at Thu Feb 08 08:52:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.