mirror of https://github.com/apache/lucene.git
Fix equals/hashcode of IOContext (#13204)
This commit is contained in:
parent
75e1ebc450
commit
00073c4c1a
|
@ -246,6 +246,8 @@ Bug Fixes
|
||||||
|
|
||||||
* GITHUB#13169: Fix potential race condition in DocumentsWriter & DocumentsWriterDeleteQueue (Ben Trent)
|
* GITHUB#13169: Fix potential race condition in DocumentsWriter & DocumentsWriterDeleteQueue (Ben Trent)
|
||||||
|
|
||||||
|
* GITHUB#13204: Fix euals/hashCode of IOContext. (Uwe Schindler, Robert Muir)
|
||||||
|
|
||||||
Other
|
Other
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.lucene.store;
|
package org.apache.lucene.store;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IOContext holds additional details on the merge/search context. A IOContext object can never be
|
* IOContext holds additional details on the merge/search context. A IOContext object can never be
|
||||||
* initialized as null as passed as a parameter to either {@link
|
* initialized as null as passed as a parameter to either {@link
|
||||||
|
@ -118,13 +120,7 @@ public class IOContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
return Objects.hash(context, flushInfo, mergeInfo, readOnce, load);
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((context == null) ? 0 : context.hashCode());
|
|
||||||
result = prime * result + ((flushInfo == null) ? 0 : flushInfo.hashCode());
|
|
||||||
result = prime * result + ((mergeInfo == null) ? 0 : mergeInfo.hashCode());
|
|
||||||
result = prime * result + (readOnce ? 1231 : 1237);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,13 +130,10 @@ public class IOContext {
|
||||||
if (getClass() != obj.getClass()) return false;
|
if (getClass() != obj.getClass()) return false;
|
||||||
IOContext other = (IOContext) obj;
|
IOContext other = (IOContext) obj;
|
||||||
if (context != other.context) return false;
|
if (context != other.context) return false;
|
||||||
if (flushInfo == null) {
|
if (!Objects.equals(flushInfo, other.flushInfo)) return false;
|
||||||
if (other.flushInfo != null) return false;
|
if (!Objects.equals(mergeInfo, other.mergeInfo)) return false;
|
||||||
} else if (!flushInfo.equals(other.flushInfo)) return false;
|
|
||||||
if (mergeInfo == null) {
|
|
||||||
if (other.mergeInfo != null) return false;
|
|
||||||
} else if (!mergeInfo.equals(other.mergeInfo)) return false;
|
|
||||||
if (readOnce != other.readOnce) return false;
|
if (readOnce != other.readOnce) return false;
|
||||||
|
if (load != other.load) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue